write-up/XSS-game write-up

XSS game level 2 - Persistence is key

정보보호학과 새내기 2021. 7. 18. 17:57
반응형
SMALL

Mission Description

Web applications often keep user data in server-side and, increasingly, client-side databases and later display it to users. No matter where such user-controlled data comes from, it should be handled carefully.
--> 웹 애플리케이션은 종종 사용자 데이터를 서버 측, 그리고 점차 클라이언트 측 DB에 보관했다가 나중에 사용자에게 표시함. 이러한 사용자 제어 데이터의 출처에 관계없이 신중하게 처리해야함.


This level shows how easily XSS bugs can be introduced in complex apps.

--> 이 수준은 복잡한 앱에 XSS 버그가 얼마나 쉽게 도입될 수 있는지 보여줌.

Mission Objective

Inject a script to pop up an alert() in the context of the application.
--> 애플리케이션 내용에서 alert()를 팝업하는 스크립트를 주입해라.


Note: the application saves your posts so if you sneak in code to execute the alert, this level will be solved every time you reload it.

--> 응용 프로그램에서 게시물을 저장하므로 코드를 몰래 넣어 알림을 실행하면 됨

 

Hint

2. Entering a <script> tag on this level will not work. Try an element with a JavaScript attribute instead

--> 이번 단계에서는 script 태그를 넣는 것이 작동하지 않음. javascript의 특성을 가진 요소를 대신해서 이용해라

 

Solve

힌트를 보고 alert를 실행시킬 수 있는 script 태그를 필터링하는 것을 알 수 있다. 따라서 다른 태그를 이용하여 alert를 실행시켜보았다. 다른 태그 중 img 태그와 img를 불러올때 에러가 발생하면 실행되는 코드인 onerror를 사용해보았다.

 

<img src=0 onerror='alert("Hello")'>를 입력한다.

--> src=0이므로 불러오지 못하고 에러를 반환하니 alert()가 onerror를 통해 실행된다.

 

위 구문을 입력하니 아래 결과가 나온다.

클리어 화면

반응형
LIST