π‘οΈ Sentinel: Verify Unix socket peer credentials#94
π‘οΈ Sentinel: Verify Unix socket peer credentials#94
Conversation
π Issue: When the agent runs as a non-root user (User Mode), it connects to a Unix socket in /tmp. If a malicious local user pre-creates or spoofs the socket, the agent might send sensitive execution reports to the attacker. π§ Risk: Information Disclosure (sensitive job output) to local attackers. π οΈ Fix: Implemented `verifySocketPeer` using `SO_PEERCRED` on Linux. The agent now verifies that the socket peer is owned by the same user (or root) before sending data. π§ͺ Tests: Added `cmd/security_peer_linux_test.go` to verify that connections are rejected if UIDs do not match. Co-authored-by: minibota <1483356+minibota@users.noreply.github.com>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
π Issue: In "User Mode", the agent connects to a Unix socket which may be located in a shared directory like
/tmp. A malicious local user could potentially create a socket at the expected path (if the directory permissions allow or via race conditions) to intercept execution reports.π§ Risk: Information Disclosure. Execution reports containing job stdout/stderr (which may contain secrets) could be sent to an attacker's process.
π οΈ Fix:
verifySocketPeerincmd/security_linux.gousingsyscall.GetsockoptUcred(SO_PEERCRED).sendToDaemonincmd/exec.goto verify the peer's UID matches the current user's UID (or root) immediately after connection.cmd/security_other.gofor non-Linux compatibility.π§ͺ Tests:
cmd/security_peer_linux_test.gowhich mocksgetCurrentUidto simulate a cross-user connection and asserts that the security check fails.PR created automatically by Jules for task 12636073035741168691 started by @minibota