RUSTSEC-2026-0450

Vulnerability from osv_rustsec – Published: 2026-10-30 12:00 – Updated: 2026-11-06 14:42 – Source website
VLAI
Summary
`ocipkg`: unpacking an OCI archive can write and delete files outside the local image store (path traversal)
Details

When ocipkg unpacks an OCI archive, the destination directory is derived from the image name, which ocipkg reads from the archive's own index.json (org.opencontainers.image.ref.name). That name is attacker-controlled, and ImageName::parse accepts a hostname of .., so the computed destination escapes the local image store. A "zip-slip"-style path traversal (CWE-22 / CWE-23). This is esclatable to code execution.

In Artifact::unpack (src/image/artifact.rs), the destination is image_dir(name) = data_dir().join(name.as_path()) (src/local/mod.rs:31), where the name comes from get_name_from_index (src/image/layout.rs:114-124):

let image_name = self.base.get_name()?;   // from the archive's index.json ref.name
let dest = image_dir(&image_name)?;        // data_dir().join(name.as_path()); hostname ".." escapes
if dest.exists() {
    if overwrite {
        fs::remove_dir_all(&dest)?;        // deletes a directory OUTSIDE the store
    }
}
fs::create_dir_all(&dest)?;
// ... each tar layer is then unpacked under `dest` (also outside the store)

The fix

Fixed in ocipkg 0.4.1 by PR #223. The leading reference component is validated against the org.opencontainers.image.ref.name grammar from OCI Image Specification 1.1.1 on parse and deserialization, and local::image_dir revalidates the name and rejects any non-normal path component (e.g. ..) before any filesystem mutation, so a crafted archive can no longer escape the local image store.


{
  "affected": [
    {
      "database_specific": {
        "categories": [
          "code-execution"
        ],
        "cvss": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H",
        "informational": null
      },
      "ecosystem_specific": {
        "affected_functions": null,
        "affects": {
          "arch": [],
          "functions": [
            "ocipkg::image::load"
          ],
          "os": []
        }
      },
      "package": {
        "ecosystem": "crates.io",
        "name": "ocipkg",
        "purl": "pkg:cargo/ocipkg"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0.0.0-0"
            },
            {
              "fixed": "0.4.1"
            }
          ],
          "type": "SEMVER"
        }
      ],
      "versions": []
    }
  ],
  "aliases": [],
  "database_specific": {
    "license": "CC0-1.0"
  },
  "details": "When `ocipkg` unpacks an OCI archive, the destination directory is derived from the\nimage name, which `ocipkg` reads from the archive\u0027s **own** `index.json`\n(`org.opencontainers.image.ref.name`). That name is attacker-controlled, and\n`ImageName::parse` accepts a hostname of `..`, so the computed destination escapes the\nlocal image store. A \"zip-slip\"-style path traversal (CWE-22 / CWE-23). This is esclatable to code execution.\n\nIn `Artifact::unpack` (`src/image/artifact.rs`), the destination is\n`image_dir(name) = data_dir().join(name.as_path())` (`src/local/mod.rs:31`), where the\nname comes from `get_name_from_index` (`src/image/layout.rs:114-124`):\n\n```rust\nlet image_name = self.base.get_name()?;   // from the archive\u0027s index.json ref.name\nlet dest = image_dir(\u0026image_name)?;        // data_dir().join(name.as_path()); hostname \"..\" escapes\nif dest.exists() {\n    if overwrite {\n        fs::remove_dir_all(\u0026dest)?;        // deletes a directory OUTSIDE the store\n    }\n}\nfs::create_dir_all(\u0026dest)?;\n// ... each tar layer is then unpacked under `dest` (also outside the store)\n```\n\n## The fix\n\nFixed in `ocipkg` 0.4.1 by [PR #223](https://github.com/termoshtt/ocipkg/pull/223). The leading\nreference component is validated against the `org.opencontainers.image.ref.name` grammar from OCI\nImage Specification 1.1.1 on parse and deserialization, and `local::image_dir` revalidates the name\nand rejects any non-normal path component (e.g. `..`) before any filesystem mutation, so a crafted\narchive can no longer escape the local image store.",
  "id": "RUSTSEC-2026-0450",
  "modified": "2026-11-06T14:42:53Z",
  "published": "2026-10-30T12:00:00Z",
  "references": [
    {
      "type": "PACKAGE",
      "url": "https://crates.io/crates/ocipkg"
    },
    {
      "type": "ADVISORY",
      "url": "https://rustsec.org/advisories/RUSTSEC-2026-0450.html"
    },
    {
      "type": "REPORT",
      "url": "https://github.com/termoshtt/ocipkg/issues/222"
    },
    {
      "type": "WEB",
      "url": "https://github.com/termoshtt/ocipkg/pull/223"
    }
  ],
  "related": [],
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "`ocipkg`: unpacking an OCI archive can write and delete files outside the local image store (path traversal)"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.