/

CVE-2026-22786

Severity:

HIGH RISK

(7.2)

Path Traversal File Upload in Gin-vue-admin Breakpoint

CVE-2026-22786

Analyzed

Vulnerability type

Category:

Path Traversal File Upload

CWE:

CWE-22, CWE-434

Impact:

Arbitrary File Write on Server Filesystem

Severity:

HIGH RISK

(7.2)

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

Gin-vue-admin's breakpoint resume upload endpoint concatenates user-supplied filenames directly into a filesystem path without sanitization, enabling path traversal.

An authenticated attacker with file upload privileges can leverage this to write arbitrary files to arbitrary directories on the server, potentially leading to configuration tampering, webshell placement, or privilege escalation depending on the environment.

Affected context

This vulnerability occurs in Gin-vue-admin's /fileUploadAndDownload/breakpointContinueFinish API, specifically in the MakeFile function within breakpoint_continue.go.

The application assumes the fileName parameter is safe and simply appends it to a base directory (./fileDir/) before calling os.OpenFile().

In deployments where users (including low-privileged or partner accounts) have file upload rights, malicious filenames containing directory traversal sequences can escape the intended upload directory and target sensitive locations on the host filesystem.

Exploit preconditions

  • Attack surface: HTTP(S) API endpoint /fileUploadAndDownload/breakpointContinueFinish
  • Required access: Valid account or context with permission to use the breakpoint resume upload feature (file upload privileges)
  • Trigger point: Supplying a crafted fileName parameter containing directory traversal sequences (e.g., ../) during a breakpoint-continue upload request
  • Why exploitation is possible: The server performs no normalization, sanitization, or allowlist checks on fileName, and directly concatenates it to ./fileDir/ before opening the file path for writing, allowing traversal outside the intended directory and arbitrary file creation/overwrite

Why this happens

The underlying issue is a combination of directory traversal and unrestricted file upload semantics.

The MakeFile function trusts a client-controlled fileName and builds a filesystem path using string concatenation, without:

  • Normalizing the path
  • Rejecting .. or absolute path prefixes
  • Restricting output to a canonical upload directory

This maps to CWE-22: Path Traversal because user input determines which directory is accessed, and CWE-434: Unrestricted Upload of File with Dangerous Type because the system permits upload of arbitrary file types and locations without enforcing safe destinations or extensions.

Conceptually, the bug arises from treating a user-supplied filename as a safe path component instead of untrusted input that must be constrained to a controlled upload area.

Potential impact

  • Creation or overwriting of arbitrary files on the server filesystem within the permissions of the application process
  • Upload of executable scripts (e.g., webshells) into web-accessible directories, which can lead to remote code execution
  • Tampering with application configuration files, logs, or data files, potentially causing denial-of-service or privilege escalation
  • Planting backdoors or altering deployment artifacts to facilitate later compromise
  • Bypassing intended storage quotas or isolation boundaries for user uploads

General mitigation guidance

Effective mitigation focuses on constraining file paths, validating filenames, and treating all upload parameters as untrusted:

  • Enforce a strict upload root: Resolve and canonicalize the target path, then verify it remains within an intended upload directory before writing any data.
  • Normalize and validate filenames: Strip or reject .., leading slashes, drive letters, and other traversal indicators; disallow absolute paths and control characters.
  • Use an allowlist-based naming scheme: Generate server-side filenames (e.g., UUIDs or hashes) instead of trusting client-provided names, while storing the original name only as metadata.
  • Restrict file types and locations: Enforce extension allowlists and ensure uploaded files are stored outside executable or web-served directories by default.
  • Harden file permissions: Run the application under a least-privilege account with minimal filesystem write access and no ability to modify configuration or code directories.
  • Apply defense-in-depth checks: Validate upload requests at both the API layer (e.g., binding/validation middleware) and the filesystem abstraction layer.

How teams detect issues like this

Organizations can detect and monitor for this class of vulnerability using a combination of code-centered and operational approaches:

  • Static code analysis: Search for patterns where user-controlled input (e.g., request parameters like fileName) is directly concatenated into file paths and passed to filesystem APIs such as os.OpenFile, os.Create, or equivalents.
  • Code review signals: Flag any upload handler that uses client-supplied filenames or paths without normalization and canonical path checks; ensure reviewers look for ../, absolute paths, or missing validation logic.
  • Security testing: Include path traversal tests in API fuzzing and integration tests, sending crafted filenames with traversal sequences and verifying that writes cannot escape the intended upload directory.
  • Runtime monitoring: Monitor logs and filesystem activity for suspicious upload patterns, such as filenames containing .., unexpected absolute paths, or writes into configuration, binary, or webroot directories.
  • Automated tooling: Integrate SAST/DAST scanners that have specific rules for directory traversal and file upload handling into CI/CD pipelines to detect regressions early.

Sources

SourceLink
github.comgithub.com/flipped-aurora/gin-vue-admin/commit/2242f5d6e133e96d1b359ac019bf54fa0e975dd5
github.comgithub.com/flipped-aurora/gin-vue-admin/security/advisories/GHSA-3558-j79f-vvm6

Frequently asked

questions

Yes. Any user or service that can reach the /fileUploadAndDownload/breakpointContinueFinish endpoint and has upload privileges can attempt to exploit the vulnerability by supplying crafted filenames, even if they do not have shell access to the server.

Typically, yes. The attacker must have sufficient permissions to use the breakpoint resume upload functionality.

However, if upload capabilities are broadly granted or exposed via chained vulnerabilities (e.g., broken access control), the practical barrier to exploitation can be low.

Use server-generated filenames and treat the upload directory as a fixed, canonical root.

Normalize and validate any remaining path components, reject traversal sequences and absolute paths, and enforce type and location constraints so that user-controlled data can never influence where on the filesystem a file is written.

Establish a reusable file-storage abstraction that:

  • Accepts only logical identifiers or sanitized filenames
  • Resolves and validates paths against a known-safe root
  • Prohibits mixing raw user input with filesystem paths

Combine this with secure coding guidelines, mandatory code review checks for file handling, and automated scanning rules specific to path concatenation and upload endpoints.

Find out what's already
exploitable in your codebase.