/

CVE-2026-28289

Severity:

CRITICAL RISK

(10.0)

Unrestricted File Upload in FreeScout

CVE-2026-28289

Analyzed

Vulnerability type

Category:

Unrestricted File Upload

CWE:

CWE-434

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(10.0)

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

A Time-of-Check to Time-of-Use (TOCTOU) flaw in FreeScout's file name sanitization allows attackers to bypass protections against dangerous uploads by abusing zero-width space characters.

Any authenticated user with file upload permissions can upload a malicious .htaccess file that is incorrectly accepted and interpreted by the web server, leading to remote code execution on the underlying server.

Affected context

The vulnerability occurs in FreeScout installations that:

  • Run versions 1.8.206 or earlier
  • Allow authenticated users to upload files (e.g., attachments, assets, or content)
  • Rely on the sanitizeUploadedFileName() helper in app/Http/Helper.php to prevent dangerous filenames

The risk appears when Apache or another web server honors .htaccess directives in upload-accessible directories, allowing an uploaded .htaccess file with executable configuration to influence request handling.

Exploit preconditions

  • Attack surface: Web application endpoints that accept file uploads (e.g., ticket attachments, media uploads).
  • Required access: Valid authenticated account with any role that grants file upload permissions; no administrative privileges are strictly required if upload is allowed.
  • Trigger point: Uploading a file whose name is crafted with a zero-width space or other invisible character before .htaccess, causing the pre-sanitization prefix check to pass while the post-sanitization result becomes an effective .htaccess file.
  • Why exploitation is possible: The filename is validated before sanitization strips invisible characters. This TOCTOU sequence allows an attacker to submit a name that passes the dot-prefix check initially, but transforms into a disallowed name after sanitization, with the system still treating it as safe.

Why this happens

The bug stems from a mismatch between the validation logic and the final value that is actually written to disk.

In sanitizeUploadedFileName(), FreeScout checks for dangerous dot-prefixed filenames (such as .htaccess) before it removes invisible characters like zero-width spaces from the filename.

Because the security-critical check operates on a different representation of the data than the one ultimately used, an attacker can insert zero-width characters to evade the initial check.

After the check, sanitization strips those characters, effectively converting the filename into a protected pattern, such as .htaccess, which is then written to disk.

This behavior maps to CWE-434: Unrestricted Upload of File with Dangerous Type, enabled by a TOCTOU-style validation flaw where filtering and enforcement are not applied atomically to the final value.

Potential impact

  • Upload of a malicious .htaccess file that can alter web server behavior
  • Remote code execution through server-side configuration and script execution
  • Access to or exfiltration of sensitive data handled by the application
  • Privilege escalation within the hosting environment if web server directives allow it
  • Service disruption, defacement, or use of the server as a pivot for further attacks

General mitigation guidance

Effective mitigation focuses on making file validation consistent, conservative, and independent of filename tricks:

  • Perform all sanitization, normalization, and stripping of invisible or special characters before any security checks on filenames or extensions.
  • Enforce a strict allowlist of safe file extensions and MIME types, rejecting anything that does not match known-safe patterns.
  • Prohibit dot-prefixed filenames entirely for user-controlled uploads, or rewrite them to a neutral pattern that cannot affect server behavior.
  • Store uploaded files outside the web root or in locations where .htaccess and similar configuration files are not interpreted by the web server.
  • Configure the web server to ignore .htaccess files in upload directories or disable per-directory overrides where possible.
  • Apply least-privilege file system permissions so that the application cannot overwrite server configuration or executable locations.

How teams detect issues like this

Detection typically involves both code-centric and operational approaches:

  • Static analysis: Look for file upload handling code where:
  • Filenames are modified (e.g., sanitized, normalized) after validation checks.
  • Checks for dangerous prefixes or extensions are performed before transformations that may alter those values.
  • Code review red flags:
  • Multiple stages of filename handling where security checks and final writes are separated.
  • Reliance on blacklists (e.g., "block .htaccess") instead of extension allowlists.
  • Use of character-stripping routines (including invisible/Unicode characters) after access-control or policy validation has occurred.
  • Runtime and operational monitoring:
  • Monitor upload directories for new .htaccess or other configuration-like files appearing at runtime.
  • Use file integrity monitoring to detect unexpected changes in web-accessible directories.
  • Log and alert on uploads with unusual Unicode or zero-width characters in filenames.
  • Automated SAST or custom linters can be configured to flag TOCTOU patterns in upload handlers and mismatches between validation and use of sanitized inputs.

Sources

SourceLink
github.comgithub.com/freescout-help-desk/freescout/commit/f7bc16c56a6b13c06da52ad51fd666546b40818f
github.comgithub.com/freescout-help-desk/freescout/security/advisories/GHSA-5gpc-65p8-ffwp
ox.securityox.security/blog/freescout-rce-cve-2026-28289/

Frequently asked

questions

Yes. Any user who can reach the FreeScout web interface and authenticate with a role that permits file uploads can exploit this issue by uploading a specially named malicious file, without requiring direct server access.

No. Administrator privileges are not strictly required. The core prerequisite is an authenticated account with file upload permissions, which may include lower-privileged roles if they are allowed to attach or upload files.

The most robust pattern is to normalize and sanitize filenames first, then perform security checks on that final, canonical value, and finally use that exact value when writing to disk. Combine this with a strict extension allowlist, storage outside the web root, and a policy that forbids any user-supplied configuration-like files.

Design upload pipelines so that each step operates on a single, canonical representation of user input:

  • Strip or normalize Unicode and invisible characters early.
  • Apply validation and policy decisions only after normalization.
  • Use positive security models (allowlists) for extensions and MIME types.
  • Architect deployments so that uploaded files cannot be interpreted as code or configuration, even if validation fails.
Find out what's already
exploitable in your codebase.