WriteUp/Webhacking.kr

Challenge 26 (100pt)

vared 2020. 5. 10. 11:52
<?php
  include "../../config.php";
  if($_GET['view_source']) view_source();
?><html>
<head>
<title>Challenge 26</title>
<style type="text/css">
body { background:black; color:white; font-size:10pt; }    
a { color:lightgreen; }
</style>
</head>
<body>
<?php
  if(preg_match("/admin/",$_GET['id'])) { echo"no!"; exit(); }
  $_GET['id'] = urldecode($_GET['id']);
  if($_GET['id'] == "admin"){
    solve(26);
  }
?>
<br><br>
<a href=?view_source=1>view-source</a>
</body>
</html>

Get['id'] 값이 admin이면 문제가 풀린다.

그대로 admin을 넣어주게 되면, if문의 preg_match에서 걸린다.

$_GET['id'] 를 urlencode 해준다. urlencode 해준 값이 admin이 되어야 하기 때문에

url encoding table

admin=%61%64%6d%69%6e 이다. 

이걸 한번 더 인코딩 해주기 때문에, %61%64%6d%69%6e를 변환해서 

?id=%2561%2564%256d%2569%256e 이렇게 넣어주면 된다.

 

clear!