GHSA-72g6-wgrg-vhm7
JSON

Not scored

Path traversal in apimock's file-serving fallback

Severity
Not scored
Published
Last changed
Also known as
RUSTSEC-2026-0276RUSTSEC-2026-0277

Description

The file-serving fallback joined a request-derived path onto the configured response directory and checked only that the result existed, never that it stayed inside that directory. A request containing a raw .. segment could read any file readable by the process, returned with HTTP 200.

Read-only: no write, no code execution.

On the 4.x line apimock is a single crate containing the serving code. Fixed in 4.8.1 by canonicalising each resolved path and rejecting anything outside its base directory.

apimock 5.0.0 and later are not affected by this advisory. From 5.0.0 the serving code moved to the apimock-server crate, which apimock depends on; that crate carries its own advisory for the same issue, fixed in 5.19.1.

Affected

Product or packageVersionsReported by
apimock (crates.io)from 0.0.0-0 before 4.8.1, from 5.0.0 before 5.0.0RustSec Advisory Database
apimock-server (crates.io)from 0.0.0-0 before 5.19.1RustSec Advisory Database

What each source says

RustSec Advisory Database

The file-serving fallback joined a request-derived path onto the configured response directory and checked only that the result existed, never that it stayed inside that directory. A request containing a raw .. segment could read any file readable by the process, returned with HTTP 200.

Read-only: no write, no code execution.

On the 4.x line apimock is a single crate containing the serving code. Fixed in 4.8.1 by canonicalising each resolved path and rejecting anything outside its base directory.

apimock 5.0.0 and later are not affected by this advisory. From 5.0.0 the serving code moved to the apimock-server crate, which apimock depends on; that crate carries its own advisory for the same issue, fixed in 5.19.1.

RustSec Advisory Database

The file-serving fallback joined a request-derived path onto the configured response directory and checked only that the result existed, never that it stayed inside that directory. A request containing a raw .. segment could read any file readable by the process, returned with HTTP 200.

Read-only: no write, no code execution.

Exposure depends on the bind address. The default is 127.0.0.1; deployments binding 0.0.0.0 or a LAN address are reachable from the network. Most HTTP clients normalise .. away before sending, so reaching it requires a client that does not.

All published versions before 5.19.1 are affected. Fixed in 5.19.1 by canonicalising each resolved path and rejecting anything outside its base directory.

This advisory also covers apimock 5.x, which depends on apimock-server. apimock 4.x predates the crate split and carries its own advisory for the same issue, fixed in 4.8.1.

References

Sources

SourceRecordLicence
RustSec Advisory DatabaseRUSTSEC-2026-0276 changed 2026-09-02CC0-1.0
RustSec Advisory DatabaseRUSTSEC-2026-0277 changed 2026-09-02CC0-1.0