Skip to content

go-archives: symlink extraction attack tests - #832

Closed
aliculPix4D wants to merge 1 commit into
masterfrom
pci-4898-symlink-extraction-tests
Closed

aliculPix4D wants to merge 1 commit into
masterfrom
pci-4898-symlink-extraction-tests

Conversation

@aliculPix4D

@aliculPix4D aliculPix4D commented Jul 22, 2026 •

Copy link
Copy Markdown

go-archives: symlink extraction attack tests

Add some more tests mimicking the symlink extraction attack.

Goal: show the value of using os.Root :) and prevent anyone from removing it by mistake without first understanding its value, e.g., it prevents reverting concourse#9601

I would also say that this tests are evidence that the security issue reported in: concourse#9486 was actually addressed.

@aliculPix4D
aliculPix4D requested a review from a team as a code owner July 22, 2026 14:46
Comment thread go-archive/tarfs/extract_test.go Outdated
// path on Unix; on Windows Extract always takes the Go path anyway.
// Pointing PATH at an empty dir (rather than unsetting it) makes the
// lookup fail identically on every platform.
emptyPATH, err = os.MkdirTemp("", "no-tar")

@aliculPix4D aliculPix4D Jul 22, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am very tempted to open a 2nd PR and run these tests with tar also... They must behave the same with tar :) If they fail (reminder: a failing test means that you are vulnerable to the attack) it means you have an issue with tar :)

Comment thread go-archive/tarfs/extract_test.go Resolved
Comment thread go-archive/tarfs/extract_test.go Resolved
Comment thread go-archive/tarfs/extract_test.go Resolved
@aliculPix4D
aliculPix4D force-pushed the pci-4898-symlink-extraction-tests branch from 7717669 to 2b1371c Compare July 23, 2026 07:45
Comment thread go-archive/tarfs/extract_test.go Resolved
Comment thread go-archive/tarfs/extract_test.go Resolved
Comment thread go-archive/tarfs/extract_test.go Resolved
Comment thread go-archive/tarfs/extract_test.go Resolved
Comment thread go-archive/tarfs/extract_test.go Resolved
@aliculPix4D
aliculPix4D force-pushed the pci-4898-symlink-extraction-tests branch from 2b1371c to 059e941 Compare July 23, 2026 10:24
@aliculPix4D

Copy link
Copy Markdown
Author

@marco-m-pix4d ready for re-review. All comments were addressed. I will prepare the 2nd cleanup PR to use: GinkgoT().Setenv("PATH", GinkgoT().TempDir()) on other preexisting tests.

@aliculPix4D

Copy link
Copy Markdown
Author

Closing... The same PR was merged upstream.

@aliculPix4D
aliculPix4D deleted the pci-4898-symlink-extraction-tests branch July 29, 2026 08:13
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.

3 participants