Symlink replacement is non-atomic (TOCTOU race window) #23
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
mod-nag
mod-nag
mod-nag
mod-nag/ignore
mod-nag/ignore
mod-nag/ignore
nagonag
nagonag/ignore
question
security
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
heiko/cert-proxy#23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
In
cmd/cert-proxy-client/cert/cert.go:233-236, the symlink update is performed as:Between
RemoveandSymlinkthere is a window where:ENOENT(brief unavailability of cert/key files)Exploitation Scenario
A local attacker races the Remove/Symlink window and creates a symlink pointing to a world-readable location. The next cert-proxy-client run writes the private key through that symlink to the attacker-controlled path. Requires write access to the certbase directory.
Recommended Fix
Use atomic symlink replacement via rename:
This eliminates both the ENOENT window and the race condition.