webhacking/client

hackthis javascript 1~5

qkqhxla1 2015. 2. 12. 18:56

level 1.

아무거나 입력하면 incorrect라고 나오는데 이걸 이용해서 자바스크립트 위치를 찾아보자. 

<script type='text/javascript'> $(function(){ $('.level-form').submit(function(e){ e.preventDefault(); if(document.getElementById('pass').value == correct) { document.location = '?pass=' + correct; } else { alert('Incorrect password') } })})</script> 

라는걸 찾긴 찾았는데 correct라는게 안보인다. 찾아보자. 맨 아래에

<script type='text/javascript'> var correct = 'jrules' </script> 라고 있다.



level 2.

level 1과 똑같은데 length를 찾아보면.

            <script type='text/javascript'>

                var length = 5;

                var x = 3;

                var y = 2;

                y = Math.sin(118.13);

                y = -y;

                x = Math.ceil(y);

                y++;

                y = y+x+x;

                y *= (y/2);

                y++;

                y++;

                length = Math.floor(y);

            </script>

라고 있다. 콘솔에서 돌려보면 9가 나오고 비밀번호 길이를 아무거나 9자리 입력해주면 통과한다.



levle 3.

조금 걸릴 뻔 했다. var thecode = 'code123'; 라고 바로 그냥 써있어서 입력했는데 나오질 않았다. 그럼 또 js파일을 만들어서 어딘가에 thecode변수를 변경해놓았다는 소리인데..... 나같은 경우 <script 라는 단어를 검색해서 js파일속으로 들어가 thecode라는 변수가 있는지 검사하는 방식으로

https://www.hackthis.co.uk/files/js/min/main.js?1420651748 에서 var thecode='getinthere'; 를 발견할수 있었는데, 외국인들의 풀이를 보니 javascript:alert(thecode)로 그냥 최종적으로 변경된 thecode변수를 출력했다... 좋은방법 알아감...



level 4.

아무런 힌트가 없다. url을 살펴보면 4?input인데 input에 input[]=처럼 에러를 발생시키려 해봐도 아무것도 안나온다. input을 지우고 실행해봤는데 계속 붙어서 출력된다. location.href로 이동하는것 같다. input은 지우고 그냥 4의 소스를 보았더니 div class='center'>The password is: smellthecheese</div>

라고 적혀있다..



level 5.

자바스크립트를 끄고 페이지 소스를 보았는데 password:라는 문자열은 없다. 우리가 본건 prompt므로 이걸 찾아보려고 또 <script라는 문자열을 검색 후 js소스파일들로 들어가서 prompt를 찾으니 

https://www.hackthis.co.uk/files/js/min/extra_48d468a93b.js?1420654201 여기 숨어있다. 대충 보니

끝부분의 

a=window.location.host+"";b=a.length;c=4+((5*10)*2);d=String.fromCharCode(c,-(41-Math.floor(1806/13)),Math.sqrt(b-2)*29,(b*8)-29);p=prompt("Password:","");if(p==d) 

가 주요 소스인것 같다. 개발자도구에 넣고 돌리자. window.location.host는 호스트 이름이니 

a="www.hackthis.co.uk";b=a.length;c=4+((5*10)*2);d=String.fromCharCode(c,-(41-Math.floor(1806/13)),Math.sqrt(b-2)*29,(b*8)-29);

요렇게 넣고 돌리면 hats가 나온다.

'webhacking > client' 카테고리의 다른 글

hackthis Intermediate 1~5, main  (0) 2015.03.19
webhacking.kr 34, packer  (0) 2015.03.13
happy-security.de javascript 1~7,9,10  (0) 2015.01.22
hack this site JavaScript 1~7  (0) 2015.01.20
TheBlackSheep Javascript 1~8  (0) 2015.01.12