마지막 문제이다.
#뒷부분에 /static/gadget.js << 경로를 볼 수 있다.
<!doctype html>
<html>
<head>
<!-- Internal game scripts/styles, mostly boring stuff -->
<script src="/static/game-frame.js"></script>
<link rel="stylesheet" href="/static/game-frame-styles.css" />
<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>
</head>
<body id="level6">
<img src="/static/logos/level6.png">
<img id="cube" src="/static/level6_cube.png">
<div id="log">Loading gadget...</div>
</body>
</html>
- 1. 위치 조각의 값 (이후 #)이로드 된 스크립트의 URL에 어떤 영향을 미치는지 확인합니다.
- 2. 가젯 URL에 대한 보안 검사가 정말 안전합니까?
- 3. 가끔 답답할 때 비명을 지르는 느낌이들 때가 있습니다 .
- 4. 자신의 사악한 JS 파일을 쉽게 호스팅 할 수 없다면 google.com/jsapi?callback=foo가 여기에서 도움이되는지 확인하십시오.
힌트를 보면 js파일을 직접 서버에 올릴수 없고 그 경로를 입력할수 없다면 google.com/jsapi?callback=foo을 이용하라고 나와있다.
data url scheme 를 써서 풀어보자.
developer.mozilla.org/ko/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
Data URIs - HTTP | MDN
Data URIs, 즉 data: 스킴이 접두어로 붙은 URL은 컨텐츠 작성자가 작은 파일을 문서 내에 인라인으로 임베드할 수 있도록 해줍니다. Data URIs는 네 가지 파트로 구성됩니다: 접두사(data:), 데이터의
developer.mozilla.org
끄~읏
'Write-Up > XSS-game' 카테고리의 다른 글
[XSS game] xss-game level 5 (0) | 2021.01.26 |
---|---|
[XSS game] xss-game level 4 (0) | 2021.01.26 |
[XSS game] xss-game level 3 (0) | 2021.01.26 |
[XSS game] xss-game level 2 (0) | 2021.01.26 |
[XSS game] xss-game level 1 (0) | 2021.01.26 |