/

CVE-2026-55789

Severity:

HIGH RISK

(8.5)

XML Injection (CWE-91) in Logto SAML IdP Responses

CVE-2026-55789

Deferred

Vulnerability type

Category:

XML Injection in Security Assertions

CWE:

CWE-91

Impact:

Privilege Escalation via Forged SAML Attributes

Severity:

HIGH RISK

(8.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Logto's self-hosted SAML IdP previously built signed SAML responses by inserting user-controlled profile attributes directly into XML element text without proper escaping.

An authenticated low-privilege user could inject XML markup to forge signed SAML attributes, such as roles, enabling privilege escalation at Service Providers that trust those attributes.

Affected context

This vulnerability appears in Logto deployments running the self-hosted SAML application IdP where user profile attributes (name, email, and custom attribute mappings) are used to construct SAML assertions.

The issue manifests when the SAML response and assertion are created via string substitution into XML templates without escaping, while downstream Service Providers make authorization decisions based on the signed SAML attributes.

Exploit preconditions

  • Attack surface: SAML Single Sign-On flow using Logto as an IdP for one or more Service Providers.
  • Required access: Authenticated user account with the ability to modify their own profile attributes or custom-mapped attributes.
  • Trigger point: Initiation of a SAML login/SSO flow after the attacker has saved XML markup in a profile attribute value.
  • Why exploitation is possible: The SAML XML template is populated via unescaped string substitution, so user-controlled data is interpreted as XML markup inside a signed assertion instead of as plain text.

Why this happens

The core issue is treating user-controlled strings as trusted XML element content without robust escaping or canonicalization, and building security assertions through raw string templating.

In terms of CWE-91 (XML Injection), user attributes are inserted directly into XML templates, allowing attackers to alter the structure or semantics of the generated XML document, including security-critical attributes.

Because the IdP signs the resulting XML, the forged attributes become cryptographically trusted by Service Providers that rely solely on the signature rather than validating the provenance and format of attribute values.

Potential impact

  • An attacker may escalate their privileges at one or more Service Providers by forging higher-privilege roles or group memberships.
  • An attacker could gain unauthorized access to protected features or administrative functions that rely on SAML attribute-based authorization.
  • Multi-tenant or multi-SP environments could experience cross-application trust abuse where a low-privilege account is elevated across several relying parties.
  • Audit trails and access logs can be misleading because the forged attributes appear signed and legitimate, complicating incident response.

General mitigation guidance

Effective mitigation focuses on eliminating unescaped XML construction and reducing trust in user-controlled data within security assertions.

Recommended patterns include:

  • Using dedicated SAML and XML libraries that build assertions via structured APIs and automatically escape attribute values instead of raw string templating.
  • Treating all profile attributes as untrusted input and aggressively escaping or encoding them before insertion into XML, ensuring they cannot change document structure.
  • Designing attribute-mapping logic so that authorization-critical attributes (roles, groups, privileges) are derived from controlled server-side sources, not directly from user-editable fields.
  • Applying least-privilege principles at relying Service Providers, ensuring that critical operations require multiple signals (e.g., roles plus context checks) rather than a single attribute.
  • Implementing defense-in-depth by validating attribute formats (e.g., strict schemas, whitelists) before producing or consuming SAML assertions.

How teams detect issues like this

Organizations can detect similar XML injection risks by:

  • Reviewing SAML and XML generation code for manual string concatenation, template substitution, or interpolation involving user-supplied values.
  • Applying static analysis rules that flag direct insertion of untrusted data into XML or SAML structures without escaping, especially in security-sensitive components.
  • Establishing secure coding guidelines and PR checks forbidding hand-crafted XML for identity, authentication, or authorization flows when robust libraries exist.
  • Inspecting SAML assertions during testing with intentionally malformed or XML-like profile data to verify that values are safely encoded and cannot alter document structure.
  • Using automated security testing tools capable of fuzzing XML inputs and observing deviations in SAML output or authorization behavior.

Sources

SourceLink
github.comgithub.com/logto-io/logto/commit/9097054860f0d638d90778d3dcde2ba050b844b6
github.comgithub.com/logto-io/logto/pull/9107
github.comgithub.com/logto-io/logto/releases/tag/v1.41.0
github.comgithub.com/logto-io/logto/security/advisories/GHSA-vfpw-vq44-4p63

Frequently asked

questions

Exploitation is limited to users who can modify their own profile or mapped attributes, but any Service Provider that trusts Logto's signed SAML attributes for authorization may be affected. The impact can span multiple applications if the same IdP is integrated widely.

The attacker only needs an authenticated, low-privilege account with the ability to edit profile attributes or custom attribute-mapping values. No direct administrative access to the IdP or Service Providers is required.

The safest approach is to stop generating SAML XML via manual string templating and instead rely on structured SAML libraries that escape all attribute values. Additionally, authorization-critical attributes should originate from controlled server-side data sources rather than user-editable fields.

Preventing recurrence involves adopting secure coding standards for identity and XML handling: use well-vetted SAML libraries, treat all user data as untrusted, enforce strict encoding and schema validation for attributes, and ensure authorization decisions at Service Providers are resilient to malformed or unexpected attribute values.

Find out what's already
exploitable in your codebase.