write-up/XSS-game write-up

XSS game level 4 - Context matters

정보보호학과 새내기 2021. 7. 19. 11:02
반응형
SMALL

Mission Description

Every bit of user-supplied data must be correctly escaped for the context of the page in which it will appear. This level shows why.

--> 사용자에게 제공되는 데이터의 모든 비트는 표시되는 페이지의 내용에서 올바르게 탈출되어야 한다. 이번 레벨은 그 이유를 보여준다.

Mission Objective

Inject a script to pop up a JavaScript alert() in the application.

--> 스크립트를 주입하여 애플리케이션에서 javascript alert()를 팝업 창에 띄우시오.

 

Solve

 <img src="/static/loading.gif" onload="startTimer('{{ timer }}');" />

첨에 코드를 보고 timer에 입력한 값이 들어간다는 것을 알게 되었다. 따라서 첨에 생각한것은 onload를 닫고 다시 앞문제들에서 사용했던 onerror를 다시 여는 것이었다.

 

')%3b"onerror='alert("Hello")%3b'

 

하지만 실패를 했고 다른 방법을 생각해보다가 그냥 onload에서 alert를 실행해봐야겠다는 생각을 하게되었다.

 

')%3balert("Hello")%3b('

 

이 방법이 맞았고 아래와 같이 클리어 화면이 떴다.

클리어 화면

반응형
LIST