惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
爱范儿
爱范儿
D
Docker
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Tailwind CSS Blog
D
DataBreaches.Net
月光博客
月光博客
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
Visual Studio Blog
MyScale Blog
MyScale Blog
B
Blog
阮一峰的网络日志
阮一峰的网络日志
L
LangChain Blog
Recent Announcements
Recent Announcements
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学

Feed

React 19 Performance Optimizations You Need to Know Tesla Recalls 2.2 Million Vehicles Over Autopilot Software Bug Creating Interactive Prototypes in Figma with Smart Animate OpenAI Introduces GPT-4 Turbo with Vision API Building AI-Powered React Components with Vercel AI SDK Figma Introduces AI-Powered Design System Generator The Rise of Local-First Software Development GitHub Copilot Usage Surpasses 1.8 Million Paid Users Building Responsive Layouts with CSS Container Queries Supabase Launches Real-time Multiplayer Engine The Hidden Cost of Technical Debt in Startup Engineering Figma Launches Dev Mode 2.0 with Code Generation Why SaaS Companies Are Moving Away from Microservices Building Faster APIs with Bun and Elysia
Major Security Flaw Discovered in Popular JWT Libraries
Sarah Kim · 2024-07-22 · via Feed
Security

Critical vulnerability in jsonwebtoken and jose libraries affects millions of applications. Attackers can bypass authentication by exploiting algorithm confusion attacks

Major Security Flaw Discovered in Popular JWT Libraries

A critical security vulnerability has been discovered in two of the most widely-used JWT libraries: jsonwebtoken (npm) and jose (npm), collectively downloaded over 50 million times per week. The flaw allows attackers to completely bypass authentication systems.

The Vulnerability Explained

The issue stems from algorithm confusion attacks where malicious actors can manipulate JWT tokens to use weaker signing algorithms than intended.

How it works:

  1. Application expects RS256 (RSA with SHA-256)
  2. Attacker modifies token header to use HS256 (HMAC with SHA-256)
  3. Attacker signs token using the public key as HMAC secret
  4. Server validates token successfully, granting unauthorized access

Affected Versions

jsonwebtoken library:

  • Versions 8.0.0 through 9.0.1
  • Over 25 million weekly downloads

jose library:

  • Versions 4.0.0 through 4.14.5
  • Over 8 million weekly downloads

This vulnerability has been assigned CVE-2024-28176 with a CVSS score of 9.8 (Critical). Proof-of-concept exploits are already circulating on security forums.

Real-World Impact

Security researchers have identified vulnerable implementations in:

  • E-commerce platforms handling payment processing
  • Healthcare applications with patient data access
  • Financial services with account management systems
  • Enterprise SaaS platforms with multi-tenant architectures

Technical Details:

// Vulnerable code pattern
const jwt = require('jsonwebtoken');

// BAD: Allows algorithm to be specified in token
jwt.verify(token, publicKey);

// GOOD: Explicitly specify expected algorithm  
jwt.verify(token, publicKey, { algorithms: ['RS256'] });

The vulnerability occurs when developers don't explicitly specify which algorithms are allowed during token verification.


Check Your Dependencies

Run this command to identify vulnerable versions:

npm audit
# or
yarn audit

Look for these specific packages in your dependency tree:

  • jsonwebtoken < 9.0.2
  • jose < 4.15.0

Update Immediately

# Update jsonwebtoken
npm install jsonwebtoken@latest

# Update jose  
npm install jose@latest

💡

Both libraries released patched versions within 6 hours of disclosure. The fixes are backward-compatible and require no code changes for most implementations.

Verify Your Implementation

Ensure your JWT verification explicitly specifies allowed algorithms:

// jsonwebtoken - SECURE
jwt.verify(token, secret, { 
  algorithms: ['RS256'] // Explicitly allow only RS256
});

// jose - SECURE  
await jwtVerify(token, publicKey, {
  algorithms: ['RS256']
});

Additional Security Measures

  • Rotate signing keys if you suspect compromise
  • Review authentication logs for suspicious activity
  • Implement token expiration (short-lived tokens reduce risk)
  • Add rate limiting to authentication endpoints
  • Monitor for unusual login patterns
  • Consider implementing token blacklisting

Industry Response

Major cloud providers have already begun updating their services:

  • AWS Cognito: Patches deployed automatically
  • Auth0: Updates rolling out over 48 hours
  • Firebase Auth: Unaffected (uses different implementation)
  • Okta: Patches applied to all tenants
"This vulnerability demonstrates why security-by-default is crucial in authentication libraries. Developers shouldn't have to remember to specify secure algorithms - it should be the default behavior."
- OWASP Security Researcher

This incident highlights the critical importance of secure defaults in authentication libraries. While the patches are available, the speed of exploitation attempts suggests this vulnerability is being actively targeted.