728x90
소스코드는 다음과 같다.
<?php
include "../../config.php";
if($_GET['view_source']) view_source();
?><html>
<head>
<title>Chellenge 39</title>
</head>
<body>
<?php
$db = dbconnect();
if($_POST['id']){
$_POST['id'] = str_replace("\\","",$_POST['id']);
$_POST['id'] = str_replace("'","''",$_POST['id']);
$_POST['id'] = substr($_POST['id'],0,15);
$result = mysqli_fetch_array(mysqli_query($db,"select 1 from member where length(id)<14 and id='{$_POST['id']}"));
if($result[0] == 1){
solve(39);
}
}
?>
<form method=post action=index.php>
<input type=text name=id maxlength=15 size=30>
<input type=submit>
</form>
<a href=?view_source=1>view-source</a>
</body>
</html>
내 기준 풀이하기 정말 까다로웠던 문제.. mysql을 잘 몰라서 한참 헤맸다. 중요한건 mysql은 문자열 비교시 공백이 붙어도 그냥 같은 문자로 인식한다는 것..!
그리고 $result 부분을 잘 보면 id에 작은 따옴표가 하나 빠져있다.
id는 15문자에서 잘리기 때문에 admin ' 이렇게,,, 마지막에 '를 넣어주면 15문자로 잘린다
제일 쉬워보이는데 어려움 ㅠ
728x90
'CTF, 워게임 문제 풀이 > webhacking.kr' 카테고리의 다른 글
webhacking.kr 41번 문제 (0) | 2022.10.15 |
---|---|
webhacking 40번 문제 (미해결) (0) | 2022.10.14 |
webhacking 38번 문제 (0) | 2022.10.13 |
webhacking.kr 36번 문제 (0) | 2022.09.15 |
webhacking.kr 35번 문제 (0) | 2022.09.15 |
댓글