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:<br/><br/>1. Run the following Artisan command to generate a new random key:<br/><pre>php artisan key:generate</pre><br/>2. Verify the APP_KEY value in your <strong>.env</strong> file has been updated to a base64-encoded 32-character random string:<br/><pre>APP_KEY=base64:YOUR_NEW_RANDOM_KEY_HERE</pre><br/>3. Clear all existing application caches:<br/><pre>php artisan config:cache php artisan cache:clear</pre><br/>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.<br/>5. Never commit the APP_KEY to version control or share it publicly.<br/>6. Implement a key rotation policy and rotate the APP_KEY periodically or after any suspected compromise.

Related Vulnerabilities