문제화면이다 view-source를 눌러 소스 코드를 확인해 보자.
<?php
include "../../config.php";
if($_GET['view_source']) view_source();
?><html>
<head>
<title>Challenge 11</title>
<style type="text/css">
body { background:black; color:white; font-size:10pt; }
</style>
</head>
<body>
<center>
<br><br>
<?php
$pat="/[1-3][a-f]{5}_.*$_SERVER[REMOTE_ADDR].*\tp\ta\ts\ts/";
if(preg_match($pat,$_GET['val'])){
solve(11);
}
else echo("<h2>Wrong</h2>");
echo("<br><br>");
?>
<a href=./?view_source=1>view-source</a>
</center>
</body>
</html>
코드를 보면 정규표현식 관련 문제인 거 같다.
$pat에 자신의 ip를 포함한 정규표현식이 저장된다.
그걸 val이라는 변수가 받고 pat과 비교하면서 문제가 풀리는 거 같다.
정규표현식을 해석하면
[1-3] = 1~3 아무 숫자 선택
[a-f]{5} = 소문자 a~f까지의 문자를 5개 연속으로 선택
_ : 문자
.* : 문자열
$_SERVER [REMOTE_ADDR] : 자신의 IP
\t : Tab
p, a, s : 문자
대입해 보자.
Tab 이 %09라는 것은 URL De, Encode 할 때 많이 풀었을 것이다.
URL Decode and Encode - Online
Decode from URL-encoded format or encode into it with various advanced options. Our site has an easy to use online tool to convert your data.
www.urldecoder.org
혹시 모르겠는 사람은 '%09'를 대입해 보고 DECODE를 눌러보자.
'Wargame > Webhacking.kr' 카테고리의 다른 글
webhacking.kr - old 58 (0) | 2024.03.21 |
---|---|
webhacking.kr - old 32 (0) | 2024.03.21 |
webhacking.kr - old 20 (0) | 2024.03.20 |
webhacking.kr - old 12 (Javascript Obfuscation) (0) | 2024.03.20 |
webhacking.kr - old 05 (0) | 2024.03.15 |