Skip to content

Laravel APP_KEY leakage analysis #1091

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

carlospolop
Copy link
Collaborator

🤖 Automated Content Update

This PR was automatically generated by the HackTricks News Bot based on a technical blog post.

📝 Source Information

🎯 Content Summary

Technical Summary of Laravel Encryption and Exploitation

Encryption Implementation

Laravel’s encryption is implemented in the Illuminate\Encryption\Encrypter class using AES-256-CBC with a randomly generated IV, HMAC integrity, and optional serialization.

Encrypted output is a base64-encoded JSON object with fields iv, value, mac, and tag.

Example Encryption

...

🔧 Technical Details

Laravel’s default decrypt($payload) method unserializes its output ($unserialize = true), allowing an attacker with knowledge of the APP_KEY to craft encrypted serialized PHP objects wrapped in the Encrypter’s JSON format (iv/value/mac/tag) and base64-encode them to achieve RCE via magic methods.

Using PHPGGC, attackers can generate Laravel gadget chains (e.g., RCE13, RCE9, RCE15) that trigger 🤖 Agent Actions

Added advanced Laravel APP_KEY exploitation content:

  1. Explained encryption format and the decrypt() unserialize vector.
  2. Added laravel-crypto-killer usage (encrypt / decrypt / bruteforce).
  3. Documented real-world pre-auth RCE patterns (Invoice Ninja, Snipe-IT, Crater).
  4. Covered large-scale APP_KEY brute-forcing and key-reuse statistics.
  5. Included comprehensive references.

All changes appended to existing pentesting-web/laravel.md while preserving original material.

✅ Review Checklist

  • Content is technically accurate
  • Formatting follows HackTricks style guidelines
  • Links and references are working
  • Content adds educational value
  • No sensitive information is exposed

This PR was automatically created by the HackTricks Feed Bot. Please review the changes carefully before merging.

📚 Repository Maintenance

  • MD files processed: 848
  • MD files fixed: 14

All .md files have been checked for proper formatting (headers, includes, etc.).

@carlospolop
Copy link
Collaborator Author

🔗 Additional Context

Original Blog Post: https://www.synacktiv.com/publications/laravel-appkey-leakage-analysis.html

Content Categories: Based on the analysis, this content was categorized under "generic-hacking/php-object-injection/laravel-appkey-unserialize-rce.md".

Repository Maintenance:

  • MD Files Formatting: 848 files processed (14 files fixed)

Review Notes:

  • This content was automatically processed and may require human review for accuracy
  • Check that the placement within the repository structure is appropriate
  • Verify that all technical details are correct and up-to-date
  • All .md files have been checked for proper formatting (headers, includes, etc.)

Bot Version: HackTricks News Bot v1.0

@carlospolop carlospolop merged commit 3470d71 into master Jul 10, 2025
@carlospolop carlospolop deleted the update_Laravel__APP_KEY_leakage_analysis_20250710_120305 branch July 10, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant