CVE-2026-49852: CWE-287: Improper Authentication in authlib joserfc
joserfc is a Python library that provides an implementation of several JSON Object Signing and Encryption (JOSE) standards. Prior to 1.6.8, joserfc.jwt.decode accepts attacker-forged HMAC-signed tokens when the caller-supplied verification key is the empty string or None, because HMACAlgorithm.sign and HMACAlgorithm.verify in src/joserfc/_rfc7518/jws_algs.py pass the output of OctKey.get_op_key(...) to hmac.new(...) and OctKey.import_key in src/joserfc/_rfc7518/oct_key.py only emits a SecurityWarning for keys shorter than 14 bytes without rejecting zero-length input. This issue is fixed in version 1.6.8.
AI Analysis
Technical Summary
joserfc versions <= 1.6.7 have a vulnerability in their HMAC verification implementation where the verify function accepts empty or nil keys without rejection. The OctKey.import_key method issues only a warning for keys shorter than 14 bytes but does not reject zero-length keys, which are then used in hmac.new calls. This allows attackers to forge HMAC-signed JWT tokens if the application’s verification key is empty or None, a condition that can arise from unset environment variables, missing database entries, or default empty strings. This vulnerability is a cross-language sibling of CVE-2026-45363 affecting ruby-jwt. Unlike ruby-jwt and other libraries that enforce non-empty keys, joserfc lacks such a check, making it vulnerable to token forgery without requiring authentication.
Potential Impact
An attacker can forge valid HMAC-signed JWT tokens if the application uses joserfc for JWT verification and the configured secret key is empty or None. This effectively bypasses signature verification, allowing unauthorized access or privilege escalation in systems relying on joserfc for JWT authentication. The vulnerability requires no privileges or user interaction but depends on the operator misconfiguring or failing to set the JWT secret properly.
Mitigation Recommendations
No official patch or fixed release is currently available for joserfc. Operators must ensure that the JWT secret key used for verification is never empty or None. Applications should implement additional validation to reject empty keys before passing them to joserfc.jwt.decode. Monitor vendor advisories for updates or patches addressing this issue.
CVE-2026-49852: CWE-287: Improper Authentication in authlib joserfc
Description
joserfc is a Python library that provides an implementation of several JSON Object Signing and Encryption (JOSE) standards. Prior to 1.6.8, joserfc.jwt.decode accepts attacker-forged HMAC-signed tokens when the caller-supplied verification key is the empty string or None, because HMACAlgorithm.sign and HMACAlgorithm.verify in src/joserfc/_rfc7518/jws_algs.py pass the output of OctKey.get_op_key(...) to hmac.new(...) and OctKey.import_key in src/joserfc/_rfc7518/oct_key.py only emits a SecurityWarning for keys shorter than 14 bytes without rejecting zero-length input. This issue is fixed in version 1.6.8.
CVSS v4.0
Score 8.7high
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
joserfc versions <= 1.6.7 have a vulnerability in their HMAC verification implementation where the verify function accepts empty or nil keys without rejection. The OctKey.import_key method issues only a warning for keys shorter than 14 bytes but does not reject zero-length keys, which are then used in hmac.new calls. This allows attackers to forge HMAC-signed JWT tokens if the application’s verification key is empty or None, a condition that can arise from unset environment variables, missing database entries, or default empty strings. This vulnerability is a cross-language sibling of CVE-2026-45363 affecting ruby-jwt. Unlike ruby-jwt and other libraries that enforce non-empty keys, joserfc lacks such a check, making it vulnerable to token forgery without requiring authentication.
Potential Impact
An attacker can forge valid HMAC-signed JWT tokens if the application uses joserfc for JWT verification and the configured secret key is empty or None. This effectively bypasses signature verification, allowing unauthorized access or privilege escalation in systems relying on joserfc for JWT authentication. The vulnerability requires no privileges or user interaction but depends on the operator misconfiguring or failing to set the JWT secret properly.
Mitigation Recommendations
No official patch or fixed release is currently available for joserfc. Operators must ensure that the JWT secret key used for verification is never empty or None. Applications should implement additional validation to reject empty keys before passing them to joserfc.jwt.decode. Monitor vendor advisories for updates or patches addressing this issue.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-gg9x-qcx2-xmrh
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2026-49852"]
- Ecosystems
- ["PyPI"]
- Database Specific Severity
- HIGH
- Cvss Version
- 4.0
Threat ID: 6a46ecbb27e9c7971943cddf
Added to database: 07/02/2026, 22:56:59 UTC
Last enriched: 07/18/2026, 11:19:22 UTC
Last updated: 07/21/2026, 05:59:42 UTC
Views: 38
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.