xss game level 3

assb
|2020. 6. 29. 15:33

 location.hash를 사용하면 url “https://xss-game.appspot.com/level3/frame#1에서 #1을 가져오게 된다. 따라서 location.hash.substr(1) 1을 가져오는 함수이다.

 

 

 또한 그렇게 가져온 값이 num에 들어간다. 그 값으로 “<img src=’/static/level3/cloud” + num + “./jpg’/>”; 문장이 완성되게 된다. 문제를 해결하기 위해서는 존재하지 않는 이미지를 띄우고 onerror 처리를 해야한다. 따라서 num의 값으로 src를 닫고, onerror 코드를 추가하면 된다.

 

 

 따라서 #2.jpg’ onerror=’alert()’/>// 라 입력을 하면 num2.jpg’ onerror=’alert()’/>//가 들어가게 된다. html 변수에 <img src=’/static/level3/cloud2.jpg’ onerror=’alert()’/>//./jpg’/>;가 추가된다. 이렇게 입력할 경우 image2가 출력된다. onerror는 이미지가 존재하지 않을 경우 실행되므로 존재하지 않는 이미지(0또는 4부터)를 입력하면 문제가 풀린다.

 

 

 

728x90

'CTF > 웹 해킹' 카테고리의 다른 글

csictf 2020  (0) 2020.07.23
Google CTF 2019  (0) 2020.06.29
xss game level 2  (0) 2020.06.29
xss game level 1  (0) 2020.06.29
webhacking.kr challenge 59  (0) 2020.06.29