GHSA-3pv8-6f4r-ffg2: Tar Tar Has A PAX Header Vulnerability

MODERATE
CWE-843 CWE-20
Published
Advisory Summary

GHSA-3pv8-6f4r-ffg2 is a MODERATE tar has a pax header vulnerability (CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')) affecting Tar libraries in the crates.io ecosystem. The issue involves tar has a pax header desynchronization issue. Remediation is available by upgrading affected packages to version 0.4.46.

GHSA-3pv8-6f4r-ffg2 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-3pv8-6f4r-ffg2
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')
Affected Product Tar
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-3pv8-6f4r-ffg2

To remediate this vulnerability, upgrade all affected Tar dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

tar fixed: 0.4.46
Upgrade tar to 0.4.46
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for tar

How to Check if You Are Affected

To determine whether your application is affected by GHSA-3pv8-6f4r-ffg2, inspect your project dependencies for Tar:

inspect dependencies for tar

Analyze the terminal output to locate any version of Tar in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.4.46), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion'), where the product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type. In Tar, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary When a tar stream contains multiple "header" entries prior to a file entry, tar-rs applies the PAX header (`x`) to the _next_ entry in the stream, regardless of type. For example, a stream of `x -> L -> file` (PAX, GNU longname, file) would result in `x`'s extensions being applied to `L` rather than to `file`. [Per POSIX pax](https://pubs.opengroup.org/onlinepubs/9799919799/utilities/pax.html), this is incorrect: a PAX header always applies to a file entry, not any intermediary entries. See the "pax Header Block" section for the specific prescription there. As a result of this, an attacker can contrive a tar containing a sequence of tar headers such that tar-rs applies the PAX header's `size` extension to the next header in sequence, effectively desynchronizing the stream and enabling tar-rs specific skippage/extraction of members. In other words, a file can be contrived to extract differently on tar-rs than on other tar parsers. ### PoC [This tar](https://github.com/user-attachments/files/27141941/pax-overrides-extension-header.tar.zip) (zipped for size) demonstrates the desynchronization: with `tar tvf`: ``` % tar tvf tests/archives/pax-overrides-extension-header.tar ---------- 0 0 0 2048 Dec 31 1969 longname.txt ---------- 0 0 0 0 Dec 31 1969 file_b ``` with `tar-rs`: ``` ---- pax_size_does_not_apply_to_extension_headers stdout ---- thread 'pax_size_does_not_apply_to_extension_headers' (250476889) panicked at tests/all.rs:2121:27: called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "numeric field was not a number: AAAAAAAA when getting cksum for AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" } note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` In the above case, the PoC is not weaponized, so it jumps into the middle of an entry and subsequently fails the checksum test rather than silently continuing with attacker-controlled archive state. ### Impact This is very similar to GHSA-j5gw-2vrg-8fgx and GHSA-fp55-jw48-c537 in impact -- an attacker can use this to extract (or not extract) files from a tar stream depending on the tar parser used, which in turn can be used to obscure the presence of malicious files.

GHSA-3pv8-6f4r-ffg2 Affected Tar Versions

1 component(s)
Fixed Versions:
0.4.46
Product / Package Ecosystem Affected Versions Fixed Version
tar
crates.io
< 0.4.46
0.4.46

References

Frequently Asked Questions

What is GHSA-3pv8-6f4r-ffg2?
GHSA-3pv8-6f4r-ffg2 is a security vulnerability in Tar involving tar has a PAX header desynchronization issue under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion').
Which Tar versions are affected?
Affected versions include releases prior to 0.4.46 across affected packages: tar.
What version fixes GHSA-3pv8-6f4r-ffg2?
Upgrading to 0.4.46 (or the latest patched release for your respective branch) resolves the vulnerability.
Is tar affected?
Yes, tar is affected in releases prior to 0.4.46. Upgrade your dependency to 0.4.46 or later.
What CWE is associated with GHSA-3pv8-6f4r-ffg2?
GHSA-3pv8-6f4r-ffg2 is classified under CWE-843: Access of Resource Using Incompatible Type ('Type Confusion') (The product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type.).
How can I check crates.io dependencies for GHSA-3pv8-6f4r-ffg2?
Run the dependency tree command: 'inspect dependencies for tar'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-3pv8-6f4r-ffg2",
  "modified" : "2026-05-29T19:16:12Z",
  "published" : "2026-05-29T19:16:12Z",
  "aliases" : [ ],
  "summary" : "tar has a PAX header desynchronization issue",
  "details" : "### Summary\n\nWhen a tar stream contains multiple \"header\" entries prior to a file entry, tar-rs applies the PAX header (`x`) to the _next_ entry in the stream, regardless of type. For example, a stream of `x -> L -> file` (PAX, GNU longname, file) would result in `x`'s extensions being applied to `L` rather than to `file`.\n\n[Per POSIX pax](https://pubs.opengroup.org/onlinepubs/9799919799/utilities/pax.html), this is incorrect: a PAX header always applies to a file entry, not any intermediary entries. See the \"pax Header Block\" section for the specific prescription there.\n\nAs a result of this, an attacker can contrive a tar containing a sequence of tar headers such that tar-rs applies the PAX header's `size` extension to the next header in sequence, effectively desynchronizing the stream and enabling tar-rs specific skippage/extraction of members. In other words, a file can be contrived to extract differently on tar-rs than on other tar parsers.\n\n### PoC\n\n[This tar](https://github.com/user-attachments/files/27141941/pax-overrides-extension-header.tar.zip) (zipped for size) demonstrates the desynchronization: with `tar tvf`:\n\n```\n% tar tvf tests/archives/pax-overrides-extension-header.tar \n----------  0 0      0        2048 Dec 31  1969 longname.txt\n----------  0 0      0           0 Dec 31  1969 file_b\n```\n\nwith `tar-rs`:\n\n```\n---- pax_size_does_not_apply_to_extension_headers stdout ----\n\nthread 'pax_size_does_not_apply_to_extension_headers' (250476889) panicked at tests/all.rs:2121:27:\ncalled `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: \"numeric field was not a number: AAAAAAAA when getting cksum for AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" }\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n```\n\nIn the above case, the PoC is not weaponized, so it jumps into the middle of an entry and subsequently fails the checksum test rather than silently continuing with attacker-controlled archive state.\n\n### Impact\n\nThis is very similar to GHSA-j5gw-2vrg-8fgx and GHSA-fp55-jw48-c537 in impact -- an attacker can use this to extract (or not extract) files from a tar stream depending on the tar parser used, which in turn can be used to obscure the presence of malicious files.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "tar"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.4.46"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.4.45"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/composefs/tar-rs/security/advisories/GHSA-3pv8-6f4r-ffg2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composefs/tar-rs/pull/454"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composefs/tar-rs/commit/bab14dd84b411ac16ecb56d4f2d2f7bfb88a9838"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/composefs/tar-rs"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composefs/tar-rs/releases/tag/0.4.46"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-843" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-29T19:16:12Z",
    "nvd_published_at" : null
  }
}