Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- hackerrank
- 풀이
- 자료구조 복습
- 숙명여자대학교 정보보안동아리
- 숙명여자대학교 정보보안 동아리
- Javascript
- C언어
- c
- c++
- BOJ
- The Loard of BOF
- 머신러닝
- hackctf
- Sookmyung Information Security Study
- Python
- 생활코딩
- BOJ Python
- HTML
- WarGame
- 파이썬
- SWEA
- 웹페이지 만들기
- PHP 웹페이지 만들기
- lob
- siss
- 드림핵
- 기계학습
- 백준
- CSS
- XSS Game
Archives
- Today
- Total
혜랑's STORY
XSS game - Level 06 본문

다른 문제들과 다르게 입력창이 따로 없고 # 뒤에 입력하는 값을 출력하고 있는 것 같다.
# 뒤에 1234를 넣어 확인해보자

화면에 1234가 출력되고 있는 것을 볼 수 있다. 소스코드를 확인해 보자.
<script>
function setInnerText(element, value) {
if (element.innerText) {
element.innerText = value;
} else {
element.textContent = value;
}
}
function includeGadget(url) {
var scriptEl = document.createElement('script');
// This will totally prevent us from loading evil URLs!
if (url.match(/^https?:\/\//)) {
setInnerText(document.getElementById("log"),
"Sorry, cannot load a URL containing \"http\".");
return;
}
// Load this awesome gadget
scriptEl.src = url;
// Show log messages
scriptEl.onload = function() {
setInnerText(document.getElementById("log"),
"Loaded gadget from " + url);
}
scriptEl.onerror = function() {
setInnerText(document.getElementById("log"),
"Couldn't load gadget from " + url);
}
document.head.appendChild(scriptEl);
}
// Take the value after # and use it as the gadget filename.
function getGadgetName() {
return window.location.hash.substr(1) || "/static/gadget.js";
}
includeGadget(getGadgetName());
// Extra code so that we can communicate with the parent page
window.addEventListener("message", function(event){
if (event.source == parent) {
includeGadget(getGadgetName());
}
}, false);
</script>
소스 코드를 살펴보니 URL에서 # 뒤의 값을 가져와 url 변수에 저장하고, url 변수에서 'https://'와 같은 형태가 있을 경우 "Sorry, cannot load a URL containing" 문구를 출력하고 아닐경우 해당 url에 있는 코드를 자바스크립트로 실행하는 것 같다.
힌트를 살펴보자.

"google.com/jsapi?callback=foo"에서 callback의 값으로 alert을 전달해주면 될 것같다.
그러나 'https://'와 같은 형태는 검사를 하고 있기 때문에 'Https://'와 같이 대문자로 바꾸어 검사를 피해갔다.
Https://www.google.com/jsapi?callback=alert
을 #뒤에 대입해보자.

성공이다.
이렇게 6문제를 모두 풀어보았다.

- 끝 -
'2021 SISS 21기 활동 > 겨울방학 XSS' 카테고리의 다른 글
XSS Game - Level 05 (0) | 2021.02.10 |
---|---|
XSS Game - Level 04 (0) | 2021.02.01 |
XSS Game - Level 03 (0) | 2021.01.25 |
XSS Game - Level 02 (0) | 2021.01.21 |
XSS Game - Level 01 (0) | 2021.01.14 |