<?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__);
?>
preg_match๋ฅผ ๋ณด๋ฉด ํํฐ๋ง ๋๊ณ ์๋ ๋ฌธ์๋ค์ด ์๋ค.
query์ id๋ถ๋ถ ์์ ๋ฐ์ดํ๋ฅผ ๋ซ๊ณ , ๋ค์ and pw๋ถ๋ถ์ ์ฃผ์์ฒ๋ฆฌํด๋ณด๋ฉด
ํ๋ฆฐ๋ค.
sql์ ์ฃผ์์ ์ฌ๋ฌ๊ฐ์ง ๋ฐฉ๋ฒ์ด ์๋๋ฐ
# | ;%00 | -- - | /* */ |
์ํฉ์ ๋ง๋ ๋ฐฉ์์ ํํ๋ฉด ๋๋ค.
'wargame ๐ดโโ ๏ธ write-up > Lord of SQLInjection' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
wolfman (0) | 2022.04.02 |
---|---|
orc (0) | 2022.04.02 |
goblin (0) | 2022.04.02 |
cobolt (0) | 2022.04.02 |