На странице
apsyleg1 мин
#portswigger #file-upload #rce #path-traversal #web-security

Web Shell Upload через Path Traversal

Лаборатория

Web shell upload via path traversal · Apprentice

Решение

Дано

This lab contains a vulnerable image upload function. The server is configured
to prevent execution of user-supplied files, but this restriction can be
bypassed by exploiting a secondary vulnerability.

To solve the lab, upload a basic PHP web shell and use it to exfiltrate the
contents of the file /home/carlos/secret. Submit this secret using the button
provided in the lab banner.

You can log in to your own account using the following credentials: wiener:peter

Анализ и разведка

Суть как и в предыдущей лабе. Только на этот раз нужно использовать техники path traversal для загрузки файла в директорию, где наш шелл будет исполнен.

Зальём файл через сайт. Залился, открываем — открылся просто как текст.

Окей, тогда попробуем залить в директорию выше:

Content-Disposition: form-data; name="avatar"; filename="../shell.php"

Сервер пишет, что залил всё-таки в прежнее место. Ок, попробуем энкодинг:

Content-Disposition: form-data; name="avatar"; filename="%2e%2e%2fshell.php"
The file avatars/../shell.php has been uploaded

Сработало!

FU2yHUj75eKOuqf4Zp5L9CLf6N96aTDH

Лаба решена!