1. Code
<?php
include "./config.php";
login_chk();
$db = dbconnect();
if(strlen($_GET[shit])>1) exit("No Hack ~_~");
if(preg_match('/ |\n|\r|\t/i', $_GET[shit])) exit("HeHe");
$query = "select 1234 from{$_GET[shit]}prob_giant where 1";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysqli_fetch_array(mysqli_query($db,$query));
if($result[1234]) solve("giant");
highlight_file(__FILE__);
?>
2. Condition
- GET ํ๋ผ๋ฏธํฐ shit์ ๋ฐ์์จ๋ค.
- ๊ณต๋ฐฑ(%20), ๊ฐํ(%0a), ์บ๋ฆฌ์ง ๋ฆฌํด(%0d), ํญ(%09)์ ํํฐ๋ง ํ๋ค.
3. Solution
$query = "select 1234 from{$_GET[shit]}prob_giant where 1";
๊ฐ๋จํ shit์ ๊ณต๋ฐฑ์ ๋ฃ์ด์ฃผ๋ฉด ํ๋ฆฌ๋ ๋ฌธ์ ์ด๋ค.
img_1์ 0x0b๋ฅผ ๋ณด๋ฉด, vertical tab ์ด๋ผ ์ ํ์๋ค.
vertical tab(\v)์ด๋, ํ๋ฆฐํธ์ ์ฌ์ฉ๋๋ Tab์ ํ ์ข ๋ฅ์ด๋ค. ์์๋ ์ ์ฌ์ฉํ์ง ์๋๋ค.
์คํํด๋ณด๋ฉด ๋ค์๊ณผ ๊ฐ์ด Tab์ด ์ด๋ฃจ์ด ์ง๋ค.
๊ฒฐ๊ณผ์ ์ผ๋ก %0b๋ฅผ ์ ๋ ฅํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋๋ค.
๋ณ์๋ช | ๊ฐ |
shit | %0b |
'wargame ๐ดโโ ๏ธ write-up > Lord of SQLInjection' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
succubus (0) | 2023.08.01 |
---|---|
assasin (0) | 2023.08.01 |
bugbear (0) | 2023.07.30 |
darkknight (0) | 2022.04.02 |