Summary
HAX CMS contains a case-sensitivity issue in its upload handling that allows HTML files with uppercase extensions to bypass a download-only mitigation and be rendered inline.
When an attacker can upload .HTML or .HTM files, the browser will treat them as normal web pages under the HAX CMS origin, allowing embedded JavaScript to execute in the application's security context.
Affected context
This vulnerability applies to HAX CMS deployments using the PHP backend prior to version 26.0.0 that:
- Expose the
saveFileendpoint or similar upload functionality to end users or contributors - Rely on
.htaccessrules to enforce download-only behavior for HTML content - Run under web servers where
.htaccessrules are case-sensitive (e.g., Apache with default behavior)
In these contexts, HTML files uploaded with uppercase or mixed-case extensions are stored and later served as regular text/html documents, rather than forced downloads.
Exploit preconditions
- Attack surface: The
saveFileupload endpoint in HAX CMS PHP. - Required access: Ability to authenticate or otherwise reach the upload endpoint with permission to store files (e.g., author/contributor accounts or misconfigured public upload).
- Trigger point: Uploading a file with an HTML MIME type and a non-lowercase extension (for example
.HTML,.Html,.HTM), and then visiting the resulting URL. - Why exploitation is possible: The backend validates file extensions case-insensitively but writes filenames verbatim, while the
.htaccessrule that enforcesContent-Disposition: attachmentis case-sensitive and only matches lowercase.html. As a result, certain HTML files are served as active content without forced download, allowing embedded scripts to run.
Why this happens
The core bug is a mismatch between how the application validates file extensions and how the web server enforces security-related behavior based on those extensions.
Specifically, the saveFile endpoint treats extensions in a case-insensitive manner when deciding whether a file is acceptable but preserves the original casing when naming the file on disk. The Apache .htaccess configuration, however, relies on case-sensitive pattern matching to apply Content-Disposition: attachment headers to .html files. Files named with .HTML or .HTM bypass this rule entirely and are delivered as standard HTML pages.
This maps to:
- CWE-178: Improper Handling of Case Sensitivity, where different components interpret case differently, undermining the intended security policy.
- CWE-434: Unrestricted Upload of File with Dangerous Type, because HTML (an active content type capable of executing JavaScript) is effectively being accepted and served inline despite mitigations intended to neutralize it.
Conceptually, this is an insecure pattern where trust is placed in extension-based mitigations without normalizing casing or aligning application logic with server configuration, leading to dangerous content being treated as safe.
Potential impact
- Stored cross-site scripting (XSS), where malicious HTML/JavaScript is served from the HAX CMS origin.
- Session theft or hijacking of logged-in users via injected client-side scripts.
- Cross-site request forgery (CSRF) amplification, where injected scripts perform privileged actions on behalf of victims.
- Unauthorized content modification or data exfiltration from the CMS via injected JavaScript.
- Phishing or UI redressing attacks hosted under the legitimate HAX CMS domain.
General mitigation guidance
Effective mitigation centers on aligning file upload controls with web server behavior and minimizing reliance on extension-based defenses when handling active content:
- Normalize and canonicalize filenames:
- Normalize file extensions to a canonical case (for example, lowercasing) before saving to disk.
- Apply the same normalization logic that the web server uses to avoid case mismatches.
- Constrain dangerous file types:
- Treat HTML and other active content types (e.g.,
.html,.htm,.php,.js) as disallowed for upload by default, unless there is a compelling business need. - Prefer storing user-provided content in structured formats (e.g., database records, JSON) and render it through controlled templates rather than accepting arbitrary files.
- Serve uploads from a non-executable domain or context:
- Host uploaded files on a separate domain or subdomain without access to authenticated cookies or sensitive APIs.
- Configure that domain to serve all content with strictly neutral MIME types or
Content-Disposition: attachmentwhere appropriate.
- Harden server-side content handling:
- Ensure
.htaccessor equivalent rules treat all dangerous extensions consistently, irrespective of case. - Configure default MIME types and headers so that unexpected files do not execute as active content.
- Defense-in-depth controls:
- Implement content sanitization for any HTML-like input where rich text is required, using well-maintained sanitization libraries.
- Enforce least-privilege permissions for upload features and restrict who can upload potentially dangerous content.
How teams detect issues like this
Detection strategies for this vulnerability class focus on identifying mismatches between application-layer checks and server-layer behavior:
- Static analysis and code review:
- Look for file upload endpoints that:
- Validate extensions by string comparison without normalizing case.
- Persist user-supplied filenames directly to disk or URLs.
- Flag any reliance on extension checks as the primary or only method of preventing active content upload.
- Configuration and policy review:
- Review
.htaccess, server config, and reverse proxy rules for case-sensitive patterns or rules limited to specific casing. - Verify that all variants of dangerous extensions (e.g.,
.html,.HTML,.HtMl) are either blocked or uniformly treated as non-executable.
- Dynamic and runtime analysis:
- Perform controlled tests by uploading files with mixed-case extensions and inspecting response headers and MIME types.
- Monitor logs and analytics for requests to uploaded HTML or script-like files under user-specific paths.
- Automated tooling:
- Integrate automated security scanners that:
- Exercise upload endpoints with different content types and extension variants.
- Detect when uploaded HTML is served with
text/htmland no forced download headers.
These approaches help surface not only this specific issue but also broader patterns of unsafe file handling.

