fix(data): 重建 OpenClaw fs-bridge TOCTOU 分阶段写入链#52
Open
Qiyuanqiii wants to merge 1 commit into
Open
Conversation
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.
背景与去重
现有 #7 相关 PR(#15、#20、#24、#29、#47)均集中于 issue 点名的五条优先样本。本 PR 选择尚无提交涉及的
GHSA-MJ4P-RC52-M843:entry-00301entry-00302Related to #7
原标注问题
entry-00301的入口是readFile结尾的孤立},并错误地把AbortSignal描述成攻击者控制竞态时序的手段。entry-00301的关键操作是未参与旧写入路径的规范化 helper。entry-00302整条链围绕只读stat()和buildStatPlan()展开,与 staged-write 公告无关。重建方案
将两条记录重建为两个真实、独立的可达入口:
entry-00301:沙箱 write/edit 工具接收模型控制的路径与内容。entry-00302:apply_patch 接收 patch input,并从 hunk 产生路径与内容。两条入口最终汇聚到相同的漏洞链:
输入 -> assertPathSafety -> 父路径发生竞态变化 -> mktemp + cat + runCommand -> 最终 recheck + mv关键操作定位到未固定父目录的临时文件创建、内容写入及脚本执行。最终
mv虽然会重新检查目标,但执行时攻击者字节已经可能在允许挂载之外物化。修复依据
上游修复提交
11924a7删除旧writeFileToTempPath(),改用目录 fd:os.open(..., dir_fd=parent_fd)创建临时文件os.replace(..., src_dir_fd=parent_fd, dst_dir_fd=parent_fd)完成替换两条记录暂时降为
verify=0,等待维护者确认后再恢复人工审计状态。验证结果
git diff --check通过验证截图