When an Agent writes a file, why does it still cross the boundary after the path check passes?
【AI安全】Agent 写文件时,路径检查通过后为什么还会越界?
The author uses source code analysis and controlled experiments to show that after an Agent file write's path check passes, other processes in the shared workspace can replace the directory entry in the gap between the check and the actual operation, causing the write to land outside the authorized directory. In Claude Code's CVE-2026-103435 (affected versions < 2.1.129, fixed in 2.1.129), what the permission check passes to the write stage is still a path string. OpenClaw's GHSA-x82f-27x3-q89c controlled experiment shows that in the old version v2026.2.26, before a rejection was returned, O_TRUNC had already truncated an out-of-directory Canary from 4096 bytes to 0, and when the target was missing, O_CREAT first left a 0-byte file; the fixed version v2026.3.1 rejects before modifying the file. The author attributes the root cause to the check result not being bound to a file descriptor or a trusted parent directory, and recommends constraining resolution with openat2's RESOLVE_BENEATH, and replacing assertions of exceptions alone with reading back the on-disk state.
The author uses reproducible experiments to break down the race condition between path checks and actual operations in Agent file writes; the object-binding protection and disk read-back testing approach can be transferred to other Agent file pipelines.