<?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 from prob_cobolt where id='{$_GET[id]}' and pw=md5('{$_GET[pw]}')"; echo "<hr>query : <strong>{$query}</strong><hr><br>"; $result = @mysqli_fetch_array(mysqli_query($db,$query)); if($result['id'] == 'admin') solve("cobolt"); elseif($result['id']) echo "<h2>Hello {$result['id']}<br>You are not admin :(</h2>"; highlight_file(__FILE__);
特徴は以下。
md5部分に適当に埋め込んでもいいが、id部分に埋め込んで面倒な部分は全部コメントで消してしまおう。
バックエンドではMySQLが動いているので、いらない部分は#
を使って全部消す。
union selectを使えば、任意の文字列を応答として返すことができる。
idに' union select 'admin' #
を入れてAC