NGA

TECH SUPPORT

Try chatting with tech support about getting a flag. Note: We have received multiple reports of exploits not working remotely, but we triple checked and concluded that the bot is working properly.

 

https://typeselfsub.web.ctfcompetition.com/

 

회원가입과 로그인을 통해 Me, Flag, Chat 서비스를 사용할 수 있다.
Flag 페이지는 chat user만 접근 가능하며 Flag를 얻기 위해 chat user의 권한을 탈취해야 한다.

 

자신만이 볼 수 있는 /me 페이지는 사용자의 Address 값을 수정할 수 있으며 XSS가 발생하게 된다.

<!-- Page: https://typeselfsub.web.ctfcompetition.com/me -->

      <div class="container">
        <h1>Profile</h1>
        <p>Username: nga123</p>
        <p>Address: <h1>XSS</h1></p>
      </div>
        <div class="container">
          <h2>Update Address</h2>
          <form class="form" action="/me" method="POST">
            <label for="address">Address</label>
            <input class="form-control" autofocus type="text" id="address" name="address">
            <input type="hidden" name="csrf" value="">
            <input class="mt-3 btn btn-primary btn-block" type="submit" value="Submit">
          </form>
        </div>

 

Chat 페이지에선 Reason 값을 통해 Chating을 시작하며 https://typeselfsub-support.web.ctfcompetition.com/static/chat.html 주소의 iframe에 postMessage를 통해 Reason값을 전달한다.

<!-- Page: https://typeselfsub.web.ctfcompetition.com/chat -->

        <div class="container">
        <h2>World class tech support</h2>
        <p>Need some help? Use our world class chat system to talk with someone
        from our tech support team</p>
        <form class="form" action="javascript:initiateChat()">
          <label for="reason" >Reason</label>
          <textarea class="form-control" id="reason" name="reason" placeholder="Briefly describe your reason for wanting to chat"></textarea>
            <input type="hidden" name="csrf" id="csrf" value="65077b1d-8c04-46ed-9801-3ff58479a224">
            <input type="hidden" name="recapcha" id="recaptchaInput" value="">
            <div class="g-recaptcha" data-callback="recaptchaCallback" data-sitekey="6Lddmr0ZAAAAAMuSYD8kzoFbCuZeSdcvwgrXs-uV"></div>
            <input class="mt-3 btn btn-primary btn-block" type="submit" value="Submit">
        </form>
        
 ...생략...

       <iframe id="chatWindow" src="//typeselfsub-support.web.ctfcompetition.com/static/chat.html" style="display:none"></iframe>

 

https://typeselfsub-support.web.ctfcompetition.com/static/chat.html의 source를 보게 되면 chat.js가 존재하고 Reason 값을 받아 HTML로 출력하게 된다.

// Page: https://typeselfsub-support.web.ctfcompetition.com/static/chat.js

function handleMessage(ev) {
  if(ev.data.reason) {
    log(ev.data.reason)
    getResponse(ev.data.reason)
  }
  if(ev.data.msg){
    getResponse(ev.data.msg)
    top.postMessage({msg:ev.data.msg},'*')
  }
}

function log(html) {
  document.body.innerHTML += html
}

 

Reason값에 <img src="hacker.com"> 과 같이 보내면 chat 사용자의 요청이 오는 걸 확인할 수 있다.

chat 사용자의 Address값을 CSRF로 변경해 typeselfsub 도메인에서 XSS를 발생시키려 했지만 되지 않았다.

document.referrer를 받아오니 chat의 id, pw를 획득해 로그인하였고 chat 사용자만 Address 값이 변경될 수 없게 되어있었다.

 

CTF{self-xss?-that-isn't-a-problem-right...}

'CTF > 2020 Google CTF' 카테고리의 다른 글

2020 Google CTF Web ALL THE LITTLE THINGS 298pt  (0) 2020.08.26
2020 Google CTF Web LOG-ME-IN 87pt  (0) 2020.08.25
2020 Google CTF Web Pasteurize 50pt  (0) 2020.08.25

이 글을 공유합시다

facebook twitter googleplus kakaoTalk kakaostory naver band