← All lessons

Lessons: #deserialization

4 min read

PHP Deserialization Risks: Why unserialize Is Unsafe for User Input

The PHP manual warns: do not pass untrusted input to unserialize(), regardless of allowed_classes. Unserialization can instantiate objects and run code during autoloading. Prefer json_encode() / json_decode() for data you accept from users, and treat allowed_classes as a hardening step for trusted payloads only.

Get new briefs by email

Short alerts when a PHP or WordPress vulnerability needs action.

Double opt-in via Buttondown; unsubscribe any time. See our privacy policy.