Php File Read Audit logo

Php File Read Audit

Community
0xShe
php-file-read-audit

PHP Web 源码任意文件读取/路径穿越审计工具。识别文件读取 Sink,追踪路径来源与校验逻辑,输出可利用性分级、PoC 与修复建议(禁止省略)。

Overview

Publisher0xShe
RepositoryPHP-Code-Audit-Skill
Skill namephp-file-read-audit
Stars
406
Forks
42
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by 0xShe on GitHub. Read the source before you install it.

Installation

Install the Php File Read Audit AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/0xShe/PHP-Code-Audit-Skill/tree/main/php-file-read-audit
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/0xShe/PHP-Code-Audit-Skill.git /tmp/PHP-Code-Audit-Skill
mkdir -p .claude/skills
cp -r /tmp/PHP-Code-Audit-Skill/php-file-read-audit .claude/skills/php-file-read-audit
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Php File Read Audit in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Php File Read Audit on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Php File Read Audit is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

PHP 任意文件读取审计(php-file-read-audit)

分析 PHP 项目源码,识别文件读取与包含执行风险:路径穿越导致任意文件读取、包含任意文件(include/require)导致信息泄露或代码执行(当包含的是可执行内容/或受流包装器影响)。

分级与编号

  • 详见:shared/SEVERITY_RATING.md
  • 漏洞编号:{C/H/M/L}-FILE-{序号}

FILE Sink(必做)

识别以下函数/语法:

  • 读取:file_get_contents/readfile/fopen/stream_get_contents/file/Storage::get
  • 包含:include/require/include_once/require_once(路径拼接风险尤其高危)
  • 压缩/归档:ZipArchive->open(若路径可控)
  • 流包装/过滤:php://filter、php://input(若被作为文件内容读取/包含) 危险:当 allow_url_fopen/allow_url_include 或 wrapper 允许时,读取/包含可跨协议 危险模式:
  • 读取/包含路径变量直接来自用户输入
  • 路径拼接未做规范化与 basePath 校验
  • 允许 file://、php://、data://、zip:// 等流包装且未限制
  • 在 include/require 场景存在 allow_url_include=On 或通过配置/封装间接开启网络/跨协议 include 的证据

路径穿越检测(必做)

必须分析并给出证据:

  • 是否过滤 ../、..\\、混合分隔符
  • 是否做 realpath/canonicalize 并用 basePath 校验前缀
  • 是否处理流包装器(wrapper)前缀:php://、file://、phar://、zip:// 等(必须逐项证据化)
  • 编码/双重编码/大小写/尾部空格/\0(旧版本 PHP)绕过可能性
  • 是否对后缀/扩展名做白名单,并且白名单不易绕过

包含执行判定(强制:提升真阳性)

当检测到 include/require* 使用可控路径时,必须输出以下判定证据(不能跳过):

  1. 包含内容类型:包含目标是否可能被当作 PHP 代码执行(例如扩展名/解析方式/执行路径证据)
  2. 包含路径的最终解析结果:wrapper 解析后是否仍指向可控资源
  3. 执行面边界:include/require 是否位于异常处理、return/throw 分支之后(即使能读也可能不执行)
  4. 配置证据:是否存在 allow_url_include=On、或 auto_prepend_file/auto_append_file、或自定义封装对 include 的放行点

tracer 触发条件(必做)

  • 路径经过多层函数/JSON 字段传递
  • 存在分支:校验逻辑是否只在某路径分支生效

报告输出

输出到:

{output_path}/vuln_audit/file_{timestamp}.md

漏洞条目模板(强制)

必须包含:

  • 位置证据
  • 数据流链(Source→Sink,包含路径拼接与校验分支)
  • 证据引用(来自 php-route-tracer 输出,必须逐项引用):必须对应并引用 trace 的 ## 9) Sink Evidence Type Checklist(FILE 行)中的证据要点
    • EVID_FILE_WRAPPER_PREFIX:wrapper/流包装前缀(如 php:///phar:///zip:// 等)
    • EVID_FILE_RESOLVED_TARGET:final/resolved target(wrapper 解析后的最终目标)
    • EVID_FILE_INCLUDE_REQUIRE_EXEC_BOUNDARY:include/require 执行面边界(是否会执行 PHP 代码 vs 仅读取内容/报错;该证据点也可包含与 allow_url_include/封装放行相关的证据)
  • 可利用前置条件(鉴权/输入可控性/触发条件)
  • 可执行 PoC(HTTP 请求,含真实路由)
  • 建议修复(basePath 校验 + 流包装禁用策略 + include/require 的安全替代要点 + 代码搜索语句)

tracer 证据缺失处理(强制)

  • 若 trace 的 ## 9) Sink Evidence Type Checklist(FILE 行)中任一关键证据要点缺失或无法对应到本条漏洞:该条漏洞状态必须为 ⚠️待验证(不得直接给出 ✅已确认可利用)。

Frequently asked questions

What does the Php File Read Audit AI skill do?

PHP Web 源码任意文件读取/路径穿越审计工具。识别文件读取 Sink,追踪路径来源与校验逻辑,输出可利用性分级、PoC 与修复建议(禁止省略)。

Why use Php File Read Audit on TypingMind?

Because you install it once and use it with any model. Php File Read Audit is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Php File Read Audit in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/0xShe/PHP-Code-Audit-Skill/tree/main/php-file-read-audit. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Php File Read Audit?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Php File Read Audit?

As many as you like. As long as a model supports skills, you can use Php File Read Audit with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Php File Read Audit AI skill free?

It is published on GitHub by 0xShe. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇