[bug] NoteGen Web Clipper pairing endpoint auto-approves unauthenticated requests server-side and skips Host validation
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- tauri, typescript
- Lĩnh vực
- authentication, backend, security
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
详细描述这个 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
- Ngôn ngữ chính
- TypeScript
- Star
- 12.9k
- Fork
- 975
- Merge trung bình
- 20 giờ 27 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của codexu/note-gen
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
-
[feat] 强烈建议鼠标中键可关闭标签!!!Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
[bug] 左侧边栏,右侧边栏不能固定宽度,重启后比较随意Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 58/100
-
[feat] 在模型供应商模板中加入 OpenLLMĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 45/100
Tất cả issue của codexu/note-gen
Issue tương tự
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10Có thể đã có người làm @goranai đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Inbox permission: an allow sent with `updatedInput` is ignored by Claude Code on its own safety checksCó thể đã có người làm @Raj1v đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
backnotprop/plannotator#4046 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
進捗部屋の管理画面で削除対象を月ごとに絞り込むĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
traPtitech/knoQ_R-UI#290 ·
Maintainer thường phản hồi trong vòng 24 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
farion1231/cc-switch#9981 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
account bug course exam iris lecture
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày