WarGame/Web

[webhacking.kr 16번]

선문기 2016. 1. 8. 20:14

[필히 본인이 풀어보시고 정말 안되겠다면 다음의 풀이를 확인하시길 바랍니다.]




[그림 1] 16번 메인페이지


16번 문제의 메인페이지 접속히 별모양 도형이 존재한다. 처음 접할 시 고개를 갸우뚱할 수 있다.

하지만 우리에겐 소스를 볼수 있는 길이 있으니.ㅋㅋㅋㅋ 소스코드를 살펴보자.


<html>
<head>
<title>Challenge 16</title>
<body bgcolor=black onload=kk(1,1) onkeypress=mv(event.keyCode)>
<font color=silver id=c></font>
<font color=yellow size=100 style=position:relative id=star>*</font>
<script>
document.body.innerHTML+="<font color=yellow id=aa style=position:relative;left:0;top:0>*</font>";
function mv(cd)
{
kk(star.style.posLeft-50,star.style.posTop-50);
if(cd==100) star.style.posLeft=star.style.posLeft+50;
if(cd==97) star.style.posLeft=star.style.posLeft-50;
if(cd==119) star.style.posTop=star.style.posTop-50;
if(cd==115) star.style.posTop=star.style.posTop+50;
if(cd==124) location.href=String.fromCharCode(cd);
}
function kk(x,y)
{
rndc=Math.floor(Math.random()*9000000);
document.body.innerHTML+="<font color=#"+rndc+" id=aa style=position:relative;left:"+x+";top:"+y+" onmouseover=this.innerHTML=''>*</font>";
}
</script>
</body>
</html>

[표 1] 소스코드


애플리케이션에서 특정 키를 누르면 별모양이 찍히는 모듈이 존재한다.

잠깐 확인 해보자.ㅋㅋㅋ

[그림 2] onkeypress


그런데 특정 키 중에 '|'를 누르면 특정 페이지로 이동하는 소스코드가 존재한다.




[그림 3] 인증 코드 출력


 String.fromCharCode()함수는 특정 값을 유니코드로 출력해주는 함수이다. 유니코드 값이 곧 페이지명이며, URL을 확인해보면 인증코드를 출력하는 페이지명이 %7C임을 확인 할 수 있다.