저장소
[webhacking.kr] 3번 풀이 본문
Webhacking.kr
Index Welcome Stranger! Chatting Notice(en) [2021-04-16] Score of old challenges has been adjusted to 1/10. For a while now, new challenges will be added "without" notice. [2020-08-12] Replace chat feature with Discord. Please do not cause inconvenience to
webhacking.kr

3번 문제를 확인하면 나오는 화면이다.

특정 영역을 클릭하면 까맣게 바뀐다.

solved를 누르면 정답이 아닌 경우 No! 라는 메시지가 출력되고 잠시 후 퍼즐 화면으로 다시 돌아간다.
아직 알 수 있는 것이 없어 크롬 기준 단축키 Ctrl+Shift+I로 페이지의 소스코드를 먼저 확인했다.
index.php의 소스코드는 아래와 같았다.
/* index.php */
<html>
<head>
<title>Challenge 3</title>
</head>
<body>
<center>Nonogram</center>
<p>
<hr>
<form name=kk method=get action=index.php>
<table border=3 width=500 height=500 align=center bgcolor=white>
<tr align=center>
<td colspan=3 rowspan=3 bgcolor=white></td>
<td> </td>
<td> </td>
<td>1</td>
<td> </td>
<td> </td>
</tr>
<tr align=center>
<td>1</td>
<td> </td>
<td>1</td>
<td> </td>
<td>1</td>
</tr>
<tr align=center>
<td>1</td>
<td>3</td>
<td>1</td>
<td>3</td>
<td>1</td>
</tr>
<tr align=center>
<td>1</td>
<td>1</td>
<td>1</td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._1.value=1; } else { this.style.background='white';kk._1.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._2.value=1; } else { this.style.background='white';kk._2.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._3.value=1; } else { this.style.background='white';kk._3.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._4.value=1; } else { this.style.background='white';kk._4.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._5.value=1; } else { this.style.background='white';kk._5.value=0; }" > </td>
</tr>
<tr align=center>
<td> </td>
<td> </td>
<td>0</td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._6.value=1; } else { this.style.background='white';kk._6.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._7.value=1; } else { this.style.background='white';kk._7.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._8.value=1; } else { this.style.background='white';kk._8.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._9.value=1; } else { this.style.background='white';kk._9.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._10.value=1; } else { this.style.background='white';kk._10.value=0; }" > </td>
</tr>
<tr align=center>
<td> </td>
<td> </td>
<td>3</td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._11.value=1; } else { this.style.background='white';kk._11.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._12.value=1; } else { this.style.background='white';kk._12.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._13.value=1; } else { this.style.background='white';kk._13.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._14.value=1; } else { this.style.background='white';kk._14.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._15.value=1; } else { this.style.background='white';kk._15.value=0; }" > </td>
</tr>
<tr align=center>
<td> </td>
<td>1</td>
<td>1</td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._16.value=1; } else { this.style.background='white';kk._16.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._17.value=1; } else { this.style.background='white';kk._17.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._18.value=1; } else { this.style.background='white';kk._18.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._19.value=1; } else { this.style.background='white';kk._19.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._20.value=1; } else { this.style.background='white';kk._20.value=0; }" > </td>
</tr>
<tr align=center>
<td> </td>
<td> </td>
<td>5</td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._21.value=1; } else { this.style.background='white';kk._21.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._22.value=1; } else { this.style.background='white';kk._22.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._23.value=1; } else { this.style.background='white';kk._23.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._24.value=1; } else { this.style.background='white';kk._24.value=0; }" > </td>
<td onclick="if(this.style.background!='black') { this.style.background='black'; kk._25.value=1; } else { this.style.background='white';kk._25.value=0; }" > </td>
</tr>
</table>
<input name=_1 size=2 value=0 type=hidden>
<input name=_2 size=2 value=0 type=hidden>
<input name=_3 size=2 value=0 type=hidden>
<input name=_4 size=2 value=0 type=hidden>
<input name=_5 size=2 value=0 type=hidden>
<input name=_6 size=2 value=0 type=hidden>
<input name=_7 size=2 value=0 type=hidden>
<input name=_8 size=2 value=0 type=hidden>
<input name=_9 size=2 value=0 type=hidden>
<input name=_10 size=2 value=0 type=hidden>
<input name=_11 size=2 value=0 type=hidden>
<input name=_12 size=2 value=0 type=hidden>
<input name=_13 size=2 value=0 type=hidden>
<input name=_14 size=2 value=0 type=hidden>
<input name=_15 size=2 value=0 type=hidden>
<input name=_16 size=2 value=0 type=hidden>
<input name=_17 size=2 value=0 type=hidden>
<input name=_18 size=2 value=0 type=hidden>
<input name=_19 size=2 value=0 type=hidden>
<input name=_20 size=2 value=0 type=hidden>
<input name=_21 size=2 value=0 type=hidden>
<input name=_22 size=2 value=0 type=hidden>
<input name=_23 size=2 value=0 type=hidden>
<input name=_24 size=2 value=0 type=hidden>
<input name=_25 size=2 value=0 type=hidden>
<input name=_answer type=hidden>
<center><input type=button value='solved' onclick=go()></center>
<script>
function go(){
var answer="";
for(i=1;i<=25;i++) { answer=answer+eval("kk._"+i+".value"); }
kk._answer.value=answer;
kk.submit();
}
</script>
</body>
</html>
소스코드를 확인하면서 블럭을 클릭하니 블럭의 색이 채워지면서 해당 블록의 번호와 일치하는 input의 value 값이 0에서 1로 바뀐다.
?1=0&_2=0&_3=0&_4=0&_5=0&_6=0&_7=0&_8=0&_9=0&_10=0&_11=0&_12=0&_13=0&_14=0&_15=0&_16=0&_17=0&_18=0&_19=0&_20=0&_21=0&_22=0&_23=0&_24=0&_25=0&_answer=0000000000000000000000000
또한, 아무 블록도 클릭하지 않고 solved로 제출하고 URL을 확인하니 위와 같이 값이 전달됨을 알 수 있었다.
퍼즐을 풀어야 본격적으로 문제를 해결할 수 있을 것 같다.
검색 결과 Nonogram은 실제로 존재하는 게임이었다.
https://ko.wikipedia.org/wiki/%EB%85%B8%EB%85%B8%EA%B7%B8%EB%9E%A8
노노그램 - 위키백과, 우리 모두의 백과사전
노노그램(영어: Nonogram, 일본어: お絵かきロジック 오에가키로짓쿠[*])은 일본의 퍼즐 게임이다.[1] 각각 적혀있는 숫자를 보면서 숨겨져 있는 숫자를 예상하여 지워나가면서 그림을 그리는 게임
ko.wikipedia.org
복잡해보이지만 차근차근 풀어보면 아래와 같이 정답이 나온다.

solved로 제출하면 클리어 메시지와 함께 이름을 입력하라고 나온다.
<html><head>
<title>Challenge 3</title>
</head>
<body class="vsc-initialized">
<center>Nonogram</center>
<p> </p>
<hr>
<form name="kk" method="get" action="index.php"></form>
<form method="post" action="index.php">
<input type="hidden" name="answer" value="1010100000011100101011111">
"Clear!"
<br>
"enter your name for log : "
<input type="text" name="id" maxlength="10" size="10">
<input type="submit" value="submit">
</form>
</body>
</html>
해당 페이지의 소스코드다.

닉네임을 입력하면 위와 같이 name+answer+ip가 저장된 화면이 출력된다.
3번이 SQL 문제였던 것을 고려하여 input으로 값 입력이 가능한 name을 활용해 SQL Injection을 시도해기로 했다.

아무런 반응이 없었다...
그렇다면 다른 input을 활용해보기로 했다.

소스코드를 확인해보면 answer의 input type이 hidden으로 설정되어있다.
show로 바꾸어주고 SQL Injection을 시도해보았다. (혹은 Edit as HTML을 활용하여 변경할 수 있다.)

solve 되었다는 팝업창이 뜨지 않아서 정확하게는 알 수 없지만, 몇 번 시도해보니 answer 뒤에 ' || 1=1-- 를 붙여 제출하는 것이 정답임을 추측할 수 있었다.
'IT > 웹 해킹' 카테고리의 다른 글
[webhacking.kr] 39번 풀이 (0) | 2021.08.23 |
---|---|
[webhacking.kr] 35번 풀이 (0) | 2021.08.20 |
[webhacking.kr] 54번 풀이 (0) | 2021.08.13 |
[webhacking.kr] 34번 풀이 (0) | 2021.08.12 |
[webhacking.kr] 17번 풀이 (0) | 2021.08.09 |