openclaw - ✅(Solved) Fix Bug: bootstrap token path lacks rate limiting, lockout, and alerting on failed verifies [2 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#77980Fetched 2026-05-06 06:18:22
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
2
Timeline (top)
cross-referenced ×3subscribed ×3commented ×1

Fix Action

Fixed

PR fix notes

PR #76322: security: bootstrap token path exposes mutex-stall DoS — no rate limit, no lockout, no alert

Description (problem / solution / changelog)

Closes #77980

Summary

  • Bootstrap token auth path had no rate limiting, unlike the device-token path which has full `rateLimiter.check()` + `rateLimiter.recordFailure()` protection
  • An attacker opening N WebSocket connections with bogus bootstrap tokens serialises all through the shared `verifyDeviceBootstrapToken` mutex, stalling legitimate device pairing with no IP lockout or alert
  • Fix mirrors the existing device-token pattern: check before verify, record failure on reject, reset on success
  • Deferred failure accounting: bootstrap `recordFailure` is only flushed if the entire handshake fails. A device with a stale bootstrap token + valid device token is a legitimate connection — the pending failure is discarded when device-token succeeds

Proof of concept (confirmed)

Real WebSocket server using the actual `verifyDeviceBootstrapToken` mutex + disk I/O:

``` Baseline (no attacker): 21.6ms 5 attacker conns: 23ms (x1) 20 attacker conns: 47ms (x2) 50 attacker conns: 134ms (x6) 100 attacker conns: 210ms (x10) 200 attacker conns: 366ms (x17) ← no rate limit fired ```

Zero knowledge of the real token required — attacker only needs to reach the gateway WS port.

Changes

`src/gateway/auth-rate-limit.ts`

  • Added `AUTH_RATE_LIMIT_SCOPE_BOOTSTRAP_TOKEN = "bootstrap-token"` constant

`src/gateway/server/ws-connection/auth-context.ts`

  • Bootstrap path: check rate limit → skip verify if limited → verify → reset on success
  • Failure accounting is deferred: `pendingBootstrapFailure` flag set on rejection; `recordFailure` called only after all fallback paths (device-token) complete and auth is still false
  • If device-token succeeds, the pending bootstrap failure is silently discarded

Test plan

17/17 passing (`pnpm test src/gateway/server/ws-connection/auth-context.test.ts`):

Unit (mock limiter)

  • Bootstrap path blocked before `verifyBootstrapToken` when rate-limited
  • `recordFailure` called on rejected bootstrap token (no device-token fallback)
  • `reset` called on successful bootstrap token
  • Scope isolation: `check` called with `"bootstrap-token"`, never `"device-token"`
  • Stale bootstrap + valid device token → auth succeeds, bootstrap `recordFailure` NOT called ← covers the deferred-failure invariant

Integration (real `AuthRateLimiter`)

  • 5 failed attempts → 6th blocked before `verifyBootstrapToken` runs (mutex never acquired)
  • Locked attacker IP does not affect a clean IP
  • Legitimate device with correct token from a clean IP succeeds after attacker is locked out

PoC scripts removed from `scripts/` before merge review.

Changed files

  • src/gateway/auth-rate-limit.ts (modified, +1/-0)
  • src/gateway/server/ws-connection/auth-context.test.ts (modified, +256/-1)
  • src/gateway/server/ws-connection/auth-context.ts (modified, +51/-17)

PR #78015: Rate-limit bootstrap and device signature auth

Description (problem / solution / changelog)

Summary

  • add dedicated auth rate-limit scopes for bootstrap-token and device-signature
  • check bootstrap-token lockout before serialized bootstrap token verification
  • record bootstrap-token failures and reset on success
  • check device-signature lockout before repeated signature verification work
  • record device-signature failures and reset on success

Fixes #77980.

Verification

  • Local workflow batch verification passed before PR branch extraction.
  • Targeted regressions cover bootstrap-token limiter behavior and repeated invalid device signatures.

Changed files

  • src/gateway/auth-rate-limit.ts (modified, +2/-0)
  • src/gateway/server.auth.default-token.suite.ts (modified, +48/-0)
  • src/gateway/server/ws-connection/auth-context.test.ts (modified, +36/-0)
  • src/gateway/server/ws-connection/auth-context.ts (modified, +37/-17)
  • src/gateway/server/ws-connection/message-handler.ts (modified, +35/-1)
RAW_BUFFERClick to expand / collapse

Problem

Audit of the gateway bootstrap-token path turned up a cluster of DoS-shaped issues:

  • No rate limit on pre-auth bootstrap-token verify (covered by #77978 / fix #77527).
  • No rate limit on pre-auth device-signature verify (covered by #77979 / fix #77492).
  • No lockout for repeated bad tokens.
  • No alerting on failed verify storms.

This is the umbrella issue for the bootstrap-token DoS family. Originally filed as a PoC in PR form at #76322 (kept open as the discovery thread); separate fix PRs land each surface piecemeal so review can scope per-change.

Tracking PR

Discovery / PoC: #76322. Per-surface fixes: #77527 (bootstrap-token mutex), #77492 (device-signature CPU).

extent analysis

TL;DR

Implement rate limiting and lockout mechanisms for pre-auth bootstrap-token and device-signature verification to prevent Denial of Service (DoS) attacks.

Guidance

  • Review and apply the fixes from PRs #77527 and #77492 to address the rate limit issues for bootstrap-token and device-signature verification.
  • Implement a lockout mechanism for repeated bad tokens to prevent brute-force attacks.
  • Set up alerting for failed verify storms to detect potential DoS attacks.
  • Monitor the effectiveness of these fixes and adjust as needed to ensure the security of the gateway bootstrap-token path.

Example

No specific code snippet can be provided without more context, but the fixes in PRs #77527 and #77492 should be reviewed and applied.

Notes

The provided information does not specify the exact implementation details of the fixes, so it is assumed that the PRs contain the necessary code changes.

Recommendation

Apply the workarounds and fixes from PRs #77527 and #77492, as they address the identified security vulnerabilities and provide a more secure solution for the gateway bootstrap-token path.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix Bug: bootstrap token path lacks rate limiting, lockout, and alerting on failed verifies [2 pull requests, 1 comments, 2 participants]