/

CVE-2026-39393

Severity:

HIGH RISK

(8.1)

Missing Authentication / Access Control on Critical

CVE-2026-39393

Analyzed

Vulnerability type

Category:

Missing Authentication / Access Control on Critical Functionality

CWE:

CWE-306

Impact:

Unauthenticated Application Takeover via Misprotected Installation Wizard

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

CI4MS, a CodeIgniter 4-based CMS skeleton, contains a flaw in its install route guard where access control relies on a volatile cache and .env file presence rather than robust authentication.

When the database is unreachable during a cache miss, the guard fails open and allows unauthenticated access to the setup wizard, enabling an attacker to overwrite the .env file with arbitrary database credentials and ultimately take over the application.

Affected context

The vulnerability appears in CI4MS deployments that expose the installation or setup wizard route in production environments.

The guard for this route uses a combination of:

  • cache('settings') to decide whether the application is configured, and
  • The existence of a .env file to infer installation state.

If the cache entry for settings expires or is cleared, and the application cannot reach the database at that moment, the guard logic degenerates into a fail-open behavior.

In such conditions, any unauthenticated HTTP client able to reach the install endpoint may interact with the setup wizard and override environment configuration.

Exploit preconditions

  • Attack surface: Publicly or internally reachable web endpoint exposing the CI4MS installation/setup wizard route.
  • Required access: No prior authentication is required; simple HTTP access to the web application is sufficient.
  • Trigger conditions:
  • The settings cache entry is missing (due to TTL expiry, manual cache clear, deployment, or restart).
  • The database is temporarily unreachable when the guard attempts to rehydrate configuration (network issue, DB restart, misconfiguration, etc.).
  • Why exploitation is possible:
  • The route guard treats cache presence and .env existence as the primary indicators of installation status, with no strong authentication or secondary checks.
  • On cache miss plus database connectivity failure, the guard falls back to allowing the install wizard to proceed rather than denying access.
  • The install process permits writing or overwriting the .env file with user-supplied database credentials.

Why this happens

This issue is rooted in CWE-306: Missing Authentication for Critical Functionality.

A critical administrative function—the installation and configuration wizard—is protected only by indirect state checks (cache content and .env file presence) rather than explicit authentication and authorization controls.

The design assumes that cache and database availability are reliable signals of installation completion, but does not account for transient infrastructure failures or cache invalidation events.

When those assumptions break, the control fails open instead of failing closed, exposing the installation workflow to unauthenticated users who can then rewrite core configuration, including database connection settings.

Potential impact

  • Unauthenticated overwrite of the .env file with attacker-controlled database credentials.
  • Full application takeover by pointing the CMS to an attacker-controlled database containing malicious data, accounts, or configuration.
  • Loss of integrity and confidentiality of application data via leveraged access from the newly configured database.
  • Persistent backdoor or account creation within the application through the compromised installation workflow.
  • Potential pivot to other infrastructure if application secrets, tokens, or service credentials in the .env are exposed or redirected.

General mitigation guidance

Effective mitigation focuses on enforcing strong, explicit access control on installation and other critical maintenance functions, and avoiding fail-open designs tied to volatile state:

  • Require authentication (and ideally administrative-level authorization) before allowing access to the install or setup wizard once the application has been initially configured.
  • Implement a non-volatile, authoritative installation-complete flag that is checked independently of cache and transient database health, and default to denying access when system state is ambiguous.
  • Design guard logic to fail closed: if cache, database, or configuration checks are inconclusive or error out, return an error rather than exposing the wizard.
  • Restrict write access to the .env file and other core configuration to trusted processes, minimizing opportunities for runtime modification through HTTP endpoints.
  • Encourage operational patterns where installation routes are disabled, removed, or firewalled in production environments once the system is deployed.

How teams detect issues like this

Detection efforts can concentrate on both code-level patterns and runtime indicators:

  • Static analysis and code review:
  • Flag routes related to installation, setup, or configuration that lack explicit authentication/authorization middleware.
  • Identify protection logic that relies solely on cache entries, environment file presence, or database reachability as security controls.
  • Review any code paths that write to .env or similar configuration files from web-facing controllers.
  • Security testing:
  • Perform authenticated and unauthenticated scanning of deployment endpoints looking for exposed installation or setup URLs.
  • Introduce simulated cache misses and database outages in test environments to observe whether critical routes become accessible.
  • Operational monitoring:
  • Log and alert on access to installation or setup routes after initial deployment.
  • Monitor for unexpected writes or changes to .env and other configuration artifacts at the file system or version control level.
  • Automated review tools can be configured to track patterns of missing authentication on sensitive controllers and to enforce policies on configuration-modifying endpoints.

Sources

SourceLink
github.comgithub.com/ci4-cms-erp/ci4ms/security/advisories/GHSA-8rh5-4mvx-xj7j

Frequently asked

questions

Yes, if the CI4MS instance exposes the installation route over the network and the preconditions (cache miss and temporary database unavailability) occur, a remote unauthenticated attacker can reach and use the setup wizard.

No. The core problem is missing authentication on the installation wizard under specific failure conditions. When the guard fails open, no login or prior access is required to overwrite the .env configuration.

Protect installation and other critical maintenance functions with explicit authentication and authorization, and implement a robust, non-volatile "installation completed" flag. Ensure that if any checks (cache, database, configuration) fail, the application denies access rather than proceeding.

Avoid relying on cache or transient service health as primary security controls, treat setup and configuration endpoints as high-risk administrative functions, enforce least-privilege and fail-closed logic, and include tests that simulate infrastructure failures to confirm access controls remain intact.

Find out what's already
exploitable in your codebase.