curl --skip-existing has a TOCTOU race that lets a post-check symlink redirect the later download write
业务逻辑 / TOCTOU 竞态条件 / #3747959
该报告还没有中文解读。
原文摘录
摘自原文(6883 字符中的一小部分)
Summary: The curl CLI's `--skip-existing` option performs a separate existence check before the download body is written. In the verified path, curl first calls `stat()` on the target pathname and decides "the file does not exist, so continue", but it does not keep an fd bound to that decision. The …
原文中的代码
set -euo pipefail
ROOT="$PWD"
CURL_BIN=""
for candidate in "$ROOT/src/curl" "$ROOT/build-h2-asan/src/curl" "$(command -v curl)"; do
if [ -n "${candidate:-}" ] && [ -x "$candidate" ]; then
CURL_BIN="$candidate"
break
fi
done
if [ -z "$CURL_BIN" ]; then
echo "could not find a curl …默认不展示报告全文。以上为简短摘录,完整复现过程请阅读原文。版权归研究员与 curl 所有。
时间线
- 报告提交
- 公开披露
阅读 HackerOne 原文 ↗作者 @sdjasj · 版权归作者与 curl 所有