[XSS Game] Write Up L3: That sinking Felling...

marceline·2024년 2월 2일
0

[XSS Game]

목록 보기
4/4

이제 L3 를 풀어보고자 한다.

Analyze


마찬가지로 해석부터 한다.

Mission Description

As you've seen in the previous level, some common JS functions are execution sinks which means that they will cause the browser to execute any scripts that appear in their input.

Sometimes this fact is hidden by higher-level APIs which use one of these functions under the hood.

이전 단계에서 봤듯, 일부 일반적인 JS 함수는 execution sink 이므로 입력에 나타나는 script 를 브라우저에서 실행하게 된다.

때때로, 이 사실은 후드 아래 이러한 함수를 사용하는 높은 수준의 API 들에 의해 숨겨진다.

The application on this level is using one such hidden sink.

이번 단계에서의 application 은 이러한 숨겨진 sink 중 하나를 사용하고 있다.

Mission Objective

As before, inject a script to pop up a JavaScript alert() in the app.

이전과 마찬가지로, script 를 삽입하여 App 에서 JS alert() 를 띄워라.

Since you can't enter your payload anywhere in the application, you will have to manually edit the address in the URL bar below.

Application 어디에도 Payload 에 접근할 수 없으므로 수동으로 아래 URL bar 에서 주소를 편집해야한다.

Your Target


사진과 같이 Image 1, 2, 3 이 있다.
URL 에서 #n 부분에 1, 2, 3 중 하나로 이미지 번호가 들어간다.

Test


이미지 번호 대신, 'test' 를 삽입하니 위와 같은 결과가 나왔다.
내가 입력한 'test' 가 img 태그의 src 속성 내에 포함되어 있다.
앞 뒤로 'cloud', '.jpg' 가 붙는것으로 보인다.

L2 와 마찬가지로 onerror 속성을 이용하여 문제를 풀면 될 것 같다.

Try

test"https://velog.velcdn.com/images/efforterjisulee/post/95216fde-984c-4335-9e45-0dcd6d675467/image.png">

alert() 함수의 종료가 부자연스럽게 ".jpg" 가 붙어서 나온다.

'Edit as HTML' 로 원본 코드를 보니 입력한 더블쿼터가 싱글쿼터로 변경된 것이 보인다.

이어서 'level3/cloud' 키워드로 소스코드를 검색하면 다음과 같은 코드를 발견할 수 있다.

img 태그의 src 속성값의 범위를 싱글쿼터로 지정하고 있었다.

Payload

Try 와 같은 공격구문에 더블쿼터를 싱글쿼터로 변경해서 공격하면 문제가 풀릴것으로 예상한다.

XSS Game' onerror='alert()

문제가 풀렸다.

Reference

권현준. 『누구나 쉽게 따라하며 배우는 웹 해킹 첫걸음』. 비제이퍼블릭, 2022.

0개의 댓글