dlegs / php-jpeg-injector

Injects php payloads into jpeg images
452 stars 121 forks source link

get_loc always returns an index, even when the magic number is missing #4

Closed apehex closed 3 years ago

apehex commented 3 years ago

Hello again,

I think I spotted a mistake, line 28 of gd-jpeg.py.

str.find returns -1 if no match is found, and -1 evaluates to True. So whether or not the magic number is found,

In case the magic number is not here, the code will be injected in position 9 = len(magic) - 1

if loc:
    print("Found magic number.")
    return loc