Rust advisories / apimock
VulnerabilityRUSTSEC-2026-0276 · apimock
RUSTSEC-2026-0276: Path traversal in apimock's file-serving fallback
Short answerA security vulnerability in the apimock crate: Path traversal in apimock's file-serving fallback. No severity score was published. Fixed in 4.8.1, 5.0.0: update to a fixed version.
| Crate | apimock |
|---|---|
| Type | Vulnerability (file-disclosure) |
| Affected versions | Before 4.8.1; from 5.0.0 before 5.0.0. |
| Fixed in | 4.8.1, 5.0.0 |
| Severity | not scored CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N |
| Published | 2026-08-26 |
| Last changed | 2026-09-02 |
| Also known as | GHSA-72g6-wgrg-vhm7, RUSTSEC-2026-0277 |
What to do
- See which version you have:
cargo tree -i apimock(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p apimock. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for exampleapimock = "5.0.0") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
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.
References
- Package: crates.io/crates/apimock
- Advisory: rustsec.org/advisories/RUSTSEC-2026-0276.html
- Web: github.com/apimokka/apimock-rs/commit/a9c05fec2d36a750c30e797291a0557f230c8faf
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Up next
Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →Also worth your time
Did this answer your question?