입력창 하나와 소스보기
<?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>
소스를 보면 id를 처음부터 5글자까지 짤라 echo명령어 삽입하는 모습을 볼수있다.
길이 조작은 할수 없을거같고 5글자안으로만 입력해야 할거같다.
간단히 봤을때는 '으로 echo문을 끊어주고 &를 통해 명령어를 추가해주면 될것으로 보인다.
짧은 명령어는 ls밖에 생각나지않아 '&ls 로 만들어 줬더니 아무런 반응이없다. 필터링 되는것인지...
'&ls' 왜됬는지 모르겟다... 파일 목록이 나온다.
flag_29cbb98dafb4e471117fec409148e9386753569e index.php 이런식으로
앞의 파일로 접근해보자.
플래그값이 들어가 있고 auth창에 입력해주면 성공
리눅스창에서 여러가지 시험해본 결과 위 ' '사이에 문자를 넣어도 해당 문자로 인식하는것을 볼수 있다.
ex)'l's 'ls' l's' e'ch'o 등 모두 가능하다.
'보안 > webhacking' 카테고리의 다른 글
webhacking.kr old-46 (0) | 2019.12.06 |
---|---|
webhacking.kr old-45 (0) | 2019.12.06 |
webhacking.kr old-43 (0) | 2019.12.05 |
webhacking.kr old-42 (0) | 2019.12.05 |
webhacking.kr old-41 (0) | 2019.12.05 |
최근댓글