[bug] NoteGen Web Clipper pairing endpoint auto-approves unauthenticated requests server-side and skips Host validation
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- tauri, typescript
調査の方向性
Read src-tauri/src/web_clipper.rs, starting with create_pairing, request_origin, and approve_pairing; trace how the routes are registered and how the approval command and UI are used. Review the reported Host and origin validation gaps and the authorization path. Done means unauthenticated requests cannot obtain a durable token or write clips, and legitimate pairing still requires user approval; run the Web Clipper tests if available.
索引モデルが issue の本文から書いたものです。
説明
详细描述这个 Bug
Summary
NoteGen starts a loopback Web Clipper HTTP service at startup (app_setup.rs:49) enabled by default. create_pairing stores the request as Pending then immediately calls approve_pairing in the same unauthenticated handler, minting a 32-byte Bearer token persisted with no expiry. Host is never validated and the origin check only validates an extension-scheme string shape, so any local process or web page can obtain a durable token and write attacker notes into the user vault.
Details
Service starts unconditionally at src-tauri/src/app_setup.rs:49 and binds loopback on the clipper port (web_clipper.rs:539-542); routes at 521-538; enabled defaults true (116-120, 505-510).
Failure 1: create_pairing calls request_origin (587) into optional_request_origin (310-335), accepting an extension-shaped Origin or a caller-supplied client ID header (328-334). is_extension_origin (289-299) and is_extension_id (301-308) only check prefix, charset and length; no code reads Host.
Failure 2: create_pairing (578-628) inserts the request as Pending (611-622), then line 623 calls approve_pairing in the same unauthenticated handler and line 626 returns approved. approve_pairing (866-905) mints a 32-byte token and calls persist_connections with no expiry. The approve_web_clipper_pairing command (858-864) and UI at web-clipper-bridge.tsx:417 are bypassed.
Sink: authorize (429-459) validates only protocol, enabled, origin shape, the self-asserted install ID, and the token hash with the install ID and origin recorded at pairing. create_clip (800-824) persists attacker Markdown up to 2 MiB into the note database; create_tag (826-856) and context (789-798) are reachable too.
Core vulnerable code path:
rust
// src-tauri/src/web_clipper.rs:611-628
.insert(
id.clone(),
PairingRequest {
event: event.clone(),
code_challenge: body.code_challenge,
status: PairingStatus::Pending,
},
);
approve_pairing(&state, &id).map_err(ApiError::internal)?;
Ok((
StatusCode::ACCEPTED,
Json(json!({ "id": id, "status": "approved", "expiresAt": event.expires_at })),
))
The unauthenticated handler stores the pairing as Pending then approves it itself on line 623, with no user confirmation and no Host validation anywhere in the path.
POC
Preconditions: NoteGen running, clipper enabled by default, attacker able to reach the loopback clipper port (any local process, or a page via DNS rebinding since Host is unchecked).
Step 1: POST the pairing collection route with loopback Host, Content-Type application/json, protocol version header 1, and an Origin or client ID header of an extension scheme plus an arbitrary identifier. Body: installId 8-128 chars, codeChallenge base64url SHA-256 of the verifier, browser, extensionVersion. Expected HTTP 202 with the pairing id and status approved.
Step 2: POST the exchange route under that id with the same headers and install IDs and the verifier. Expected HTTP 200 with the Bearer token.
Step 3: POST the clips route with Authorization Bearer and the token, install ID and protocol headers, plus mode, clipId, tagId, url, title, contentMarkdown and capturedAt. Expected HTTP 201 with the created mark id, so attacker Markdown is stored in the note vault.
Impact
The attacker holds a durable Bearer token treated as a fully authorised clipper connection. Note vault integrity is compromised: attacker Markdown up to 2 MiB per clip and attacker tags can be written and rendered in the trusted editor, enabling disinformation and phishing. Confidentiality is affected because context exposes clipper context and note metadata. The token never expires and the approval prompt never fires. CVSS v3.1 estimate 8.8.
Weaknesses
CWE: CWE-306 Missing Authentication for Critical Function (with CWE-287 Improper Authentication)
NoteGen 版本
dev branch (exact tagged release to be confirmed)
操作系统
Windows
报错日志
No response
- 主要言語
- TypeScript
- スター
- 12.9k
- フォーク
- 975
- 平均マージ
- 20時間 27分
- マージ済み PR(30日)
- 1
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
codexu/note-gen のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 58/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 45/100
codexu/note-gen の issue をすべて見る
似ている issue
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10対応中かも @goranai が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
Inbox permission: an allow sent with `updatedInput` is ignored by Claude Code on its own safety checks対応中かも @Raj1v が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
backnotprop/plannotator#4046 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
traPtitech/knoQ_R-UI#290 ·
メンテナーはふだん 24 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
farion1231/cc-switch#9981 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
account bug course exam iris lecture
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信