/

CVE-2026-72572

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-22) in o1lab/xmysql Download API

CVE-2026-72572

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Disclosure

Severity:

HIGH RISK

(7.5)

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 path traversal vulnerability in o1lab/xmysql allows unauthenticated remote attackers to read or download arbitrary files from the server.

The issue becomes risky when user-controlled file names are combined with a server-side working directory without canonicalization or boundary checks.

Affected context

The vulnerability occurs in the xmysql file-download handling where the req.query.name parameter influences a path passed to res.download. Deployments are exposed when this parameter is accepted from unauthenticated requests and the resulting path is not restricted to an intended directory. The risk depends on the server process permissions and the files available within its runtime environment.

Exploit preconditions

  • Attack surface: Network-accessible file-download functionality
  • Required access: No authentication may be required
  • Trigger point: Processing of the user-controlled name query parameter
  • Why exploitation is possible: Input is joined with a server-side path without sufficient traversal filtering, canonicalization, or enforcement that the resolved path remains within the permitted directory

Why this happens

The underlying bug is improper limitation of a user-controlled path component. The application combines req.query.name with a trusted base directory using path.join but does not adequately normalize and validate the resulting path before passing it to the download response handler.

This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal. The insecure pattern treats externally supplied path data as a safe relative filename without verifying its resolved location against an approved directory boundary.

Potential impact

  • An attacker may read sensitive operating system or application files
  • An attacker may download configuration files containing credentials or secrets
  • The vulnerability could expose source code, logs, and deployment metadata
  • Disclosure of sensitive files can enable follow-on compromise of the host or connected services

General mitigation guidance

Mitigation generally focuses on reducing trust in client-supplied paths and enforcing a strict file access boundary.

Common defensive patterns include:

  • Accepting opaque file identifiers or an allowlisted set of file names instead of raw path input
  • Resolving candidate paths canonically and verifying that they remain beneath the intended directory
  • Rejecting traversal indicators and alternate path representations as a supplementary control, not the sole defense
  • Restricting downloads to a dedicated directory with minimal contents and permissions
  • Running the service with least privilege and limiting access to sensitive filesystem locations
  • Applying authentication and authorization controls to file-download functionality where feasible

How teams detect issues like this

Organizations can detect similar issues through:

  • Static analysis rules for user input flowing into filesystem APIs such as path.join, path.resolve, file reads, or download handlers
  • Code review checks for missing canonicalization and directory-boundary validation
  • Tests using varied path encodings and platform-specific path forms to verify confinement to an approved directory
  • Runtime logging and alerting for abnormal file-download requests or access outside expected directories
  • Policy enforcement requiring allowlisted file resources and authenticated access for sensitive downloads

Automated code review and software composition tools may help identify risky data flows and related file-handling patterns.

Sources

SourceLink
github.comgithub.com/o1lab/xmysql
github.comgithub.com/o1lab/xmysql/blob/master/lib/xapi.js

Frequently asked

questions

Yes. The described file-download endpoint may be reachable over the network, and exploitation does not require authentication when the endpoint is exposed without access controls.

An attacker needs network access to the affected xmysql service and the ability to submit requests to the vulnerable download functionality. They do not need an existing account if the endpoint is unauthenticated.

Treat file names as untrusted data, prefer allowlisted identifiers, and verify that every canonicalized path remains within a dedicated permitted directory before serving it.

Combine secure path-resolution helpers, strict authorization, least-privilege service accounts, dedicated storage locations, and automated tests for path-boundary violations.

Find out what's already
exploitable in your codebase.