The vulnerability exists in the sandbox's bind mount validation logic, specifically within the validateBindMounts function in src/agents/sandbox/validate-sandbox-security.ts. The root cause was the improper handling of symlinks when a bind source path pointed to a location that did not yet exist.
The analysis of the patch b5787e4abba0dcc6baf09051099f6773c1679ec1 reveals that validateBindMounts relied on a helper function, tryRealpathAbsolute, to resolve symbolic links and obtain the canonical path of a bind source. However, tryRealpathAbsolute would only perform this resolution if the entire path existed. If an attacker provided a path where a parent directory was a symlink pointing outside the allowed sandbox root, and the final component of the path (the "leaf") did not exist, tryRealpathAbsolute would silently return the original, unresolved path.
The validateBindMounts function would then incorrectly approve this path as being inside the allowed root. Later, when the sandboxed process creates the missing leaf, it would be created at the location the symlink pointed to, effectively bypassing the sandbox's path restrictions.
The fix replaces the flawed tryRealpathAbsolute with a new function, resolvePathViaExistingAncestor. This new function correctly canonicalizes the path by finding the deepest existing ancestor, resolving its real path, and then re-appending the non-existent leaf segments. This ensures that symlinks are always resolved before security checks are performed.
Therefore, the key vulnerable functions are validateBindMounts, which orchestrates the check, and the now-removed tryRealpathAbsolute, which contained the flawed logic. During exploitation, validateBindMounts would be the function observed in a runtime profile performing the incorrect validation.