php-auth-config-audit

Audit PHP source code for authentication, authorization, configuration, cryptography, and business logic vulnerabilities.

1.7k|238|Updated Dec 7, 2019
One-click install
npx skills add https://github.com/wgpsec/AboutSecurity --skill php-auth-config-audit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: php-auth-config-audit
Source: https://github.com/wgpsec/AboutSecurity/tree/main/skills/code-audit/php/php-auth-config-audit
Command: npx skills add https://github.com/wgpsec/AboutSecurity --skill php-auth-config-audit

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

White-box PHP security reviews often miss subtle flaws like loose comparison bypasses, IDOR, debug mode leftovers, weak password hashing, and race conditions. This Skill provides a structured audit methodology covering five risk categories so reviewers can systematically detect authentication bypass, authorization failures, insecure configuration, cryptographic misuse, and business logic defects directly in source code.

Core Features & Use Cases

  • Five-Category Risk Coverage: Audit checklists and dangerous-vs-safe code patterns for authentication bypass (hardcoded credentials, == weak comparison, JWT flaws), authorization failures (IDOR, middleware gaps, horizontal/vertical privilege escalation), security configuration (php.ini baseline, CORS, debug mode), cryptographic misuse (md5/sha1 password storage, ECB mode, hardcoded keys, weak randomness), and business logic (race conditions, payment tampering, state machine skips).
  • Detection Patterns & Grep Strategies: Ready-to-use search commands and code signatures for locating hardcoded secrets, weak comparisons, and unsafe random token generation.
  • Use Case: During a code audit of a Laravel application, use this Skill to verify JWT signature validation, check route middleware coverage with php artisan route:list, confirm password_hash usage, and inspect wallet balance updates for missing lockForUpdate transactions.

Quick Start

Audit this PHP codebase for authentication bypass, IDOR, insecure configuration, weak cryptography, and business logic flaws using the five-category checklist.

Frequently Asked Questions about php-auth-config-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find authentication bypass vulnerabilities in PHP source code?

Search for hardcoded credentials assigned to password, secret, or api_key variables, and flag all loose `==` comparisons on tokens or passwords since PHP type juggling makes `"0e123" == "0e456"` evaluate to true. Secure code uses `hash_equals` or strict `===` comparison.

How to detect IDOR vulnerabilities during a PHP code review?

Look for user-controlled input like `$_GET['id']` passed directly into `find()` or `where('id', ...)` queries without an ownership filter such as `where('user_id', auth()->id())`. Also verify route middleware coverage to catch unprotected endpoints.

What PHP cryptographic mistakes should a code audit check for?

Check for md5 or sha1 used for password storage instead of `password_hash`, AES-ECB mode which produces deterministic ciphertext, hardcoded encryption keys in source, and predictable randomness from `mt_rand`, `rand`, or `uniqid` used for security tokens instead of `random_bytes`.

Does this audit approach cover JWT vulnerabilities in PHP?

Yes, it covers JWT algorithm confusion (RS256 to HS256), acceptance of alg:none, kid parameter injection via path traversal or SQL, and key leakage in .env or config files. Secure implementations force a fixed algorithm server-side during decode.

What are the limits of source-code-only security auditing?

Static source review cannot confirm runtime exploitability such as actual race condition timing or live JWT forgery, which require dynamic black-box testing. It also depends on reviewer coverage of all routes and may miss flaws in compiled dependencies or server configuration outside the codebase.