Timing-Unsafe Token Comparison in Unauthenticated Unsubscribe Endpoints
Summary
Summary
Two unauthenticated API endpoints use JavaScript strict equality (!==) to verify cryptographic tokens instead of the constant-time safeEqual() function used consistently throughout the rest of the codebase (including the same file). This creates an observable timing discrepancy tha...
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| —Outline |
0.69.0-1.8.0→ 1.8.1 |
1.8.1 |
Original description The description as published by the source.
Summary
Two unauthenticated API endpoints use JavaScript strict equality (!==) to verify cryptographic tokens instead of the constant-time safeEqual() function used consistently throughout the rest of the codebase (including the same file). This creates an observable timing discrepancy that could allow an attacker to forge valid unsubscribe tokens through a timing side-channel attack, enabling unauthorized modification of other users' notification and subscription preferences.
Details
The Outline codebase has a well-established pattern of using safeEqual() (a wrapper around crypto.timingSafeEqual) for all security-sensitive token comparisons — 15+ instances across the server codebase. However, two unauthenticated unsubscribe endpoints use plain !== instead:
Vulnerable location 1 — server/routes/api/notifications/notifications.ts:42:
const unsubscribeToken = NotificationSettingsHelper.unsubscribeToken(
userId,
eventType
);
if (unsubscribeToken !== token) { // Timing-unsafe comparison
ctx.redirect(`${env.URL}?notice=invalid-auth`);
return;
}
Vulnerable location 2 — server/routes/api/subscriptions/subscriptions.ts:174:
const unsubscribeToken = SubscriptionHelper.unsubscribeToken(
userId,
documentId
);
if (unsubscribeToken !== token) { // Timing-unsafe comparison
ctx.redirect(`${env.URL}?notice=invalid-auth`);
return;
}
Contrast with correct usage — the same file (notifications.ts) pro…
Source: GitHub Repository Security Advisories (Game のスタック) GitHub Advisory OSV
References
- GITHUB_REPO_ADVISORY outline/outline