PortGate

Advisories · PHP & Laravel

CVE-2021-21263 High CVSS 8.1

Laravel cookie serialization switching bug

Disclosed 2021 · Last reviewed 2 Dec 2026

An old encrypted cookie could be unserialized after an application changed how cookies were encoded, if the application key was already known to the attacker.

What happened

The decryption path accepted the previous serialization format.

Affected and patched versions

Affected
Laravel before 6.20.11, 7.30.2, and 8.22.1 when an application switched cookie serialization while old cookies still existed.
Patched
Those releases. Current majors are past it.

How to check your server

Check

composer show laravel/framework

How to fix and harden

  1. Upgrade Laravel within your major.
  2. If APP_KEY was exposed, rotate it. Rotation logs every user out.
  3. Do not encrypt PHP-serialized objects into cookies.

Fix

composer show laravel/framework

Sources

Version ranges and fixes follow the vendor advisory. When a distribution backports a fix, trust its security tracker over the upstream version number. New advisories: RSS · JSON