A website I'm hosting on my dedicated server has been hacked.
Some pictures have been infected with things like <?php eval(base64_decode(....));?>
.
I'm looking for a generic shell command which would able to read the headers of the most common image types (jpg, gif, tiff, etc.).
I tried jhead and others, jut jhead can only read EXIF data from JPG.
The aim is to find all infected images like this :
find -type f \( -iname "*jpg" -or -iname "*.jpeg" -or ... \) -exec sh -c 'magicimgheadersdisplay "{}" | grep eval" \;
strings
will display any printable bits it finds in a file. From there you can feed it intogrep
to find text within.grep -l
can be used to report infected files. Try a command likeThe
-print0
and-0
arguments allow filenames and paths to contain spaces.