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
fileNameparameter 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 asos.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.

