1---2name: php-framework-audit3description: |4 PHP framework-specific security audit. Triggered during PHP white-box audits once the target framework has been identified5 and framework-specific security mechanisms and common configuration flaws need to be checked.6 Covers 6 major frameworks: Laravel (mass assignment / Blade XSS / CSRF exceptions),7 ThinkPHP (historical RCE / route injection / cache write), WordPress (plugin vulnerabilities / permission hooks / nonce validation),8 Symfony (Debug Bar / YAML parsing / security voters), Yii2 (RBAC / ActiveRecord injection), CodeIgniter (global XSS / CSRF token).9zh-signals: "PHP 框架特定安全审计,覆盖 Laravel、ThinkPHP、WordPress、Symfony、Yii2 与 CodeIgniter。信号:Laravel审计,ThinkPHP,WordPress插件,框架安全,配置缺陷"10when-to-use: "Use during PHP white-box audits once a target framework is identified, to check framework-specific security mechanisms and common configuration flaws across Laravel, ThinkPHP, WordPress, Symfony, Yii2, or CodeIgniter."11metadata:12 source: https://skillmd.com/skills/dangeroussong/php-framework-audit13 tags: laravel, thinkphp, wordpress, symfony, yii, codeigniter, framework audit, mass assignment, blade xss, wp plugin, think rce14 category: code-audit15---1617# PHP Framework-Specific Security Audit18- 攻击大类:C09 Web应用漏洞利用19## Framework Identification Decision Table2021| Identification Feature | Framework | Deep Reference |22|---|---|---|23| `composer.json` → `laravel/framework` | Laravel | [references/laravel-patterns.md](references/laravel-patterns.md) |24| `composer.json` → `topthink/framework` | ThinkPHP | [references/thinkphp-patterns.md](references/thinkphp-patterns.md) |25| Presence of a `wp-content/` directory or `wp-config.php` | WordPress | [references/wordpress-patterns.md](references/wordpress-patterns.md) |26| `composer.json` → `symfony/framework-bundle` | Symfony | Briefly covered here |27| `composer.json` → `yiisoft/yii2` | Yii2 | Briefly covered here |28| `composer.json` → `codeigniter4/framework` | CodeIgniter | Briefly covered here |2930## Laravel Core Checkpoints31321. **Mass Assignment** -- are `$fillable` / `$guarded` configured correctly; do `Model::create($request->all())` or `update($request->all())` contain unfiltered fields332. **Blade XSS** -- search for unescaped output via `{!! !!}`, direct echo inside `@php` directives, and custom Blade Directives that do not call `e()`343. **CSRF Exceptions** -- does the `$except` array of the `VerifyCsrfToken` middleware contain sensitive routes; API route groups do not include the CSRF middleware by default354. **Gate / Policy** -- do controller methods call `$this->authorize()` or `Gate::allows()`; do Policy definitions cover all CRUD operations365. **Eloquent Raw** -- is there variable concatenation in `whereRaw` / `havingRaw` / `orderByRaw` / `DB::raw`376. **Signed URLs / Debugging** -- leftover `APP_DEBUG=true`, web-accessible `.env`, exposed Telescope / Debugbar routes3839## ThinkPHP Core Checkpoints40411. **Historical RCE Routes** -- TP5.x `method()` override, arbitrary method invocation via the `Request` class `__construct`422. **Cache File Write** -- predictable cache file path + controllable content → write a WebShell433. **Database where Injection** -- expression injection via `exp` / `like` / `between` in `where` array conditions, `Db::raw`444. **Session Deserialization** -- the TP6 session serialization driver may trigger a POP chain455. **Template Injection** -- `{php}` tags, variable function calls such as `{:system()}`4647## WordPress Core Checkpoints48491. **Plugin action/filter** -- `wp_ajax_nopriv_*` hooks exposing unauthenticated operations, Shortcode callback parameter injection502. **Missing $wpdb->prepare** -- direct SQL concatenation into `$wpdb->query()`513. **Nonce Validation** -- form handlers / AJAX handlers missing `wp_verify_nonce` / `check_admin_referer`524. **REST API** -- is the `permission_callback` of `register_rest_route` `__return_true` or missing535. **File Upload** -- plugin custom upload logic bypassing the MIME check of `wp_handle_upload`5455## Symfony Brief Overview5657- **Debug Mode** -- `APP_DEBUG=1` leaks the Profiler / Web Debug Toolbar, exposing environment variables and SQL58- **YAML Deserialization** -- lower versions of `Yaml::parse` support the `!!php/object` tag, leading to object injection59- **Security Voter** -- flaws in custom Voter logic or misuse of `ACCESS_ABSTAIN` leading to broken access control6061## Yii2 Brief Overview6263- **RBAC Configuration** -- improper permission item assignment in `DbManager`, missing `checkAccess` calls leading to vertical privilege escalation64- **ActiveRecord Injection** -- string concatenation in `findBySql` / `where` conditions, unfiltered `orderBy`6566## CodeIgniter Brief Overview6768- **Global XSS Filtering** -- CI3 `$config['global_xss_filtering']` is deprecated, CI4 requires manual `esc()` calls69- **CSRF Token** -- `CSRFProtection` is configured but too many routes are excluded, and the token regeneration policy is improper7071## Further Reading7273- [Laravel audit patterns](references/laravel-patterns.md)74- [ThinkPHP audit patterns](references/thinkphp-patterns.md)75- [WordPress audit patterns](references/wordpress-patterns.md)