VYPR
Moderate severityNVD Advisory· Published Feb 26, 2026· Updated Feb 26, 2026

ZITADEL's truncated opaque tokens are still valid

CVE-2026-27840

Description

ZITADEL is an open source identity management platform. Starting in version 2.31.0 and prior to versions 3.4.7 and 4.11.0, opaque OIDC access tokens in the v2 format truncated to 80 characters are still considered valid. Zitadel uses a symmetric AES encryption for opaque tokens. The cleartext payload is a concatenation of a couple of identifiers, such as a token ID and user ID. Internally Zitadel has 2 different versions of token payloads. v1 tokens are no longer created, but are still verified as to not invalidate existing session after upgrade. The cleartext payload has a format of <token_id>:<user_id>. v2 tokens distinguished further where the token_id is of the format v2_<oidc_session_id>-at_<access_token_id>. V1 token authZ/N session data is retrieved from the database using the (simple) token_id value and user_id value. The user_id (called subject in some parts of our code) was used as being the trusted user ID. V2 token authZ/N session data is retrieved from the database using the oidc_session_id and access_token_id and in this case the user_id from the token is ignored and taken from the session data in the database. By truncating the token to 80 chars, the user_id is now missing from the cleartext of the v2 token. The back-end still accepts this for above reasons. This issue is not considered exploitable, but may look awkward when reproduced. The patch in versions 4.11.0 and 3.4.7 resolves the issue by verifying the user_id from the token against the session data from the database. No known workarounds are available.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
github.com/zitadel/zitadelGo
>= 4.0.0, < 4.11.04.11.0
github.com/zitadel/zitadelGo
>= 3.0.0, < 3.4.73.4.7
github.com/zitadel/zitadelGo
>= 2.31.0, <= 2.71.19
github.com/zitadel/zitadelGo
< 1.80.0-v2.20.0.20260216092519-feab8e1fa3711.80.0-v2.20.0.20260216092519-feab8e1fa371

Affected products

1

Patches

1
feab8e1fa371

Merge commit from fork

https://github.com/zitadel/zitadelTim MöhlmannFeb 16, 2026via ghsa
1 file changed · +7 2
  • internal/authz/repository/eventsourcing/eventstore/token_verifier.go+7 2 modified
    @@ -98,7 +98,7 @@ func (repo *TokenVerifierRepo) VerifyAccessToken(ctx context.Context, tokenStrin
     		return "", "", "", "", "", zerrors.ThrowUnauthenticated(nil, "APP-Reb32", "invalid token")
     	}
     	if strings.HasPrefix(tokenID, command.IDPrefixV2) {
    -		return repo.verifyAccessTokenV2(ctx, tokenID, verifierClientID, projectID)
    +		return repo.verifyAccessTokenV2(ctx, tokenID, subject, verifierClientID, projectID)
     	}
     	if sessionID, ok := strings.CutPrefix(tokenID, authz.SessionTokenPrefix); ok {
     		userID, clientID, resourceOwner, err = repo.verifySessionToken(ctx, sessionID, tokenString)
    @@ -132,7 +132,7 @@ func (repo *TokenVerifierRepo) verifyAccessTokenV1(ctx context.Context, tokenID,
     	return token.UserID, token.UserAgentID, token.ApplicationID, token.PreferredLanguage, token.ResourceOwner, nil
     }
     
    -func (repo *TokenVerifierRepo) verifyAccessTokenV2(ctx context.Context, token, verifierClientID, projectID string) (userID, agentID, clientID, prefLang, resourceOwner string, err error) {
    +func (repo *TokenVerifierRepo) verifyAccessTokenV2(ctx context.Context, token, subject, verifierClientID, projectID string) (userID, agentID, clientID, prefLang, resourceOwner string, err error) {
     	ctx, span := tracing.NewSpan(ctx)
     	defer func() { span.EndWithError(err) }()
     
    @@ -146,6 +146,11 @@ func (repo *TokenVerifierRepo) verifyAccessTokenV2(ctx context.Context, token, v
     	if err = verifyAudience(activeToken.Audience, verifierClientID, projectID); err != nil {
     		return "", "", "", "", "", err
     	}
    +	// If the subject doesn't match the userID from the database, the token probably got tampered with or truncated.
    +	// See https://github.com/zitadel/zitadel/security/advisories/GHSA-6mq3-xmgp-pjm5
    +	if activeToken.UserID != subject {
    +		return "", "", "", "", "", zerrors.ThrowUnauthenticated(nil, "APP-3f4fs", "invalid token")
    +	}
     	if err = repo.checkAuthentication(ctx, activeToken.AuthMethods, activeToken.UserID); err != nil {
     		return "", "", "", "", "", err
     	}
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

7

News mentions

0

No linked articles in our index yet.