CI4MS Unauthenticated .env Overwrite Vulnerability (CVE-2026-39393)
CI4MS versions before 0.31.4.0 are vulnerable to unauthenticated takeover due to a flawed install route guard that allows overwriting the .env file with attacker-controlled database credentials when the database is temporarily unreachable.
CI4MS, a CodeIgniter 4-based CMS skeleton, is vulnerable to a critical security flaw (CVE-2026-39393) in versions prior to 0.31.4.0. The vulnerability stems from an insufficient install route guard mechanism. This guard, designed to prevent unauthorized access to the setup wizard after installation, relies on a combination of a volatile cache check (cache('settings')) and the presence of the .env file. When the database becomes temporarily unreachable, leading to a cache miss (either due to TTL expiry or manual cache clearing), the route guard fails open. This failure enables an unauthenticated attacker to access the setup wizard and overwrite the .env file with maliciously crafted database credentials. Successful exploitation leads to complete application takeover. The vulnerability was patched in version 0.31.4.0.
Attack Chain
- The target CI4MS instance experiences a database outage or becomes temporarily unreachable.
- The
cache('settings')check in the install route guard fails due to a cache miss caused by the database outage. - The flawed logic in the route guard incorrectly determines that the application is not yet installed.
- An unauthenticated attacker accesses the
/installroute, bypassing the intended security controls. - The attacker interacts with the setup wizard, providing malicious database credentials.
- The application proceeds to overwrite the existing
.envfile with the attacker-supplied database configuration. - The attacker gains full administrative access to the CI4MS application using the newly configured database credentials.
- The attacker can then execute arbitrary code, modify content, and compromise sensitive data within the CI4MS application.
Impact
Successful exploitation of CVE-2026-39393 allows an unauthenticated attacker to achieve full application takeover of CI4MS instances running versions prior to 0.31.4.0. This can lead to complete data breaches, website defacement, and potential compromise of the underlying server. The severity is critical due to the ease of exploitation and the potential for widespread damage. The number of affected systems depends on the number of CI4MS installations that have not been upgraded to version 0.31.4.0 or later.
Recommendation
- Immediately upgrade all CI4MS installations to version 0.31.4.0 or later to patch CVE-2026-39393.
- Implement network monitoring for unusual access attempts to the
/installroute on CI4MS instances. - Deploy the Sigma rule
Detect CI4MS Install Route Accessto detect unauthorized access attempts to the vulnerable installation route. - Review webserver logs for POST requests to the
/installroute with parameters suggestive of database configuration changes. Use the Sigma ruleDetect CI4MS Env Overwriteas a starting point.
Detection coverage 2
Detect CI4MS Install Route Access
mediumDetects unauthorized access attempts to the CI4MS installation route, potentially indicating exploitation of CVE-2026-39393.
Detect CI4MS Env Overwrite
criticalDetects POST requests to the CI4MS installation route that attempt to modify the .env file, potentially indicating exploitation of CVE-2026-39393.
Detection queries are available on the platform. Get full rules →