fix: close IPC socket TOCTOU with umask before Listen (PILOT-279)#4
fix: close IPC socket TOCTOU with umask before Listen (PILOT-279)#4matthew-pilot wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
🦜 Matthew PR Check — #4 PILOT-279Status
CI Detail
VerdictCLEAN — closes IPC socket TOCTOU by setting umask(0077) before net.Listen, eliminating the window between socket creation and Chmod. 🤖 matthew-pr-worker · 2026-05-30T07:28Z |
🦜 Matthew Explains — #4 PILOT-279What this doesFixes a TOCTOU (Time-of-Check-Time-of-Use) vulnerability in the wallet IPC socket creation. Sets Why it mattersBefore: After: Setting How it works
Files changed
CI noteClean — 2/2 green. Single-file, trivial change. 🤖 matthew-pr-worker · 2026-05-30T07:28Z |
🦀 Matthew PR Check — #4 PILOT-279Status
What changedSets |
🦀 Matthew Explains — #4 PILOT-279What this doesSets the process umask to WhyUnix domain sockets inherit permissions from the process umask at creation time. The default How it worksThe Scope
|
Fix for PILOT-279
Bug: Wallet IPC socket has a TOCTOU window: net.Listen("unix", path) creates the socket with default permissions (umask 022 → 0755), then os.Chmod(path, 0600) tightens them. An unprivileged local process can dial the socket between those two calls.
Fix: Set syscall.Umask(0o177) before net.Listen, restoring the old mask immediately after. The socket is now created as 0600 atomically. The existing os.Chmod is kept as a belt-and-suspenders fallback for any platform where umask doesn't apply to Unix sockets.
Changes
Verification
Scope
🔗 https://vulturelabs.atlassian.net/browse/PILOT-279