Looking for the vulnerability index of Invicti's legacy products?
Laravel framework weak secret key - Vulnerability Database

Laravel framework weak secret key

Description

The Laravel framework uses a secret application key (APP_KEY) to cryptographically sign and encrypt session cookies, preventing unauthorized tampering. This application is configured with a weak, default, or publicly known secret key. An attacker can exploit this misconfiguration to decrypt existing session data and forge authenticated session cookies with arbitrary content.

Remediation

Generate a new, cryptographically secure application key immediately and update your Laravel configuration:

1. Run the following Artisan command to generate a new random key:

php artisan key:generate

2. Verify the APP_KEY value in your .env file has been updated to a base64-encoded 32-character random string:
APP_KEY=base64:YOUR_NEW_RANDOM_KEY_HERE

3. Clear all existing application caches:
php artisan config:cache
php artisan cache:clear

4. Invalidate all active user sessions to force re-authentication, as existing sessions encrypted with the old key cannot be decrypted with the new key.
5. Never commit the APP_KEY to version control or share it publicly.
6. Implement a key rotation policy and rotate the APP_KEY periodically or after any suspected compromise.

Related Vulnerabilities