CVE-2023-46240
📋 TL;DR
CodeIgniter4 versions before 4.4.3 display detailed error reports in production environments when errors or exceptions occur, potentially leaking sensitive information like database credentials, file paths, or application logic. This affects all CodeIgniter4 applications running vulnerable versions in production mode. The vulnerability allows attackers to gain information about the application's internal structure.
💻 Affected Systems
- CodeIgniter4
📦 What is this software?
Codeigniter by Codeigniter
⚠️ Risk & Real-World Impact
Worst Case
Attackers obtain database credentials, API keys, or other sensitive configuration data, leading to full system compromise, data theft, or further attacks.
Likely Case
Attackers gather information about application structure, file paths, and potential weaknesses that could be used for targeted attacks.
If Mitigated
Limited information disclosure with no sensitive data exposed due to proper error handling configuration.
🎯 Exploit Status
Exploitation requires triggering an error or exception, which can often be done through malformed requests or accessing non-existent resources.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 4.4.3
Vendor Advisory: https://github.com/codeigniter4/CodeIgniter4/security/advisories/GHSA-hwxf-qxj7-7rfj
Restart Required: No
Instructions:
1. Update CodeIgniter4 to version 4.4.3 or later using composer: 'composer require codeigniter4/framework:^4.4.3' 2. Verify the update completed successfully 3. Test application functionality
🔧 Temporary Workarounds
Manual configuration fix
allModify the production configuration to properly disable error display
Edit app/Config/Boot/production.php and change 'ini_set('display_errors', '0')' to 'ini_set('display_errors', 'Off')'
🧯 If You Can't Patch
- Implement custom error handling that catches all exceptions and returns generic error messages without sensitive details
- Configure web server (Apache/Nginx) to intercept and rewrite error responses before they reach the client
🔍 How to Verify
Check if Vulnerable:
Check CodeIgniter version in composer.json or run 'composer show codeigniter4/framework' and verify version is below 4.4.3
Check Version:
composer show codeigniter4/framework | grep versions
Verify Fix Applied:
After patching, verify version is 4.4.3 or higher and test that production errors return generic messages without sensitive information
📡 Detection & Monitoring
Log Indicators:
- HTTP 500 errors with detailed stack traces in access logs
- Unusual error patterns or increased error rates
Network Indicators:
- HTTP responses containing PHP error messages, stack traces, or file paths
SIEM Query:
http.status_code=500 AND (http.response_body="*PHP*" OR http.response_body="*Stack trace*")
🔗 References
- https://codeigniter4.github.io/userguide/general/errors.html#error-reporting
- https://github.com/codeigniter4/CodeIgniter4/commit/423569fc31e29f51635a2e59c89770333f0e7563
- https://github.com/codeigniter4/CodeIgniter4/security/advisories/GHSA-hwxf-qxj7-7rfj
- https://codeigniter4.github.io/userguide/general/errors.html#error-reporting
- https://github.com/codeigniter4/CodeIgniter4/commit/423569fc31e29f51635a2e59c89770333f0e7563
- https://github.com/codeigniter4/CodeIgniter4/security/advisories/GHSA-hwxf-qxj7-7rfj