<?php
include "./config.php";
login_chk();
$db = dbconnect();
if(preg_match('/prob|_|\.|\(\)/i', $_GET[no])) exit("No Hack ~_~");
if(preg_match('/\'|\"|\`/i', $_GET[no])) exit("No Quotes ~_~");
$query = "select id from prob_goblin where id='guest' and no={$_GET[no]}";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysqli_fetch_array(mysqli_query($db,$query));
if($result['id']) echo "<h2>Hello {$result[id]}</h2>";
if($result['id'] == 'admin') solve("goblin");
highlight_file(__FILE__);
?>
no ๊ฐ์ ์ฌ๋ฌ ์ซ์๋ฅผ ๋ฃ์ด๋ดค๋๋ guest : 1 ์์ด ํ์ธ๋ฌ๋ค.
no ๊ฐ์ ์๋ฌด๋ฐ ๋ฐ์ดํ๊ฐ ์์ผ๋ฏ๋ก, ํธํ๊ฒ ๋ท ๋ฌธ์ฅ์ ๋ง๋ค์ด๊ฐ ์ ์๋ค.
*์ฐธ๊ณ ๋ก and๋ก ๋ฌถ์ธ ์กฐ๊ฑด์ด ๊ฑฐ์ง์ด ๋์ด์ผ ํ๋ 1์ด ์๋ ์๋ฌด ์ซ์๋ฅผ ๋ฃ๊ณ ๋ง๋ค์ด๊ฐ์
ํ์ง๋ง ์์ ๋ฐ์ดํ๋ฅผ ํํฐ๋ง ํ๊ณ ์์ด, id='admin'๊ณผ ๊ฐ์ ๊ฐ์ ๋ณด๋ด์ง ๋ชปํ๋ค.
๊ทธ๋ ๋ค๋ฉด ๋ ๊ฐ๋จํ ๋ฐฉ๋ฒ. no๋ฅผ ์ด์ฉํด๋ณด์
?no=2 or no=2
'wargame ๐ดโโ ๏ธ write-up > Lord of SQLInjection' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
wolfman (0) | 2022.04.02 |
---|---|
orc (0) | 2022.04.02 |
cobolt (0) | 2022.04.02 |
gremlin (0) | 2022.04.02 |