file-handling
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "file-handling" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-d877284a5dc1113534b02ee19b6055d6fa12fd99d6844661e4d9e4e14f91f006. Verify the upstream source and version against https://github.com/zhaji2333/CkSKILLS before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
For scenarios with file-related features such as file upload (avatars/attachments/IDs), download/export, import (Excel/CSV/XML), preview (PDF/Office), image/audio-video processing, archive unpacking/packing, online editors/terminals. Responsible for deep investigation of file-related security risks, including file upload exploited to gain shell, path traversal, arbitrary file read/delete, LFI/RFI, Zip Slip, CSV injection/formula injection, and attack vectors against processing chains like ImageMagick/FFmpeg.
Introduction source: third_party · zhaji2333 · 0.0.1 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: file-handling
description: 当目标存在文件上传(头像/附件/证件)、下载/导出、导入(Excel/CSV/XML)、预览(PDF/Office)、图片/音视频处理、压缩包解压打包、在线编辑器/终端等功能时调用。负责任意文件上传getshell、路径穿越、任意文件读取/删除、LFI/RFI、Zip Slip、CSV注入/公式注入、ImageMagick/FFmpeg攻击深度挖掘。file-handling — 文件与路径安全专项深度挖掘
何时调用(触发条件)
- 文件上传:头像/附件/证件/导入文件
- 文件下载/导出:报表、日志、备份
- 文件预览/处理:PDF/Office、图片裁剪缩放、音视频处理
- 压缩包处理:在线解压/打包
- 文件路径参数可控:filename、path、file、template
- 在线编辑器/IDE、终端/Shell 模拟、数据库查询工具
一、文件操作类场景表(全景)
| 场景 | 漏洞类型 | 挖掘要点 |
|---|---|---|
| 文件上传(头像/附件/证件) | 任意文件上传→getshell | 后缀绕过、MIME绕过、内容检测绕过、二次渲染绕过 |
| 文件下载/导出 | 任意文件读取/路径穿越 | ../遍历、绝对路径、编码绕过、符号链接 |
| 文件预览(PDF/Office) | SSRF/XXE/RCE | 远程URL加载、OLE对象、宏执行 |
| 文件导入(Excel/CSV/XML) | XXE/CSV注入/公式注入/反序列化 | =cmd、外部实体、恶意序列化数据 |
| 图片处理(裁剪/缩放/水印) | ImageMagick RCE/SSRF | MVG/SVG payload、url:协议 |
| 视频/音频处理 | FFmpeg SSRF/文件读取 | concat协议、file://、HLS playlist |
| 压缩包处理(解压/打包) | 路径穿越/Zip Slip/符号链接 | ../覆盖关键文件、软链接读取 |
| 日志下载/审计导出 | 敏感信息泄露/路径穿越 | 日志中含token/密码、文件名可控 |
二、漏洞类型全景
| 类型 | 场景 | 挖掘要点 |
|---|---|---|
| F1. 任意文件上传 | 头像、附件、导入 | 类型/扩展名/内容校验 |
| F2. 路径穿越 | 下载接口、模板加载 | ../规范化检查 |
| F3. 任意文件读取/删除 | 导出报表、缓存处理 | 路径白名单 |
| F4. 文件包含(LFI/RFI) | 动态include | php://filter等协议 |
三、文件上传绕过技术
扩展名:.php5/.phtml/.phar/.htaccess/.user.ini
双扩展:shell.php.jpg / shell.jpg.php
%00截断:shell.php%00.jpg
内容:GIF89a头、图片马
进阶绕过思路:
- MIME 类型伪造(Content-Type 改为 image/png)
- 内容检测绕过:图片马 + 二次渲染差异注入
- 解析差异:nginx 解析漏洞、Apache 多后缀、IIS 分号截断
- 上传点复用:头像路径 → 包含执行 / 路径可控覆盖
- .user.ini / .htaccess 覆盖
四、路径穿越与任意文件读写
测试向量:
../ 、 ..%2f 、 %252e%252e%252f 、 ..%c0%af
绝对路径:/etc/passwd、C:\Windows\win.ini
编码:Unicode(\u002e\u002e/)、十六进制、双重编码
符号链接:上传软链接指向敏感文件
验证目标:
- /etc/passwd、/etc/shadow(读权限)
- 应用配置文件(数据库密码、AK/SK)
- 源码文件(.py/.java/.php/.jar)
- 删除接口:任意文件删除 → 配合 getshell/持久化
五、文件处理引擎攻击
ImageMagick
- MVG/SVG payload、
url:协议(SSRF) - 已知 CVE:ImageTragick 系列
FFmpeg
concat协议、file://读取- HLS playlist 注入
Office/PDF 预览
- 宏执行、OLE 对象(RCE)
- 外部实体(XXE)
压缩包
- Zip Slip:解压路径穿越覆盖关键文件
- 符号链接:解压软链接读取任意文件
- Zip 炸弹:DoS
导入文件
- CSV 公式注入:
=cmd、+HYPERLINK - XML/Office:XXE
- 反序列化对象(.ser/.bin)
六、特殊功能类扩展
| 场景 | 漏洞类型 | 挖掘要点 |
|---|---|---|
| 在线解压/打包 | 路径穿越/DoS | Zip炸弹、符号链接攻击 |
| 在线编辑器/IDE | 任意文件读写/RCE | 文件路径可控、代码执行 |
| 终端/Shell模拟 | 命令注入/逃逸 | 命令过滤绕过、沙箱逃逸 |
| 数据库查询工具 | SQL注入/越权 | 查询语句可控、连接信息泄露 |
七、验证要点
- 上传:先验证文件落盘与访问路径,再测执行(解析到 Web 目录才可 getshell)
- 下载/导出:filename 参数可控性 → 穿越读取 → 影响面(配置文件/源码)
- 预览/处理:远程 URL 加载 → SSRF/XXE 链
- 解压:Zip Slip 覆盖文件(.htaccess/.user.ini/配置)
- 修复优先级:上传 getshell / 任意文件读取为 P0-P1
八、修复建议
- 上传:扩展名+内容白名单、存储与执行目录隔离、随机文件名
- 下载/读取:路径白名单+规范化校验(realpath 比对)
- 解压:拒绝 ../ 与符号链接、限制解压大小与文件数
- 处理引擎:升级补丁、禁用危险协议(url:/concat)
- 导入:禁止公式执行、禁用外部实体
Version history
-
v2.1.0
GitHub ↗
Original release notes
## 一句话 新增 **`kb/` 结构化数据层**(664 CVE / 237 字典 / 69 载荷)与 **内网/域技能包 `internal-network`**(10 块),`cloud-infra` 扩充 10 块;全局路由、纪律、索引同步接线,并修掉 7 个超限知识块与存量死链。 ## 新增 - **数据层 `kb/`**:`vuln/` 664 条 CVE(ai/cloud/middleware/network/web)、`dict/` 237 个字典(368 万行)、`payload/` 69 个载荷;4 个自动索引 + `tools/kb_index.py`(`--check` 做一致性闸,不参与默认加载) - **`internal-network`(内网/域)**:域侦察与决策树、Kerberos、委派/ACL/ADCS、凭据/中继/投毒、横向移动、隧道多跳、后渗透提权、持久化、内网基础设施(Exchange/SCCM/OA/DB/中间件)、工具投递 - **`kb-security-data`**:CVE / 字典 / payload 检索入口(30 秒分诊 + 证据纪律) - **`cloud-infra` +10 块**:多云概览、AWS IAM 提权、Azure/GCP、国内云、云凭据/IAM/元数据、K8s 逃逸与集群、K8s 组件/网络/存储、容器运行时、对象存储/Serverless、CI-CD/供应链/IaC - **战法索引-08-内网与域**(22 行首枪表)、`rules/55-kb-usage.md`、`templates/SEEDS.template.md` - **`docs/CHANGELOG.md`**:v2.1 完整更新记录 ## 变更 - `AGENTS.md`(10 秒决策 + 文件地图)、`rules/70`、`docs/TRIGGER-MATRIX.md`、`ck-router`(分诊/索引/进站决策)、`README.md`、`docs/ARCHITECTURE.md`(六层结构)全部接线 - 技能包 16 → **18**,知识块 **501**,规则 11 → **12** ## 修复 - 7 个超过 12KB 的知识块按「索引 + 分段」拆分(原文件名保留,新增 `-b` 分段) - 存量死链、kb 相对路径、索引兜底计数、CTF 导向表述清理 ## 验收 - 单块 ≤12KB:0 超限;SKILL.md 全部达标;死链 0 - `python3 tools/kb_index.py --check` → OK(664 / 237 / 69) - 常驻层 `AGENTS.md` 5.4KB(限 6.5KB) ## 升级方式 更新仓库后运行 `python3 tools/kb_index.py --check` 确认索引一致;用法见 `docs/CHANGELOG.md` 第 5 节与 `README.md`「数据层 kb/」小节。
Current listing version
0.0.1
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 覆盖文件上传、下载、预览、解压、导入等高频高危安全场景,具备明确实战价值
- 提供详尽绕过技术与验证要点,显著提升安全测试效率
Highlights
- 触发条件清晰列举具体功能点,边界明确,无歧义或重叠风险
Highlights
- 结构完整,分场景表、漏洞类型、绕过技术、验证要点、修复建议等章节,逻辑清晰
- 含端到端示例与测试向量,frontmatter 完整,符合规范
Highlights
- 工具来源明确,参数与 payload 正确,覆盖主要异常与边缘情况
- 不可逆操作有验证路径说明,修复建议具可操作性
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.