[Level 02] Lord of SQL injection – cobolt

Lord of SQL injection – cobolt Level 02 Source Code <?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 ~_~”); $query = “select id from prob_cobolt where id='{$_GET[id]}’ and pw=md5(‘{$_GET[pw]}’)”; echo “<hr>query : <strong>{$query}</strong><hr><br>”; $result = @mysql_fetch_array(mysql_query($query)); if($result[‘id’] == ‘admin’) solve(“cobolt”); elseif($result[‘id’]) echo “<h2>Hello {$result[‘id’]}<br>You are not admin :(</h2>”; highlight_file(__FILE__); …

[Level 01] Lord of SQL injection – gremlin

들어가기 전에 $_GET을 이용한 파라미터 전달 방법에 대한 글을 보고 오자. Lord of SQL injection – gremlin Level 01 Source Code   <?php include “../config.php”; login_chk(); dbconnect(); if(preg_match(‘/prob|_|\.|\(\)/i’, $_GET[id])) exit(“No Hack ~_~”); // do not try to attack another table, database! if(preg_match(‘/prob|_|\.|\(\)/i’, $_GET[pw])) exit(“No Hack ~_~”); $query = “select id from prob_gremlin where id='{$_GET[id]}’ and …