fix(sandbox): block tmp hardlink alias escapes in media path resolution#25820
Merged
steipete merged 2 commits intoopenclaw:mainfrom Feb 25, 2026
Merged
Conversation
68ca732 to
bf7f9b3
Compare
Contributor
|
Landed via temp rebase onto main.
Thanks @bmendonca3! |
joshavant
pushed a commit
that referenced
this pull request
Feb 25, 2026
margulans
pushed a commit
to margulans/Neiron-AI-assistant
that referenced
this pull request
Feb 25, 2026
Jackson3195
pushed a commit
to Jackson3195/openclaw-with-a-personal-touch
that referenced
this pull request
Feb 25, 2026
brianleach
pushed a commit
to brianleach/openclaw
that referenced
this pull request
Feb 26, 2026
2 tasks
execute008
pushed a commit
to execute008/openclaw
that referenced
this pull request
Feb 27, 2026
r4jiv007
pushed a commit
to r4jiv007/openclaw
that referenced
this pull request
Feb 28, 2026
6 tasks
hughdidit
pushed a commit
to hughdidit/DAISy-Agency
that referenced
this pull request
Mar 1, 2026
(cherry picked from commit 6fa7226) # Conflicts: # CHANGELOG.md
hughdidit
pushed a commit
to hughdidit/DAISy-Agency
that referenced
this pull request
Mar 3, 2026
(cherry picked from commit 6fa7226) # Conflicts: # CHANGELOG.md
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
thebenjaminlee
pushed a commit
to escape-velocity-ventures/openclaw
that referenced
this pull request
Mar 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
os.tmpdir()bypass path is used.Change Type
Scope
src/agents/sandbox-paths.tssrc/agents/sandbox-paths.test.tsSecurity Impact
resolveSandboxedMediaSourceoutput.Repro + Verification
os.tmpdir().resolveSandboxedMediaSource({ media: <hardlinkPath>, sandboxRoot: <sandboxRoot> }).Automated verification:
pnpm exec vitest run src/agents/sandbox-paths.test.ts --maxWorkers=1Evidence
TOP-SECRETfrom an out-of-sandbox source file.rejects hardlinked tmpdir paths to outside files.Human Verification
resolveSandboxedMediaSource).Compatibility / Migration
nlink > 1are newly rejected in this path; standard tmp files continue to work.Failure Recovery
Risks and Mitigations
Greptile Summary
Closes a sandbox escape vector where a hard link under
os.tmpdir()could alias an out-of-sandbox file, bypassing the existing symlink-only traversal check inresolveAllowedTmpMediaPath. The fix addsassertNoHardlinkedFinalPathwhich useslstat().nlink > 1to detect and reject hard-linked files in the tmp media path. A regression test reproduces the attack (create outside file, hard-link it into tmpdir, callresolveSandboxedMediaSource) and verifies rejection.assertNoHardlinkedFinalPath()insandbox-paths.tsthat rejects regular files withnlink > 1in the tmp bypass pathresolveAllowedTmpMediaPathafter the existingassertNoSymlinkEscapecallConfidence Score: 5/5
assertNoHardlinkedFinalPath) hooked into one specific code path (resolveAllowedTmpMediaPath). Thenlink > 1check is the standard approach for detecting hard links on Unix. The function correctly useslstat(notstat), handles missing files and non-regular files gracefully, and only affects the tmp bypass path. The regression test is thorough with proper edge-case handling. No existing behavior is altered for normal (non-hardlinked) tmp files.Last reviewed commit: 68ca732