From vanguard-frontier-agentic
Static review of PHP code for unserialize() object injection, session fixation/hijacking, and unsafe file-upload patterns. Use during security audits.
How this skill is triggered — by the user, by Claude, or both
Slash command
/vanguard-frontier-agentic:php-session-upload-deserialization-reviewThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Review PHP source for the three failure modes where the language's own deserialization, session, and file-upload primitives are used in a way php.net's own manual explicitly warns against: `unserialize()` called on untrusted input (object injection, potentially remote code execution), a session that is not regenerated after a privilege change or that ships without cookie hardening (fixation/hij...
Review PHP source for the three failure modes where the language's own deserialization, session, and file-upload primitives are used in a way php.net's own manual explicitly warns against: unserialize() called on untrusted input (object injection, potentially remote code execution), a session that is not regenerated after a privilege change or that ships without cookie hardening (fixation/hijacking), and an upload handler that trusts the client or stores/executes accepted files inside the webroot.
Use this skill when the user asks to:
unserialize(), or a library/cache/session backend that transparently unserializes stored data, for object-injection risk;use_strict_mode, httponly, secure, samesite) is configured;Do not use this skill for:
unserialize(), plus the source of the data passed to each call (request body/query/cookie, cache backend, queue message, database column).session_start(), session_regenerate_id(), and $_SESSION writes occur relative to a login, role change, or password reset.session.* INI settings in scope (session.use_strict_mode, session.cookie_httponly, session.cookie_secure, session.cookie_samesite) from php.ini, .htaccess, or runtime ini_set() calls.$_FILES is validated, where accepted files are stored, and the upload_max_filesize/post_max_size/max_file_uploads configuration in effect.session.cookie_samesite requires PHP 7.3+; destructor-on-fatal-error behavior changed at PHP 5.3.10).unserialize() call on untrusted input regardless of allowed_classes — the manual's caution applies unconditionally, and allowed_classes narrows instantiable classes without making the call safe.__wakeup(), __unserialize(), __destruct()) for any class an untrusted unserialize() call could instantiate; PHP invokes these automatically on the reconstructed object or during the shutdown sequence.json_decode()/json_encode() as the default remediation for untrusted data interchange unless serialized PHP objects are confirmed necessary.session_regenerate_id(true) before the authenticated flag is written to $_SESSION on every login/elevation/reset path; a regeneration call placed after that write is a finding, not a pass.session.use_strict_mode, session.cookie_httponly, session.cookie_secure, and session.cookie_samesite individually and explicitly; never infer hardening from defaults, since use_strict_mode is disabled by default.$_FILES[...]['type'] or filename alone), store accepted files outside any web-servable path, and enforce upload_max_filesize, post_max_size, and max_file_uploads.repo evidence (seen in the reviewed code) or documentation-based (current php.net manual); never assert a documented API behavior from memory.This skill's allowed-tools is limited to Read, Grep, and Glob — it does not include a live documentation-lookup tool, so grounding is done against the bundled, php.net-sourced reference files rather than a runtime Context7 call. unserialize(), the session.* INI directives, and the upload-handling behaviors reviewed here are core-language documentation, not a third-party library whose API shifts release to release, so the bundled references (each fetched directly from php.net, with its own Sources section and verification date) are the grounding source of record. If a review surfaces a claim about PHP behavior not covered by the bundled references — a different function, a different INI directive, a different PHP version's behavior — do not assert it from memory; say the claim is unverified against a specific php.net page and escalate for direct verification rather than guessing.
unserialize() call site in scope and trace the data source of its argument; classify each as untrusted-input-reachable or not.unserialize() call, identify classes it could instantiate and check for __wakeup(), __unserialize(), and __destruct() magic methods that would fire automatically — see Unserialize object injection.session_regenerate_id(true) is called before $_SESSION carries the authenticated flag, and check the four session-hardening directives — see Session security.unserialize() call, a missing/misordered session_regenerate_id() call, a missing session.use_strict_mode, or an upload handler that trusts the client, stores inside the webroot, or lacks enforced limits.unserialize(), session-directive, or upload-limit claim cites the current php.net manual (documentation-based) or the reviewed code (repo evidence) — never memory.Label each finding repo evidence (seen directly in the reviewed code or configuration) or documentation-based (the current php.net manual). This skill does not use context7-grounded (no Context7 tool in scope) and does not use inference for a documented API behavior — an undocumented or unverifiable behavior claim must be flagged as unverified rather than guessed.
Static review only. Never request, transmit, store, or reproduce a secret, credential, session id, token, or PII found in reviewed code or configuration; treat any such string as a redact-and-flag finding. Never execute a deserialization payload, replay or forge a session id, upload a file, or send any request to a live, sandbox, or staging system. OWASP category mappings are classification aids, never compliance attestations.
Escalate to incident response on any evidence the failure is already live: an object-injection payload observed in logs, a reachable uploaded web shell, or an observed session id reused across a privilege boundary. Escalate backend authorization-model design and infrastructure-scoped findings (webroot layout, TLS termination) to their owning specialist rather than adjudicating them here.
Load these only when needed:
unserialize() on untrusted input is unsafe regardless of allowed_classes, the magic-method attack surface, and the json_decode() remediation.session_regenerate_id() ordering around privilege changes and the four session cookie-hardening directives.Each reference file carries its own Sources section citing the exact php.net (or OWASP) page backing its claims — there is no separate primary-source ledger file in this skill.
Return, at minimum:
object-injection / session-fixation-hijacking / unsafe-upload) and evidence tier;allowed_classes as a mitigation for unserialize() on untrusted input; the manual's caution is unconditional.unserialize(), session-directive, or upload-limit behavior from memory; ground every such claim in the current php.net manual.npx claudepluginhub raishin/vanguard-frontier-agentic --plugin vanguard-frontier-agenticAnalyzes PHP code for insecure deserialization vulnerabilities including unserialize with user input, missing allowed_classes, object injection, gadget chains, and Phar metadata triggers.
Audits PHP deserialization surfaces (unserialize, session decoders, WDDX, phar metadata, custom handlers) for UAFs via back-references, type confusion, partial-object __destruct, heap overflows. Targets PHP 5.4-5.6 sources with advisory corpus verification.
Implements essential PHP security patterns: input validation/sanitization, SQL injection prevention, XSS protection, CSRF tokens, password hashing, secure sessions, file uploads, and defense-in-depth for secure apps.