본문 바로가기
정보 보안 해킹 공부/모의해킹

[Wargames]missions/basic/10

by 박나무 2022. 1. 9.
반응형

This time Sam used a more temporary and "hidden" approach to authenticating users, but he didn't think about whether or not those users knew their way around javascript...

Basic 10

 

이번에 샘은 사용자 인증을 위해 더 일시적이고 "숨겨진" 접근 방식을 사용했지만, 그 사용자들이 자바스크립트에 대한 방법을 알고 있는지에 대해서는 생각하지 않았다.

 

HackThisSite

HackThisSite.org is a free, safe and legal training ground for hackers to test and expand their ethical hacking skills with challenges, CTFs, and more.

www.hackthissite.org

 

Enter password
Please enter a password to gain access to level 10

 

암호를 입력하세요?

응? 끝인가 ㅋㅋ

 

일단 소스를 보자.

"숨겨진" 이 힌트인거 같은데.

자바스크립트 접근 히든 등등 검색해보니 쿠키 관련 글이 있어서 개발자도구 콘솔에 document.cookie  입력해보니 

'level10_authorized=no; style_cookie=null; HackThisSite=nhk0i4s45fhkffet8csmnemd44'

이런 문구가 뜬다 . 뭔소린지 모르겠으나 찾아보자... 구글링...

alert(document.cookie); 도 쓰는 거 같아서 팝업되게 해봤으나 똑같은 문구가 팝업될 뿐...

 

document.cookie = "user=John"; // 이름이 'user'인 쿠키의 값만 갱신함

alert(document.cookie); // 모든 쿠키 보여주기

출처: https://ko.javascript.info/cookie

쿠키 쓰는 법도 찾았다.

 

유저가 존으로 등록되었단다. ㅋㅋㅋ

document.cookie = "user=John; domain=https://www.hackthissite.org/missions/basic/10/index.php";

이렇게 하면 될줄 알았으나 역시 안됨;...ㅠㅠ

 

다시 document.cookie를 입력했더니 'level10_authorized=no; user=John; domain=https://www.hackthissite.org/missions/basic/10/index.php; style_cookie=null; HackThisSite=nhk0i4s45fhkffet8csmnemd44'  이러한 문구가 떳다??? 아까랑 다른데????

내가 콘솔에 눌렀던 것들이 추가되서 그런것 같다.

 

헉!!!!!    authorized=no  영어를 모르는 나는 즉시 파파고에게 도움을 요청하니....

승인됨=아니오 라고 나온다!?   이거 혹시 yes 로 바꿔야하나?

 

두근 두근한 마음으로 document.cookie = "authorized=yes"; 입력해본다.

'authorized=yes'  이렇게 떳다!?

 

새로고침을 눌렀으나 바뀐게 없다...document.cookie 를 다시 쳐보니 authorized=no 라고 뜬다!?  느낌이 온다...

저걸 yes 로 바꾸는 걸 찾아보자!

 

javascript  authorized yes 구글에 검색했는데,

출처: https://canonflashmemoryer.blogspot.com/2021/08/32-javascript-alert-document-cookie.html

이게 떴다....

 

아무래도 문제의 답을 누가 올려논거 같은데; 답을 봐버렸다.

 

javascript:void(document.cookie="level10_authorized=yes");alert(document.cookie);

 

콘솔에 입력해보니 팝업이 뜨고, document.cookie 로 확인해보니

authorized=yes; 로 변했다.

 

새로고침하니. 성공.

 

내가 썻던 코드랑 다르긴 했지만 얼추 no 를 yes 바꿔준다까지는 접근했으니 찜찜하지만 하긴 했다;javascript:void(document.cookie="level10_authorized=yes");

반응형

댓글