Vulnerabilities in pkg:pypi/pydicom

PACKAGE
Advisory Identifier: GHSA-v856-2rf8-9f28
Advisory Summary

CVE-2026-32711 is a HIGH (CVSS 7.8) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Pydicom libraries in the PyPI ecosystem. The issue involves pydicom has a path traversal in fileset/dicomdir referencedfileid allows file access outside the file-set root. Remediation is available by upgrading affected packages to version 3.0.2, 2.4.5.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/pydicom

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/pydicom. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-v856-2rf8-9f28 CVE-2026-32711 HIGH pydicom has a path traversal in FileSet/DICOMDIR ReferencedFileID allows file access outside the File-set root

CVE-2026-32711 at a Glance

CVE Identifier CVE-2026-32711
GHSA Identifier GHSA-v856-2rf8-9f28
Severity HIGH
CVSS v3.1 Base Score 7.8
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Pydicom
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-32711

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

pydicom fixed: 3.0.2
pip install pydicom>=3.0.2
pydicom fixed: 2.4.5
pip install pydicom>=2.4.5
Verify Direct and Transitive Dependencies

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

pip show pydicom

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-32711, inspect your installed packages using pip:

pip show pydicom

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

Note: The pip show pydicom command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Pydicom, 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 A crafted `DICOMDIR` can set `ReferencedFileID` to a path outside the File-set root. `pydicom` resolves the path only to confirm that it exists, but does not verify that the resolved path remains under the File-set root. Subsequent public `FileSet` operations such as `copy()`, `write()`, and `remove()+write(use_existing=True)` use that unchecked path in file I/O operations. This allows arbitrary file read/copy and, in some flows, move/delete outside the File-set root. ### Details Verified on `pydicom 3.1.0.dev0`. Relevant logic is in `src/pydicom/fileset.py`: - `RecordNode._file_id` converts `ReferencedFileID` directly to `Path(...)` - `FileSet.load()` checks only `(root / file_id).resolve(strict=True)` to confirm existence - `FileSet.load()` does not verify that the final resolved path is contained within the File-set root - `FileInstance.path` returns `self.file_set.path / self.node._file_id` - `FileSet.copy()` uses `shutil.copyfile(instance.path, dst)` - `FileSet.write()` uses `Path(instance.path).unlink()` and `shutil.move(...)` Because there is no containment check such as `resolved.relative_to(root.resolve(strict=True))`, a malicious `DICOMDIR` can reference: - absolute paths such as `/etc/passwd` - traversal paths such as `../...` - syntactically conformant file IDs that escape via symlinks This is not limited to obviously invalid VR input. Even when `pydicom` emits warnings for invalid `ReferencedFileID` values, the operation is not blocked. I also confirmed a symlink-based variant using a conformant file ID. A realistic server-side scenario is: 1. a user uploads a DICOM File-set zip 2. the server loads the uploaded `DICOMDIR` using `FileSet` 3. the server re-exports or reorganizes the File-set using `FileSet.copy()` or `FileSet.write()` 4. a server-local file referenced by the malicious `DICOMDIR` is included in the exported result ### PoC Minimal reproduction: 1. Copy a sample File-set that contains a valid `DICOMDIR` 2. Modify one `DirectoryRecordSequence` item so that `ReferencedFileID = "/etc/passwd"` (or `/tmp/secret.txt`) 3. Load it with `FileSet(ds)` or `FileSet(path_to_dicomdir)` 4. Call `FileSet.copy(new_root)` 5. Observe that the exported File-set contains the contents of the referenced external file Example: ```python from pathlib import Path from tempfile import mkdtemp import shutil from pydicom import dcmread from pydicom.fileset import FileSet base = Path("src/pydicom/data/test_files/dicomdirtests") root = Path(mkdtemp(prefix="fsroot_")) out = Path(mkdtemp(prefix="fsout_")) shutil.copy2(base / "DICOMDIR", root / "DICOMDIR") for d in ("77654033", "98892003", "98892001"): shutil.copytree(base / d, root / d) ds = dcmread(root / "DICOMDIR") item = next(x for x in ds.DirectoryRecordSequence if "ReferencedFileID" in x) item.ReferencedFileID = "/etc/passwd" fs = FileSet(ds) fs.copy(out) ``` I also verified the issue in a simple web import/export demo where an uploaded malicious File-set caused /etc/passwd to be copied into the exported result. If useful, I can provide the exact malicious sample and the demo environment separately. ### Impact This is a path traversal / root containment bypass in FileSet handling. Observed impact: arbitrary file read/copy outside the File-set root via FileSet.copy() arbitrary file move outside the File-set root via FileSet.write() arbitrary file delete outside the File-set root via FileSet.remove(...); write(use_existing=True) Affected applications are those that accept untrusted DICOMDIR / File-set input and then call public FileSet workflows such as load(), copy(), write(), or remove(). A realistic impact is server-side file disclosure in import/export workflows.

CVE-2026-32711 Affected Pydicom Versions

2 component(s)
Fixed Versions:
3.0.22.4.5
Product / Package Ecosystem Affected Versions Fixed Version
pydicom
PyPI
≥ 3.0.0
< 3.0.2
3.0.2
pydicom
PyPI
< 2.4.5
2.4.5

References

Frequently Asked Questions

What is CVE-2026-32711?
CVE-2026-32711 is a security vulnerability in Pydicom involving pydicom has a path traversal in FileSet/DICOMDIR ReferencedFileID allows file access outside the File-set root under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Pydicom versions are affected?
Affected versions include releases prior to 3.0.2, 2.4.5 across affected packages: pydicom.
What version fixes CVE-2026-32711?
Upgrading to 3.0.2, 2.4.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pydicom affected?
Yes, pydicom is affected in releases prior to 3.0.2, 2.4.5. Upgrade your dependency to 3.0.2, 2.4.5 or later.
What is the CVSS score of CVE-2026-32711?
CVE-2026-32711 has a CVSS v3.1 base score of 7.8 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-32711?
CVE-2026-32711 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check PyPI dependencies for CVE-2026-32711?
Run the dependency tree command: 'pip show pydicom'. 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-v856-2rf8-9f28",
  "modified" : "2026-03-20T15:57:01Z",
  "published" : "2026-03-20T15:57:01Z",
  "aliases" : [ "CVE-2026-32711" ],
  "summary" : "pydicom has a path traversal in FileSet/DICOMDIR ReferencedFileID allows file access outside the File-set root",
  "details" : "### Summary\nA crafted `DICOMDIR` can set `ReferencedFileID` to a path outside the File-set root. `pydicom` resolves the path only to confirm that it exists, but does not verify that the resolved path remains under the File-set root. Subsequent public `FileSet` operations such as `copy()`, `write()`, and `remove()+write(use_existing=True)` use that unchecked path in file I/O operations. This allows arbitrary file read/copy and, in some flows, move/delete outside the File-set root.\n\n### Details\nVerified on `pydicom 3.1.0.dev0`.\n\nRelevant logic is in `src/pydicom/fileset.py`:\n\n- `RecordNode._file_id` converts `ReferencedFileID` directly to `Path(...)`\n- `FileSet.load()` checks only `(root / file_id).resolve(strict=True)` to confirm existence\n- `FileSet.load()` does not verify that the final resolved path is contained within the File-set root\n- `FileInstance.path` returns `self.file_set.path / self.node._file_id`\n- `FileSet.copy()` uses `shutil.copyfile(instance.path, dst)`\n- `FileSet.write()` uses `Path(instance.path).unlink()` and `shutil.move(...)`\n\nBecause there is no containment check such as `resolved.relative_to(root.resolve(strict=True))`, a malicious `DICOMDIR` can reference:\n\n- absolute paths such as `/etc/passwd`\n- traversal paths such as `../...`\n- syntactically conformant file IDs that escape via symlinks\n\nThis is not limited to obviously invalid VR input. Even when `pydicom` emits warnings for invalid `ReferencedFileID` values, the operation is not blocked. I also confirmed a symlink-based variant using a conformant file ID.\n\nA realistic server-side scenario is:\n\n1. a user uploads a DICOM File-set zip\n2. the server loads the uploaded `DICOMDIR` using `FileSet`\n3. the server re-exports or reorganizes the File-set using `FileSet.copy()` or `FileSet.write()`\n4. a server-local file referenced by the malicious `DICOMDIR` is included in the exported result\n\n### PoC\nMinimal reproduction:\n\n1. Copy a sample File-set that contains a valid `DICOMDIR`\n2. Modify one `DirectoryRecordSequence` item so that `ReferencedFileID = \"/etc/passwd\"` (or `/tmp/secret.txt`)\n3. Load it with `FileSet(ds)` or `FileSet(path_to_dicomdir)`\n4. Call `FileSet.copy(new_root)`\n5. Observe that the exported File-set contains the contents of the referenced external file\n\nExample:\n\n```python\nfrom pathlib import Path\nfrom tempfile import mkdtemp\nimport shutil\nfrom pydicom import dcmread\nfrom pydicom.fileset import FileSet\n\nbase = Path(\"src/pydicom/data/test_files/dicomdirtests\")\nroot = Path(mkdtemp(prefix=\"fsroot_\"))\nout = Path(mkdtemp(prefix=\"fsout_\"))\n\nshutil.copy2(base / \"DICOMDIR\", root / \"DICOMDIR\")\nfor d in (\"77654033\", \"98892003\", \"98892001\"):\n    shutil.copytree(base / d, root / d)\n\nds = dcmread(root / \"DICOMDIR\")\nitem = next(x for x in ds.DirectoryRecordSequence if \"ReferencedFileID\" in x)\nitem.ReferencedFileID = \"/etc/passwd\"\n\nfs = FileSet(ds)\nfs.copy(out)\n```\n\nI also verified the issue in a simple web import/export demo where an uploaded malicious File-set caused /etc/passwd to be copied into the exported result.\n\nIf useful, I can provide the exact malicious sample and the demo environment separately.\n\n### Impact\nThis is a path traversal / root containment bypass in FileSet handling.\n\nObserved impact:\n\narbitrary file read/copy outside the File-set root via FileSet.copy()\narbitrary file move outside the File-set root via FileSet.write()\narbitrary file delete outside the File-set root via FileSet.remove(...); write(use_existing=True)\nAffected applications are those that accept untrusted DICOMDIR / File-set input and then call public FileSet workflows such as load(), copy(), write(), or remove().\n\nA realistic impact is server-side file disclosure in import/export workflows.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pydicom"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.0.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 3.0.1"
    }
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pydicom"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.4.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/pydicom/pydicom/security/advisories/GHSA-v856-2rf8-9f28"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-32711"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pydicom/pydicom/commit/6414f01a053dff925578799f5a7208d2ae585e82"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pydicom/pydicom"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pydicom/pydicom/releases/tag/v3.0.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-20T15:57:01Z",
    "nvd_published_at" : "2026-03-20T02:16:33Z"
  }
}