/

CVE-2026-46392

Severity:

HIGH RISK

(8.7)

Case-Sensitive Content-Type Bypass (CWE-178) Enabling HTML Upload in HAX CMS

CVE-2026-46392

Deferred

Vulnerability type

Category:

Content-Type Validation and File Upload Handling

CWE:

CWE-178, CWE-434

Impact:

Stored Cross-Site Scripting via Malicious HTML Upload

Severity:

HIGH RISK

(8.7)

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

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 saveFile endpoint or similar upload functionality to end users or contributors
  • Rely on .htaccess rules to enforce download-only behavior for HTML content
  • Run under web servers where .htaccess rules 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 saveFile upload 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 .htaccess rule that enforces Content-Disposition: attachment is 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: attachment where appropriate.
  • Harden server-side content handling:
  • Ensure .htaccess or 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/html and no forced download headers.

These approaches help surface not only this specific issue but also broader patterns of unsafe file handling.

Sources

SourceLink
github.comgithub.com/haxtheweb/issues/security/advisories/GHSA-hg33-w4j2-95qp

Frequently asked

questions

Exploitability depends on who can access the upload functionality. If untrusted or semi-trusted users (such as content contributors or students) can upload files through the saveFile endpoint, an attacker can typically exploit this reliably by uploading HTML with mixed-case extensions and embedding malicious JavaScript.

An attacker needs the ability to upload files via the affected endpoint. This is often tied to an authenticated role with content creation privileges, but in some deployments misconfigurations may expose uploads more broadly. No direct server-side code execution is required; the attack executes in victims' browsers when they load the malicious page.

The safest pattern is to treat HTML and other executable formats as untrusted and either disallow their upload entirely or serve them from an isolated domain where they cannot access sensitive cookies or APIs. Additionally, normalize file extensions and ensure server rules (like .htaccess) treat all case variants of dangerous extensions consistently.

Prevention relies on a combination of design and implementation practices:

  • Avoid relying solely on file extensions for security decisions; consider MIME type validation and content inspection where appropriate.
  • Normalize filenames and apply consistent policies across application logic and server configuration.
  • Isolate user uploads in non-executable contexts and domains.
  • Incorporate security-focused code review and automated tests specifically targeting file upload and content serving paths.
Find out what's already
exploitable in your codebase.