Skip to content

Disallow symlinks in extractTarGz and harden archive extraction against path traversal - #4880

Open
sigurdm wants to merge 1 commit into
dart-lang:masterfrom
sigurdm:disallow-tar-symlinks
Open

Disallow symlinks in extractTarGz and harden archive extraction against path traversal#4880
sigurdm wants to merge 1 commit into
dart-lang:masterfrom
sigurdm:disallow-tar-symlinks

Conversation

@sigurdm

@sigurdm sigurdm commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  1. Disallow symlink and hardlink creation: In extractTarGz, extract only regular files and directories. Symlinks, hardlinks, and special files are safely ignored. This eliminates symlink depth-confusion and symlink-based Zip Slip attacks, avoids Windows privilege issues (OS Error 1314), and aligns with pub publish (which already flattens symlinks to copies on upload).
  2. Reject invalid & dangerous entry names: Abort extraction on entry names containing backslashes (\), colons (:), NUL bytes, or ASCII control characters.
  3. Protect against Windows DOS device names: Reject path segments matching CON, PRN, AUX, NUL, COM1-9, or LPT1-9.
  4. Protect against Win32 trailing dot/space stripping: Reject segments ending with . or space.
  5. Enforce case-insensitive collision checks: Detect and reject casing collisions on Windows and macOS.

Fixes https://buganizer.corp.google.com/issues/528619187

…st path traversal

1. Disallow symlink and hardlink creation during archive extraction. Only regular files and directories are extracted; symlinks and hardlinks are safely ignored.
2. Reject invalid entry names containing backslashes, colons, NUL bytes, or control characters.
3. Reject Windows reserved DOS device names (CON, PRN, AUX, NUL, COM1-9, LPT1-9).
4. Reject filename segments ending with trailing dots or spaces.
5. Track case-insensitive path collisions on Windows and macOS.

BUG=https://buganizer.corp.google.com/issues/528619187
TAG=agy
CONV=9ae2ec7a-a500-4f86-b1a9-31504d7f3f24
@sigurdm
sigurdm requested a review from jonasfj August 20, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant