Summary
Erlang OTP's inets HTTP server contains an incorrect authorization flaw where directory-based access rules are evaluated against a different path than the one used to execute CGI scripts when ScriptAlias is configured.
This path mismatch can allow unauthenticated users to invoke CGI scripts that administrators intended to protect with directory rules, effectively bypassing authentication and authorization controls.
Affected context
The vulnerability appears in Erlang OTP deployments using the inets HTTP server with:
- CGI support enabled via
mod_cgi - URL-to-directory mappings defined using
script_alias - Directory-based access control rules configured in
mod_auth
It is relevant when the script_alias target directory lies outside the main DocumentRoot, and administrators rely on directory rules to protect those CGI scripts.
In such cases, the HTTP server evaluates access controls using a DocumentRoot-relative path while actually executing CGI scripts based on the ScriptAlias-resolved path, creating a mismatch in protection coverage.
Exploit preconditions
- Attack surface: HTTP interface exposed by the Erlang inets HTTP server.
- Required access: Network reachability to the affected HTTP server; no prior authentication needed when misconfiguration aligns with the vulnerable pattern.
- Trigger point: An HTTP request to a CGI endpoint whose URL is mapped via
script_aliasto a directory outsideDocumentRoot, and which is expected to be protected by directory-based access rules. - Why exploitation is possible:
mod_authevaluates directory access control based on the path relative toDocumentRoot, whilemod_cgiexecutes CGI scripts based on the ScriptAlias-mapped filesystem path. When these paths diverge, the access control decision is made on one path, but the execution happens on another, allowing the script to run without the intended authentication.
Why this happens
The underlying issue is a logical authorization flaw where different components of the request pipeline make inconsistent assumptions about the resource path.
mod_alias translates a URL prefix into a filesystem path via script_alias, potentially outside DocumentRoot.
However, mod_auth bases its authorization checks on a path computed relative to DocumentRoot, not on the final ScriptAlias-resolved script path.
Meanwhile, mod_cgi executes the CGI script at the ScriptAlias-resolved path.
This split-brain understanding of "where the resource lives" leads to CWE-863: Incorrect Authorization, because the security decision is made on the wrong resource identifier, allowing execution of scripts that directory rules were meant to constrain.
Potential impact
- Unauthenticated execution of CGI scripts intended to require authentication.
- Exposure of administrative or sensitive CGI endpoints to the public internet.
- Ability for unauthenticated users to trigger server-side actions, possibly including configuration changes or data processing.
- Potential elevation of privileges if CGI scripts perform operations with higher backend permissions.
- Increased blast radius of any vulnerabilities present within those CGI scripts (e.g., command injection, file access issues).
General mitigation guidance
Effective mitigation focuses on aligning authorization decisions with the actual execution paths and minimizing reliance on ambiguous path-based rules:
- Prefer authentication and authorization mechanisms that bind directly to specific CGI endpoints or URL patterns, rather than solely relying on directory-relative rules that can be confused by alias mappings.
- Avoid mapping security-sensitive CGI directories outside of
DocumentRootviascript_aliaswhen their protection depends on DocumentRoot-based directory rules. - Consolidate path resolution so that the same logical resource identifier is used consistently for URL routing, access control evaluation, and script execution.
- Apply the principle of least privilege to CGI handlers, ensuring that even if access controls fail, scripts run with minimal system and application privileges.
- Use defense-in-depth by enforcing authorization checks inside CGI scripts or upstream application logic, not only at the web server layer.
How teams detect issues like this
Organizations can look for this class of issue using a combination of configuration review and code-level analysis:
- Review inets HTTP server configurations for
script_aliasdirectives that point outsideDocumentRoot, especially where directory-based access rules are expected to protect corresponding paths. - Examine access control configurations in
mod_authto ensure that authorization rules reference the same logical paths thatmod_aliasandmod_cgiuse for resolution and execution. - Incorporate static or configuration analysis checks that flag mismatches between alias mappings and directory access rules (e.g., script paths outside DocumentRoot that lack explicit per-URL authorization).
- During code review, treat any component that makes authorization decisions based on a transformed or partial path as a red flag and verify that it uses the canonical resource path.
- Use automated configuration scanning tools or custom linting scripts to search for patterns like ScriptAlias + external directory + assumed directory-based protection.

