GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tarfile: Windows same-drive drive-relative symlink not caught by data filter · Issue #161323 · python/cpython

tarfile: Windows same-drive drive-relative symlink not caught by data filter #161323

New issue
Copy link
New issue
Copy link
Open
Open
tarfile: Windows same-drive drive-relative symlink not caught by data filter#161323
Copy link
Assignees
gpshead
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixesOS-windowsrelease-blockerstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-securityA security issueA security issue

Description

@gpshead
gpshead
opened on Nov 4, 2026
Issue body actions

Bug report

On Windows, a member name or link target with a drive but no root, such as C:foo, is not absolute, so the 'tar' and 'data' extraction filters let it through. Their containment check joins it onto the resolved destination, which has the same drive, so it looks contained. Extraction then joins the name onto the destination as given: with extractall("out"), os.path.join("out", "C:foo") is "C:foo", a file in the current directory of drive C:. A symlink to C:foo passes the 'data' filter the same way and is resolved against that directory too. x/../C:foo and ./C:foo become C:foo through the filter's own normalization.

This runs the filters with Windows path handling on any OS:

import ntpath, os, tarfile
os.path = ntpath
os.getcwd = lambda: r'C:\work'
for name in 'C:evil.txt', 'x/../C:evil.txt':
    member = tarfile.data_filter(tarfile.TarInfo(name), 'out')
    print(repr(name), '->', ntpath.abspath(ntpath.join('out', member.name)))
link = tarfile.TarInfo('link')
link.type = tarfile.SYMTYPE
link.linkname = './C:evil.txt'
print('symlink ->', repr(tarfile.data_filter(link, 'out').linkname))
'C:evil.txt' -> C:\work\evil.txt
'x/../C:evil.txt' -> C:\work\evil.txt
symlink -> 'C:evil.txt'

The filters should refuse these with AbsolutePathError and AbsoluteLinkError. gh-154987 is the different-drive case, where the containment check raises ValueError instead.


Reported as a security issue via GHSA by Girish Konda. Assigned CVE-2026-107784.
also later found by anthropic/oss-scanner as ANT-2026-RSL1F4AT

PR ready, reviewed, and approved via GHSA, i'll push that after opening this.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

  • gh-161323: Refuse drive-relative paths in tarfile extraction filters #161334
  • [3.15] gh-161323: Refuse drive-relative paths in tarfile extraction filters (GH-161334) #161355
  • [3.14] gh-161323: Refuse drive-relative paths in tarfile extraction filters (GH-161334) #161356
  • [3.13] gh-161323: Refuse drive-relative paths in tarfile extraction filters (GH-161334) #161357
  • [3.12] gh-161323: Refuse drive-relative paths in tarfile extraction filters (GH-161334) #161358
  • [3.11] gh-161323: Refuse drive-relative paths in tarfile extraction filters (GH-161334) #161359

Activity

  1. gpshead
    self-assigned this
    on Nov 4, 2026
  2. gpshead
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    type-securityA security issueA security issue
    on Nov 4, 2026
  3. StanFromIreland
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    3.11only security fixesonly security fixes
    3.12only security fixesonly security fixes
    3.13only security fixesonly security fixes
    3.14bugs and security fixesbugs and security fixes
    3.15bugs and security fixesbugs and security fixes
    3.16new features, bugs and security fixesnew features, bugs and security fixes
    and removed
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Nov 4, 2026
  4. StanFromIreland
    added this to Tarfile issues 🗄️on Nov 4, 2026
  5. gpshead
    added 3 commits that reference this issue on Nov 4, 2026

    gh-161323: Refuse drive-relative paths in tarfile extraction filters (G…

    e4c751b

    [3.14] gh-161323: Refuse drive-relative paths in tarfile extraction f…

    6fea59a

    [3.15] gh-161323: Refuse drive-relative paths in tarfile extraction f…

    6ac089b
  6. aisk
    added
    OS-windows
    on Nov 5, 2026
  7. gpshead
    added
    release-blocker
    on Nov 6, 2026
  8. github-project-automation
    added this to Release and Deferred blockers 🚫on Nov 6, 2026
  9. github-project-automation
    moved this to Todo in Release and Deferred blockers 🚫on Nov 6, 2026
  10. hugovk
    removed
    3.14bugs and security fixesbugs and security fixes
    3.15bugs and security fixesbugs and security fixes
    3.16new features, bugs and security fixesnew features, bugs and security fixes
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @gpshead
    gpshead

Labels

3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixesOS-windowsrelease-blockerstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-securityA security issueA security issue

Projects

  • Release and Deferred blockers 🚫
    Status
    Todo
    Show more project fields
  • Tarfile issues 🗄️
    Status
    No status
    Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.