Php Frontend Audit logo

Php Frontend Audit

OrganizationPopular
wgpsec
php-frontend-audit

PHP 源码前端交互类漏洞审计。当在 PHP 白盒审计中需要检测前端安全相关漏洞时触发。 覆盖 5 类前端风险: XSS(反射/存储/DOM)、CSRF(Token 验证缺失)、 开放重定向(header Location 可控)、CRLF 注入(HTTP 响应拆分)、会话与 Cookie 安全(固定/劫持/属性)。 需要 php-audit-pipeline 提供的数据流证据。

Overview

Publisherwgpsec
RepositoryAboutSecurity
Skill namephp-frontend-audit
Stars
1.7K
Forks
242
Bundled files
1
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.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

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

Installation

Install the Php Frontend 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.
  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/wgpsec/AboutSecurity.git /tmp/AboutSecurity
mkdir -p .claude/skills
cp -r /tmp/AboutSecurity/skills/code-audit/php/php-frontend-audit .claude/skills/php-frontend-audit
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Php Frontend 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 Frontend 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 Frontend 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 前端交互类漏洞源码审计

本 skill 聚焦源码层面判断"前端安全漏洞是否成立",核心是验证用户可控数据在 HTTP 响应中的输出是否安全。构造 payload、绕 WAF 等运行时利用技术属于对应黑盒 exploit skill 范畴。

深入参考


5 类前端漏洞速查表

类型典型 Sink触发条件严重度
XSS (反射/存储/DOM)echo, print, 模板输出 {!! !!}用户输入未转义输出到 HTML 上下文High-Critical
CSRF状态变更表单/API缺少 Token 校验且无 SameSite 保护Medium-High
开放重定向header("Location:"), 框架 redirect()重定向目标 URL 用户完全可控Medium
CRLF 注入header(), setcookie()用户输入含 \r\n 进入 HTTP 响应头Medium-High
会话安全session_start(), setcookie()session 固定/Cookie 属性缺失Medium-High

XSS 审计要点

  • 输出上下文决定转义需求: HTML body、属性、JavaScript 字符串、URL 各需要不同的转义策略,单一 htmlspecialchars 不能覆盖所有场景
  • htmlspecialchars 检查: 确认使用了 ENT_QUOTES flag(默认 ENT_COMPAT 不转义单引号)和正确的编码参数('UTF-8'
  • 模板引擎自动转义: Blade {{ }} 自动转义但 {!! !!} 不转义;Twig {{ }} 自动转义但 |raw 过滤器跳过;Smarty 取决于 $escape_html 配置
  • 存储型 vs 反射型: 存储型需跨越存储边界追踪——数据入库时是否过滤不重要,关键看输出时是否转义
  • DOM XSS: PHP 后端输出 JSON 到 <script> 标签或 HTML data 属性,前端 JS 取出后写入 DOM(innerHTML/document.write

CSRF 审计要点

  • 状态变更操作识别: 所有 POST/PUT/DELETE 请求中修改数据的操作都应有 Token 验证
  • 框架中间件例外: Laravel VerifyCsrfToken$except 数组、ThinkPHP 的 token_on 配置——被排除的路由是高风险目标
  • SameSite 属性: SameSite=Lax 可防御大多数 CSRF(但不防 GET 型),None 无保护,缺省值因浏览器而异
  • 自定义 Token 实现: 检查 Token 是否绑定 Session、是否一次性消费、是否有时效限制

开放重定向审计要点

  • header Location 可控: header("Location: " . $_GET['url']) 是经典模式,也包括框架的 redirect($url)
  • parse_url 绕过: //evil.com(协议相对 URL)、///evil.com\evil.com(IE 兼容)、javascript: 伪协议都能绕过简单校验
  • 安全白名单: 正确实现是解析 host 后对比允许域名列表,而非正则匹配或前缀检查(example.com.evil.com 绕过前缀)

CRLF 审计要点

  • header() + 用户输入: header("X-Custom: " . $input)$input\r\n 可注入额外响应头
  • PHP 版本差异: PHP 7.0+ 的 header() 已检测 \r\n 并抛 warning(但 setcookie() 到 PHP 8.x 才完善防护)
  • 利用方式: 注入 Set-Cookie 头实现 Session 固定、注入空行后写 Body 实现 XSS

会话安全审计要点

  • session_regenerate_id 时机: 登录成功后应调用此函数防止会话固定。参数 true 删除旧 Session 文件
  • Cookie 属性: session.cookie_httponly=1(防 JS 读取)、session.cookie_secure=1(仅 HTTPS)、session.cookie_samesite=Lax
  • 自定义 Session Handler: 实现 SessionHandlerInterface 时,read()/write() 是否有注入风险(如存储在 DB 时的 SQL 拼接)

检测清单

  • 所有前端类 EVID_* 证据点已逐一审查
  • echo/print 输出点的上下文类型已标注,转义方式与上下文匹配
  • 模板引擎的自动转义是否被关闭已检查
  • 状态变更路由的 CSRF Token 验证已确认,例外路由已标记
  • header() 和 redirect() 的目标参数来源已追踪
  • CRLF 注入对 PHP 版本与受影响函数已交叉确认
  • Session 配置(php.ini / 代码 ini_set)已审计
  • Cookie 四属性(httponly/secure/samesite/path)已逐项检查
  • 严重度评分使用了统一公式,与 pipeline 一致

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Php Frontend Audit AI skill do?

PHP 源码前端交互类漏洞审计。当在 PHP 白盒审计中需要检测前端安全相关漏洞时触发。 覆盖 5 类前端风险: XSS(反射/存储/DOM)、CSRF(Token 验证缺失)、 开放重定向(header Location 可控)、CRLF 注入(HTTP 响应拆分)、会话与 Cookie 安全(固定/劫持/属性)。 需要 php-audit-pipeline 提供的数据流证据。

Why use Php Frontend Audit on TypingMind?

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

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/wgpsec/AboutSecurity/tree/master/skills/code-audit/php/php-frontend-audit. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

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

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

Is the Php Frontend Audit AI skill free?

It is published on GitHub by wgpsec. 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 👇