Listen to this Post
How the CVE Works
When a user configures `ALGORITHM ES512` for any JWT access method using the `DEFINE ACCESS … TYPE JWT ALGORITHM ES512` statement, SurrealDB silently substitutes `ES384` at all four internal algorithm conversion points. This behavior is not immediately apparent to the user, as no error, warning, or log message is raised to indicate the substitution.
The root cause lies in the underlying `jsonwebtoken` crate (v10.x), which does not include an `ES512` algorithm variant. When the SurrealDB code attempts to map the `ES512` algorithm to the underlying library, it encounters a missing entry and defaults to `ES384` without any notification. This silent fallback occurs at multiple points within the codebase where algorithm conversion takes place.
The practical consequence of this substitution is a cryptographic mismatch. Users who provide the correct P-521 key type for ES512 will experience authentication handshake failures. The server, expecting ES384 (which uses the P-384 curve), cannot correctly process tokens signed with the P-521 key, leading to failed authentication attempts. Additionally, when tokens are verified by external systems expecting real ES512 signatures, those verifications will also fail.
It is important to note that this vulnerability cannot be exploited to forge tokens or compromise the integrity or confidentiality of data handled by SurrealDB. The fallback algorithm, ES384, remains cryptographically strong, so the security of the system is not fundamentally broken. However, the silent substitution creates a significant usability and reliability issue for users who rely on ES512.
The patches for SurrealDB v3.1.0 address this issue by blocking new `DEFINE ACCESS` statements that use `ALGORITHM ES512` with a clear error message. Additionally, deprecation warnings are added at runtime for existing stored ES512 definitions, alerting users to the problem. Users are advised to reconfigure affected JWT access methods to use a supported algorithm such as ES384 (with a P-384 key pair) or another supported algorithm.
DailyCVE Form
Platform: SurrealDB
Version: < 3.1.0
Vulnerability: Algorithm substitution
Severity: Medium
date: 2024
Prediction: 2024-04-11
What Undercode Say:
Check for vulnerable ES512 definitions surreal sql --endpoint http://localhost:8000 --namespace test --database test --pretty \ "INFO FOR DB;"
Example of a vulnerable DEFINE ACCESS statement DEFINE ACCESS jwt_access TYPE JWT ALGORITHM ES512 KEY '...';
Check SurrealDB version surreal --version
Exploit:
An attacker cannot exploit this vulnerability to forge tokens or compromise data integrity or confidentiality. The primary impact is denial of service due to authentication handshake failures. An attacker could cause service disruption by providing a P-521 key for ES512, leading to failed authentication attempts and potential lockouts.
Protection:
- Upgrade to SurrealDB v3.1.0 or later to apply the official patches.
- Reconfigure JWT access methods to use a supported algorithm such as ES384 with a P-384 key pair.
- Review all `DEFINE ACCESS` statements that specify `ALGORITHM ES512` and update them accordingly.
- Monitor logs for deprecation warnings related to ES512 definitions after upgrading.
Impact:
- Authentication Handshake Failures: Users providing the correct P-521 key type for ES512 will experience authentication handshake failures due to the curve mismatch with ES384 (which expects P-384).
- External System Verification Failures: Tokens verified by external systems expecting real ES512 signatures will fail verification.
- No Forge or Compromise: This vulnerability cannot be exploited to forge tokens or compromise the integrity or confidentiality of data handled by SurrealDB, as ES384 remains cryptographically strong.
🎯Let’s Practice Exploiting & Learn Patching For Free:
🎓 Live Courses & Certifications:
Join Undercode Academy for Verified Certifications
🚀 Request a Custom Project:
Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands
Sources:
Reported By: github.com
Extra Source Hub:
Undercode

