SSRF guard re-resolves DNS at connect time, so rebinding is still possible
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, typescript
- 領域
- backend, networking, security
調査の方向性
Start with src/net/ssrf.ts and trace how its lookup, fetchImpl, and redirect handling work; then read the existing tests that exercise those injectable dependencies. Run those tests before making changes. Done means the connected address is one that was validated, TLS verification and redirect checks remain intact, the injections still work, a rebinding test passes, and the module comment accurately states the guarantee.
索引モデルが issue の本文から書いたものです。
説明
Follow-up to #407, which was closed by #488. That PR is a thorough guard and removed the whole easy attack surface — this is the residue it deliberately left.
Not a Wave issue right now. The repo's Wave budget for this round is exhausted, so this is filed for tracking rather than for points. It will be labelled for the Wave when the next round opens.
The gap
src/net/ssrf.ts validates and then fetches:
let url = await assertUrlSafe(target, opts)
const response = await fetchImpl(url.toString(), { ...init, redirect: 'manual' })
assertUrlSafe resolves the hostname and checks every returned address. fetchImpl is then given the hostname, and Node resolves it again when it opens the connection.
An attacker who controls a DNS zone can serve a short-TTL record that answers the first query with a public address and the second with 169.254.169.254. The check passes, the connection goes somewhere else. This is DNS rebinding, and it is the specific thing a post-resolution check is otherwise meant to defeat.
It matters here because the MCP server takes its target URL from an agent, and agents routinely read attacker-influenced text.
What to build
Pin the connection to an address that was actually validated.
- An undici dispatcher with a custom
connectorlookupis the usual route: resolve once, validate, and hand the chosen address to the connector so no second resolution happens. - Or connect by IP with the
Hostheader preserved — be careful, this breaks TLS SNI and certificate verification unlessservernameis set explicitly, so it is not the simpler option it appears to be. - Re-validate on every redirect hop, as the current code already does.
- The existing injectable
lookupandfetchImplshould stay injectable, because that is what makes the current tests possible.
Also
Correct the module comment. It currently reads:
to decide that after resolving the hostname, because a public-looking name can resolve to a private address — the classic way this check is bypassed.
True of a static name, not of an attacker-controlled one. Say plainly that connect-time resolution is not yet pinned, so nobody reads it as a guarantee it does not make.
Acceptance criteria
- The address connected to is one that was validated
- A test proves a hostname resolving differently on the second lookup does not reach the second address
- TLS verification still works against the original hostname
- Redirect hops remain validated
-
lookupandfetchImplstay injectable and the existing tests still pass - The module comment states what is and is not guaranteed
- 主要言語
- TypeScript
- スター
- 4
- フォーク
- 71
- 平均マージ
- 1日 5時間
- マージ済み PR(30日)
- 59
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Divinity-Labs/Lens のほかの issue
-
Webhook retries have no jitter, so failures synchronise対応中かも @Richard-tobi が 4 日前に担当しました。 オープンarea:reliability difficulty:easy help wanted points:100 Stellar Wave
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
Divinity-Labs/Lens#341 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Admin routes are public and that is load-bearing対応中かも @sparkysolutions10-pixel が 1 日前に担当しました。 オープンarea:security difficulty:easy help wanted points:100
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
Divinity-Labs/Lens#514 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
A caller cannot see their own usage対応中かも @sparkysolutions10-pixel が 1 日前に担当しました。 オープンarea:api-quality difficulty:intermediate help wanted points:150
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
Divinity-Labs/Lens#513 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
The key is accepted only as a bearer token, and nothing says so対応中かも @krsnak が 3 日前に担当しました。 オープンarea:docs difficulty:easy help wanted points:100 Stellar Wave
Divinity-Labs/Lens#512 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
The admin surface has no tests対応中かも @krsnak が 3 日前に担当しました。 オープンarea:testing difficulty:intermediate help wanted points:150 Stellar Wave
Divinity-Labs/Lens#510 · コメント 4 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
Divinity-Labs/Lens の issue をすべて見る
似ている issue
-
frontend
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
ranxianglei/billion-context#4172 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
awslabs/threat-composer#362 ·
メンテナーはふだん 1 日以内に返信
-
Area/Cloud Needs Triage Type/Bug
難易度 1/5 1〜3時間 初心者へのやさしさ 86/100
wso2/product-integrator#2847 ·
メンテナーはふだん 1 日以内に返信