Laravel Cookie Forge & Decoder
Decode Laravel AES encrypted cookies or forge signed ones — for CTF challenges and authorised testing.
Decode Cookie
Decrypt & verify an existing cookieForge Cookie
Generate a valid signed Laravel cookieHow it works
Laravel encrypts cookies using AES-256-CBC (or AES-128-CBC / GCM variants) with the APP_KEY from your .env file. The encrypted value is base64-encoded JSON containing an IV, the ciphertext, and an HMAC-SHA256 signature. This tool decrypts and verifies the signature or forges a new valid cookie from scratch — both operations happen server-side in PHP without storing any input.
- 1. Get the cookie: intercept the target request in Burp Suite or browser DevTools and copy the laravel_session cookie value.
- 2. Get the APP_KEY: find it in the target .env, a leaked config, or crack it from known plaintext.
- 3. Decode: paste both above and decode to reveal the session payload (user ID, CSRF token, flash data).
- 4. Modify & forge: change the payload (e.g. elevate user_id), paste the APP_KEY and forge a new valid signed cookie.
- 5. Inject: replace the original cookie in your request and resend.
What are Laravel encrypted cookies?
Laravel automatically encrypts and signs all cookies set via Cookie::make() or the cookie helper (unless excluded via $except in EncryptCookies middleware). The session cookie (laravel_session by default) uses the cookie session driver only when SESSION_DRIVER=cookie, otherwise it contains just an encrypted session ID pointer. In CTF challenges, apps frequently use the cookie driver to store the full session payload directly in the cookie.
iv
Initialisation Vector. Randomly generated for each encryption operation. Base64-encoded inside the JSON payload.
value
The AES-encrypted ciphertext. Base64-encoded. openssl_encrypt() with flags=0 (default) returns base64 directly.
mac
HMAC-SHA256 of base64(iv) concatenated with base64(value), keyed with the raw APP_KEY bytes. Absent for GCM ciphers.
tag
GCM authentication tag. Used instead of HMAC for AES-256-GCM and AES-128-GCM ciphers (Laravel 10+).
FAQ
Does this send my cookie or APP_KEY anywhere?
No. Decryption and encryption both happen server-side in PHP using openssl_decrypt / openssl_encrypt. No data is stored, logged, or transmitted to third parties.
What is the cookie session driver?
When SESSION_DRIVER=cookie is set in .env, Laravel serializes the entire session array, encrypts it, and stores it directly in the browser cookie. This is common in CTF challenge setups. Most production apps use file, database, or Redis drivers where only an encrypted session ID is stored in the cookie.
How does the HMAC signature work?
Laravel computes hash_hmac("sha256", base64(iv) . base64(ciphertext), raw_key). Both the IV and ciphertext strings used in the MAC computation are the base64-encoded versions stored in the JSON — not the raw bytes.
What cipher should I choose when forging?
Match the cipher to the one used by the target app. Laravel 5–9 default is AES-256-CBC. Laravel 10+ supports AES-256-GCM. You can detect it from the presence of the tag field in the decoded cookie structure (GCM has a non-empty tag field; CBC has mac instead).
Decryption fails even with the correct APP_KEY — why?
Check that you are pasting the raw cookie value and not a URL-encoded version. Some frameworks double-encode cookies. Also verify the key format: Laravel stores it as base64:xxx in .env — paste it exactly as it appears there.