웹 해킹/Webhacking.kr

[Webhacking.kr] old-14

L3m0n S0ju 2021. 9. 5. 11:32

 

 

문제에 접속하면 입력칸이 하나 있다. 코드는 아래와 같다.

 

 

 

 

<html><head>
<title>Challenge 14</title>
<style type="text/css">
body { background:black; color:white; font-size:10pt; }
</style>
</head>
<body>
<br><br>
<form name="pw"><input type="text" name="input_pwd"><input type="button" value="check" onclick="ck()"></form>
<script>
function ck(){
  var ul=document.URL;
  ul=ul.indexOf(".kr");
  ul=ul*30;
  if(ul==pw.input_pwd.value) { location.href="?"+ul*pw.input_pwd.value; }
  else { alert("Wrong"); }
}
</script>


</body><whale-quicksearch translate="no"></whale-quicksearch></html>

 

 


핵심 함수인 ck를 보면 url에서 .kr의 인덱스를 ul에 저장하는데 계산해보면 18이고 30일 곱하면 540. 540을 제곱하면 291,600이므로 https://webhacking.kr/challenge/js-1/?291600 을 주소창에 입력하면 문제를 해결할 수 있다.