Php Cmd Audit logo

Php Cmd Audit

Community
0xShe
php-cmd-audit

PHP Web 源码命令注入审计工具。识别命令执行 Sink(exec/system/shell_exec 等),追踪用户输入进入命令拼接,输出可利用性分级、PoC 与修复建议(禁止省略)。

Overview

Publisher0xShe
RepositoryPHP-Code-Audit-Skill
Skill namephp-cmd-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 Cmd 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-cmd-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-cmd-audit .claude/skills/php-cmd-audit
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Php Cmd 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 Cmd 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 Cmd 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-cmd-audit)

分析 PHP 项目源码,识别系统命令执行相关代码,并追踪用户输入到命令构造点,验证是否存在命令注入风险。

CRITICAL

  • 必须使用数据流链证据判定可利用性
  • 禁止省略:不得出现任何省略占位符;每条条目必须包含完整的证据链与可观测验证框架
  • 每条高危/中危条目必须含:位置证据 + Source→Sink 数据流链 + 可利用前置条件 + 可执行 PoC + 修复建议

分级与编号

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

命令执行 Sink(必做)

识别以下函数/语法:

  • exec/system/shell_exec/passthru
  • proc_open/popen/pcntl_exec
  • 反引号语法:`cmd` 危险模式:
  • 命令字符串通过拼接包含用户输入(GET/POST/Body/参数字段)
  • 未做白名单/未做 shell 转义,尤其包含 ;|&、$()、反引号、换行等

追踪与验证(必做)

触发 php-route-tracer 的条件:

  • 命令字符串由多个变量组成
  • 存在参数经过 JSON 解码/多层传递
  • 命令构造被 if/try 分支影响

报告输出

输出到:

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

漏洞条目模板(强制)

markdown
### [{等级前缀}-CMD-{序号}] {风险标题}

| 项目 | 信息 |
|------|------|
| 严重等级 | {🔴/🟠/🟡/🔵} (CVSS {score}) |
| 可达性 (R) | {0-3} - {理由} |
| 影响范围 (I) | {0-3} - {理由} |
| 利用复杂度 (C) | {0-3} - {理由} |
| 可利用性 | ✅ 已确认 / ⚠️ 待验证 / ❌ 不可利用 / 🔍 环境依赖 |
| 位置 | {file}:{line} ({Function/Class}) |

#### 数据流链(Source → Sink)
(逐行写出:请求参数读取 -> 拼接/拼装 -> 命令执行函数/语句)

#### 可利用前置条件
- 鉴权要求:{无需/需登录/需特定权限}
- 输入可控性:{完全可控/条件可控/不可控}
- 触发条件:{分支/异常/环境依赖}

#### 证据引用(强制:来自 php-route-tracer)
每条命令注入疑似漏洞必须逐项引用 trace 输出中 `## 9) Sink Evidence Type Checklist` 的 **CMD 行**对应证据要点(允许状态为待验证,但证据引用必须存在):
1. `EVID_CMD_EXEC_POINT`:命令执行函数/语句位置(对应 trace 的 CMD 执行点证据)
2. `EVID_CMD_COMMAND_STRING_CONSTRUCTION`:命令字符串/关键参数构造位置(拼接/模板化证据)
3. `EVID_CMD_USER_PARAM_TO_CMD_FRAGMENT`:用户可控参数到命令关键片段的映射证据

#### tracer 证据缺失处理(强制)
- 若无法定位上述 1~3 任一关键证据要点:该漏洞状态只能标记为 `⚠️待验证`,不得直接给出 `✅已确认可利用`。

#### 验证 PoC(强制)
```http
POST {完整路径} HTTP/1.1
Host: {host}
{必要 Cookie/Auth}

{Payload}
建议修复
  • 强制使用命令参数白名单 + 安全参数拼接策略(避免 shell=true 的情况)
  • 推荐替代实现(如使用不经 shell 的进程调用方式,或完全避免拼接)
  • 给出代码搜索语句(rg)定位同类拼接点

Frequently asked questions

What does the Php Cmd Audit AI skill do?

PHP Web 源码命令注入审计工具。识别命令执行 Sink(exec/system/shell_exec 等),追踪用户输入进入命令拼接,输出可利用性分级、PoC 与修复建议(禁止省略)。

Why use Php Cmd Audit on TypingMind?

Because you install it once and use it with any model. Php Cmd 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 Cmd Audit in TypingMind?

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

Which AI models can use Php Cmd 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 Cmd Audit?

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

Is the Php Cmd 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 👇