CVE-2022-28355
📋 TL;DR
CVE-2022-28355 is a vulnerability in Scala.js where the randomUUID function generates predictable UUID values instead of cryptographically secure random ones. This affects applications using Scala.js versions before 1.10.0 that rely on UUIDs for security-sensitive operations like session tokens, CSRF tokens, or cryptographic keys. Developers using vulnerable Scala.js versions in their web applications are affected.
💻 Affected Systems
- Scala.js
📦 What is this software?
Scala.js by Scala Js
⚠️ Risk & Real-World Impact
Worst Case
Attackers could predict UUIDs used for authentication tokens, session IDs, or cryptographic keys, leading to complete system compromise, data theft, or privilege escalation.
Likely Case
Attackers could bypass security controls that rely on UUID unpredictability, such as CSRF protection, session fixation prevention, or secure random identifier generation.
If Mitigated
If UUIDs are only used for non-security purposes like database IDs or logging, impact is minimal. Proper security controls like additional authentication layers reduce risk.
🎯 Exploit Status
The vulnerability is well-documented in public advisories with technical details. Exploitation requires the attacker to understand the predictable pattern and have access to some generated UUIDs.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 1.10.0 and later
Vendor Advisory: https://github.com/scala-js/scala-js/security/advisories/GHSA-j2f9-w8wh-9ww4
Restart Required: Yes
Instructions:
1. Update Scala.js dependency to version 1.10.0 or later in build.sbt or project configuration. 2. Rebuild and redeploy the application. 3. Restart affected services.
🔧 Temporary Workarounds
Replace randomUUID with secure alternative
allReplace calls to scala.scalajs.js.Math.randomUUID() with a cryptographically secure UUID generator
// Example using java.util.UUID.randomUUID() in Scala.js
import java.util.UUID
val secureUUID = UUID.randomUUID().toString()
🧯 If You Can't Patch
- Audit all uses of randomUUID and replace with secure alternatives
- Implement additional security controls like multi-factor authentication for UUID-based authentication
🔍 How to Verify
Check if Vulnerable:
Check build.sbt or project configuration for Scala.js version. If version is <1.10.0 and application uses scala.scalajs.js.Math.randomUUID(), it is vulnerable.
Check Version:
grep 'scala-js' build.sbt || check project dependencies
Verify Fix Applied:
Confirm Scala.js version is 1.10.0 or later in build configuration and verify randomUUID calls now generate cryptographically secure values.
📡 Detection & Monitoring
Log Indicators:
- Patterns of predictable UUID sequences in logs
- Failed authentication attempts with predictable tokens
Network Indicators:
- Repeated use of similar UUID patterns in API requests
SIEM Query:
source="application_logs" AND "randomUUID" AND (uuid MATCHES "predictable_pattern")
🔗 References
- https://github.com/scala-js/scala-js/issues/4657
- https://github.com/scala-js/scala-js/releases
- https://github.com/scala-js/scala-js/security/advisories/GHSA-j2f9-w8wh-9ww4
- https://www.scala-js.org/news/2022/04/04/announcing-scalajs-1.10.0/
- https://github.com/scala-js/scala-js/issues/4657
- https://github.com/scala-js/scala-js/releases
- https://github.com/scala-js/scala-js/security/advisories/GHSA-j2f9-w8wh-9ww4
- https://www.scala-js.org/news/2022/04/04/announcing-scalajs-1.10.0/