MEDIUM 4.8

CVE-2026-57997: Strapi JWT Algorithm Bypass via Weak Configuration

Strapi's users-permissions plugin has a cryptographic configuration flaw that allows attackers to bypass JWT (JSON Web Token) authentication controls. When administrators don't explicitly set the allowed JWT algorithm in their configuration, the plugin accepts multiple HMAC variants (HS384 and HS512) in addition to the default HS256. If an attacker obtains the JWT secret key—whether through a separate compromise, supply chain attack, or insider access—they can create valid tokens using these alternative algorithms to impersonate users and gain unauthorized access.

Source data · NVD / CISA · public domain

CVSS
3.1 · 4.8 MEDIUM · CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N
Weaknesses (CWE)
CWE-327
Affected products
1 configuration(s)
Published / Modified
2026-06-29 / 2026-07-01

NVD description (verbatim)

Strapi users-permissions plugin fails to restrict JWT algorithms when plugin::users-permissions.jwt.algorithm is not explicitly configured, allowing acceptance of HS384 and HS512 tokens alongside HS256. Attackers possessing the jwtSecret can mint tokens with non-standard HMAC variants to bypass algorithm restrictions and weaken authentication controls.

4 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability stems from insufficient algorithm whitelisting in Strapi's JWT validation logic. The plugin::users-permissions.jwt.algorithm configuration parameter, when absent or not explicitly set, fails to restrict token validation to a single HMAC algorithm. This permits acceptance of HS384 and HS512 tokens alongside HS256, violating the principle of cryptographic agility control. An attacker with knowledge of the jwtSecret can forge tokens using any accepted variant, effectively bypassing the authentication mechanism's intended algorithm constraints. The flaw is classified under CWE-327 (Use of a Broken or Risky Cryptographic Algorithm) because it allows weaker algorithm negotiation than intended.

Business impact

This vulnerability primarily affects Strapi instances where the JWT secret has been compromised through secondary means—misconfigurations, exposed configuration files, or insider threats. The direct business impact is authentication bypass and unauthorized user impersonation, leading to potential data access, modification, or deletion depending on the compromised user's role. For multi-tenant or SaaS deployments, this could enable lateral movement between tenants if secrets are shared. The attack requires both the JWT secret and knowledge of the vulnerable configuration, making it a chained exploitation scenario rather than a standalone remote attack, which moderates the overall risk.

Affected systems

Strapi versions using the users-permissions plugin are affected when the plugin::users-permissions.jwt.algorithm configuration parameter is not explicitly defined. The vulnerability does not require a specific Strapi version number; rather, it affects any installation relying on default JWT algorithm handling without explicit configuration. Administrators should audit their Strapi configuration files (typically in config/plugins.js or environment-specific overrides) to determine if this parameter is present and set to a single algorithm.

Exploitability

Exploitation requires two preconditions: (1) access to or knowledge of the jwtSecret, and (2) an instance with the JWT algorithm parameter not explicitly configured. Without the secret, tokens cannot be forged. This dual requirement elevates the attack complexity from trivial to moderate. The CVSS score of 4.8 (Medium severity) reflects this—network-accessible but requiring high attack complexity and no user interaction. This is not an unauthenticated remote code execution; it is a privilege escalation or lateral movement vector for attackers who have already compromised the secret through a separate attack.

Remediation

Organizations should immediately review their Strapi configuration to explicitly set plugin::users-permissions.jwt.algorithm to a single, strong algorithm (HS256 recommended). This enforces strict algorithm validation and prevents acceptance of HS384 or HS512 variants. Additionally, rotate the jwtSecret if there is any suspicion it may have been exposed. Review JWT token logs for anomalies such as tokens using unexpected algorithms. For high-sensitivity deployments, consider migrating from HMAC-based signing to asymmetric algorithms (RS256 or ES256) if Strapi supports it, as this further isolates the secret from token verification processes.

Patch guidance

Consult the official Strapi security advisory and release notes for your specific version. Verify the exact configuration parameter name and correct format against the vendor's documentation. At minimum, ensure plugin::users-permissions.jwt.algorithm is present in your configuration and set to 'HS256' or your organization's approved algorithm. Test the change in a staging environment before deploying to production to ensure existing tokens remain valid or that a token refresh mechanism is in place. Document the configuration change in your change management system.

Detection guidance

Monitor JWT validation logs for tokens that use HS384 or HS512 algorithms; these should be rare or absent in properly configured deployments. Implement alerting on algorithm mismatch or algorithm negotiation attempts. Review Strapi configuration files and environment variables during security audits to confirm explicit algorithm configuration is present. Consider JWT token introspection tools that can decode and display the 'alg' header field in inbound requests, allowing you to verify compliance with your expected algorithm.

Why prioritize this

This vulnerability should be prioritized for configuration review rather than emergency patching, as exploitation requires the jwtSecret to be compromised first. Organizations should treat this as a defense-in-depth hardening measure: audit configuration now, rotate secrets if any doubt exists, and enforce strict algorithm validation. For Strapi deployments handling sensitive data (healthcare, finance, authentication), prioritize higher due to the authentication bypass risk. For public-facing Strapi instances, this is lower priority unless the jwtSecret is believed to be at risk.

Risk score, explained

The CVSS 3.1 score of 4.8 (Medium) reflects a network-accessible attack requiring high attack complexity and prior possession of the jwtSecret. There is no confidentiality impact beyond the scope of what the compromised user can access (C:L), no integrity impact directly from the token itself (I:L, contingent on the user's permissions), and no availability impact (A:N). The score is not critical or high because the attack is not remotely exploitable in isolation; it requires a second-stage compromise of the secret. However, the impact is real for organizations where this has occurred, justifying the Medium classification.

Frequently asked questions

Do I need to apply a software patch, or is this a configuration fix?

This is primarily a configuration vulnerability. No software patch is strictly required; rather, you must explicitly set the plugin::users-permissions.jwt.algorithm parameter in your Strapi configuration. Check with Strapi's official advisory to confirm whether a code fix addresses this in newer versions, but the immediate mitigation is configuration hardening.

What if I don't know my current jwtSecret or whether it has been exposed?

Treat any uncertainty as a breach scenario. Rotate your jwtSecret immediately in your configuration, invalidate all existing tokens if possible, and force users to re-authenticate. Review your secret storage practices (avoid hardcoding in source control, use environment variables or secrets managers) to prevent future exposure.

Can this vulnerability be exploited without network access to Strapi?

No, exploitation requires the ability to present a forged JWT token to the Strapi instance over the network. However, if an attacker has already compromised your jwtSecret (e.g., through a code repository breach or insider threat), they can create valid tokens remotely without further access.

Should I switch to RS256 or asymmetric algorithms?

Asymmetric algorithms (RS256, ES256) provide stronger separation of concerns—the public key is used for verification, and only the private key can sign tokens. If your Strapi version and authentication architecture support this migration, it is a worthwhile long-term hardening step, as it eliminates the risk of a shared secret being used to forge tokens.

This analysis is provided for informational purposes and reflects the vulnerability details as of the published date. Consult official Strapi security advisories, release notes, and your vendor's patch guidance for definitive remediation steps. No exploit code or proof-of-concept is provided. Organizations should conduct their own risk assessment based on their deployment architecture, data sensitivity, and threat model. This content does not constitute legal or compliance advice. Source: NVD (public-domain), retrieved 2026-08-08. Analysis generated by SEC.co (claude-haiku-4-5).