[XSS game] xss-game level 6

2021. 1. 26. 04:12·Write-Up/XSS-game
반응형

마지막 문제이다.

#뒷부분에 /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
'Write-Up/XSS-game' 카테고리의 다른 글
  • [XSS game] xss-game level 5
  • [XSS game] xss-game level 4
  • [XSS game] xss-game level 3
  • [XSS game] xss-game level 2
Penguin Dev
Penguin Dev
What does the Penguin say?
    글쓰기 관리
  • Penguin Dev
    Pengha!
    Penguin Dev
  • 전체
    오늘
    어제
    • 분류 전체보기 (152)
      • Java & Spring (5)
      • System Hacking (4)
      • Algorithm (8)
        • Sorting algorithm (3)
      • Python (6)
      • Web (2)
        • Web Hacking & Security (2)
      • Write-Up (108)
        • pwnable.kr (17)
        • HackCTF (16)
        • 해커스쿨 FTZ (21)
        • LOB(lord of bufferoverflow) (19)
        • LOS (lord of sql injection) (28)
        • XSS-game (6)
        • Webhacking.kr (1)
      • SUA (19)
        • 오픈소스 보안 (19)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    ConcurrentHashMap
    DB정리
    computeifpresent
    CountDownLatch
    sqlinjection
    쿠폰발급
    동시성
    Lock
    putval()
    spring
    코드트리
    concurrenthashmap vs hashmap
    동시성처리
    thread-safe
    spring boot
    AQS
    Java
    ReentrantLock
    nop sled
    computeifabsent()
    SpringBoot
    코드트리조별과제
    hashmap vs concurrenthashmap
    computeifabsent
    tabat
    LOB
    lord of bufferoverflow
    computeifpresent()
    reentrantlock실습
    enumerate #list comprehension
  • 최근 댓글

  • 반응형
  • hELLO· Designed By정상우.v4.10.3
Penguin Dev
[XSS game] xss-game level 6
상단으로

티스토리툴바