Skip to content
eastbaycyber

CVE-2026-40165: authentik SAML Authentication Bypass

CVSS · High
8.7
In CISA KEV
No
Published
Oct 28
Patch SLA & TriageVector: Local
7 days

High CVSS (8.7) vulnerability; prioritize internet-facing assets.

Exposure:
Control:
CVE explainers 10 min read
Security Research Desk Source-checked
Auto-checked against the official CVE record · Human-reviewed after publishing · Updated 2026-10-28
▲ Escalation ViewOne CVE, briefed at three altitudes — skim the Brief, weigh the Impact, or work the Runbook. The way a SOC actually reads it.
CISOBrief · 30-second brief

TL;DR - CVE-2026-40165 is a high-severity authentik vulnerability that can enable SAML authentication as another user. - Affected deployments use SAML sources, signed assertions, and an upstream IdP that lets an attacker control NameID. - Upgrade to authentik 2025.12.5 or 2026.2.3. No confirmed exploitation or public proof of concept is currently known.

CVE-2026-40165 is a high-severity authentik vulnerability involving SAML identity mapping. Under specific conditions, an attacker with an account at an upstream SAML identity provider could manipulate the NameID value and authenticate to authentik as another user.

The issue affects authentik versions through 2025.12.4 and versions 2026.2.0-rc1 through 2026.2.2. Fixed releases are 2025.12.5 and 2026.2.3.

AnalystImpact · assess the risk

Are You Affected?

CVE-2026-40165 affects authentik deployments that process signed SAML assertions through a configured SAML Source. It does not affect every authentik installation. Exploitation requires:

  • An affected authentik version
  • A configured SAML Source
  • XML signing enabled for the relevant assertion
  • An attacker-controlled account at the upstream SAML identity provider
  • The ability for that attacker to influence the SAML NameID value
Field Details
CVE CVE-2026-40165
Product authentik
Severity High
CVSS base score 8.7
CVSS vector Not exposed in the supplied NVD record; confirm the current NVD entry before scoring automation
Attack vector SAML authentication flow
Authentication required An account on the upstream SAML source
Patch available Yes
Affected versions authentik 2025.12.4 and earlier; 2026.2.0-rc1 through 2026.2.2
Fixed versions authentik 2025.12.5 and 2026.2.3

Start by inventorying authentik instances and their enabled sources. Prioritize instances where SAML sources have XML signing enabled. Then determine whether the upstream identity provider allows users to alter usernames, email addresses, subject identifiers, or other attributes that become the SAML NameID.

The impact is potentially account takeover at the authentik layer. A successful attacker could cause authentik to map the manipulated identity to another existing account, including a privileged administrator account.

Organizations managing multiple identity systems should also review their vulnerability assessment process and identity-provider inventory to ensure affected authentik deployments are included.

The Fix, If You’re in a Hurry

Upgrade authentik to 2025.12.5 or later when running the 2025.12 branch. Deployments on the 2026.2 release line should upgrade to 2026.2.3 or later.

The fixed versions are:

  • 2025.12.5
  • 2026.2.3

For a Docker Compose deployment, update the authentik image tag in the compose configuration and recreate the services:

# Replace the image tag with the fixed release appropriate to your branch.
# Confirm the exact image repository and deployment procedure in your environment.
docker compose pull
docker compose up -d
docker compose ps

Pulling an image alone does not change running containers. Confirm the running version after the rollout and verify that all authentik worker and server components use the fixed release.

For Kubernetes, update the image tag in the deployment or Helm values, apply the change, and verify rollout status using your organization’s approved authentik deployment procedure.

If immediate upgrading is impossible, apply the workaround documented in the authentik security advisory. The available research confirms that a vendor-documented workaround exists but does not reproduce its exact configuration steps. Do not invent or substitute configuration changes. Consult the advisory and test the workaround against a staging SAML flow before applying it to production.

As an interim control, consider disabling affected SAML sources or preventing untrusted users from changing the upstream attribute that becomes NameID.

After remediation, invalidate sessions and require reauthentication for users who authenticated through potentially affected SAML sources if you cannot rule out prior exploitation. Review privileged accounts first.

Analyst’s Take: Patch based on configuration and account impact, not on the absence of a KEV listing or public proof of concept. The highest-priority checks are affected authentik versions, signed SAML sources, upstream control of NameID, and privileged accounts that used those flows.

How This Vulnerability Works

The vulnerability is rooted in how authentik extracted the SAML NameID value from an XML assertion. In the affected implementation, extraction could return only the text preceding the first child node rather than the complete text content of the element. XML comments are child nodes, so an attacker could use a comment to split the apparent identity value.

Conceptually, an upstream identity value could be structured so that the text before an XML comment matched another authentik account, while the remaining text preserved the attacker’s original value or otherwise satisfied upstream processing. When authentik mapped the truncated value, it could interpret the assertion as belonging to the account represented by the prefix.

The attack requires more than arbitrary internet access. The attacker needs:

  • An account at the upstream SAML source
  • The ability to influence the resulting NameID
  • A configured authentik SAML Source
  • XML signing enabled for the assertion

These conditions can exist in enterprise federations where the upstream IdP allows users or tenants to manage identity attributes.

The fix changes extraction to use the complete concatenated text content of the NameID element rather than only the text preceding the first child node. The referenced upstream fix commit is:

47dec5c6b7fb4a62bfad2ae8bddf002bde7ba774

Administrators should validate complete SAML mapping behavior after upgrading, especially where custom attribute mappings, account linking, or privileged-group mappings are configured.

Technical Notes

The vulnerable behavior concerns XML text-node handling. A simplified representation of the problematic identity shape is:

<saml:NameID>target-account<!-- attacker-controlled remainder -->@example.invalid</saml:NameID>

This is illustrative of the parsing issue, not a production exploit recipe. The security-relevant point is that the parser and application must use the full text content, not only the first text node.

Severity, Explained

The reported CVSS base score is 8.7, placing the issue in the high-severity category. The supplied NVD response did not expose the complete CVSS vector string, so the vector should be confirmed directly in the NVD record before publishing a component-by-component score breakdown.

Operationally, the high score reflects the potential security consequence: successful exploitation can bypass normal identity mapping and authenticate an attacker as another user.

The likely impact is strongest where authentik protects:

  • Administrative consoles
  • VPN access
  • Internal applications
  • Cloud control planes
  • Other systems that trust authentik as an identity provider

The prerequisites reduce exposure compared with an unauthenticated remote attack. The attacker must possess an upstream SAML account and control a value used as NameID; the target must also use an affected authentik release and matching SAML configuration.

Those requirements are not sufficient reason to defer remediation. In many organizations, upstream accounts are broadly available to employees, contractors, customers, or tenants, and a successful identity substitution could affect high-value targets.

Because the exact vector is not available in the supplied record, security teams should preserve the published score of 8.7 while verifying the current NVD entry and vendor advisory during risk acceptance, vulnerability prioritization, and compliance reporting.

Is It Being Exploited?

CVE-2026-40165 is not currently listed in CISA’s Known Exploited Vulnerabilities catalog. The supplied assessment reports on_kev: false, with no CISA date-added entry, federal remediation deadline, required action, or ransomware campaign flag.

No confirmed in-the-wild exploitation was identified in the reviewed NVD, CISA KEV, authentik advisory, or search results. No public proof-of-concept repository was identified in the reviewed sources either.

The current status is technically exploitable under the stated conditions, but neither active exploitation nor a public proof of concept is confirmed.

This status does not mean exploitation is impossible. Authentication bypass vulnerabilities in identity providers can be attractive targets, and exploitation may leave limited traces if an attacker successfully receives a normal authenticated session. Organizations should patch based on exposure and impact rather than waiting for a KEV listing or public exploit.

The supplied research note records one GitHub security advisory and the upstream fix commit, but those references are remediation and disclosure artifacts, not evidence of an operational exploit.

ResponderRunbook · act now

Detecting It in Your Environment

Detection should begin with configuration scope. Enumerate authentik instances below 2025.12.5 and 2026.2.3, then identify configured SAML sources and determine whether XML signing is enabled.

Also map which applications trust authentik and which groups or roles provide administrative access.

Review SAML authentication and authentik audit events for:

  • XML comment markers
  • Unexpectedly truncated identity values
  • Identity transformations that do not match the upstream directory record
  • Successful logins where the resolved authentik account differs from the expected upstream identity
  • Unusual successful logins to privileged accounts

Log formats differ by authentik version and deployment, so the following searches are starting points rather than guaranteed field names.

A generic search for XML comment markers in collected logs is:

# Search exported or centralized logs for XML comment syntax.
grep -RniE '<!--|-->' /var/log/authentik/ /var/log/authentik-* 2>/dev/null

For systems forwarding structured events to Elasticsearch, adapt the query to the actual field names used by your logging pipeline:

event.dataset:authentik AND
(event.action:"saml_login" OR event.action:"login") AND
(message:*"<!--"* OR message:*"-->"*)

For Splunk, a corresponding starting query is:

index=authentik
(action=saml_login OR action=login)
("<!--" OR "-->")
| table _time user source_ip action message

The most valuable correlation is not simply a literal comment marker. Compare the identity recorded by authentik with the upstream IdP subject, immutable identifier, email address, and directory account.

Also investigate unusual successful logins to administrator accounts from upstream identities that have not previously mapped to those accounts. Review:

  • Session issuance
  • Source IP
  • User agent
  • MFA events
  • Group changes
  • Downstream application access
  • Authentication timestamps

If exploitation cannot be ruled out, revoke sessions for affected users and require fresh authentication after remediation.

Technical Notes

A practical detection workflow can combine version inventory, SAML configuration review, and authentication-event correlation:

# Example: inspect the running authentik container image.
docker ps --format '{{.Image}}\t{{.Names}}' | grep -i authentik

# Example: inspect image labels or package metadata where available.
docker inspect <authentik-container> \\
  --format '{{json .Config.Image}} {{json .Config.Labels}}'

These commands do not prove that a deployment is safe. They help identify systems that require version verification. Confirm the reported version against the fixed releases and review the authentik advisory for deployment-specific validation steps.

Response and Recovery Checklist

If you identify an affected deployment, use this sequence:

  1. Confirm the authentik version and SAML configuration.
  2. Identify whether signed SAML assertions and attacker-controlled NameID values are possible.
  3. Upgrade to authentik 2025.12.5 or 2026.2.3, depending on the release branch.
  4. Apply the vendor workaround if an immediate upgrade is impossible.
  5. Review SAML authentication and authentik audit logs.
  6. Prioritize investigations involving administrator and other privileged accounts.
  7. Revoke potentially affected sessions.
  8. Require reauthentication after remediation.
  9. Review downstream access performed by suspicious or unexpectedly mapped accounts.
  10. Document the affected versions, exposure conditions, remediation date, and investigation results.

Identity infrastructure should receive the same urgency as other high-value security systems. Organizations reviewing broader defensive controls may also find value in this guide to antivirus for small businesses, although endpoint protection does not replace patching an affected identity provider.

References and Further Reading

The primary technical references are the NVD record, the authentik security advisory, the GitHub security advisory, and the upstream fix commit. Use the vendor advisory for the authoritative workaround and release-specific instructions.

Before closing an incident or risk exception, verify three facts in your environment:

  1. The authentik release actually running
  2. Whether affected SAML sources and signed assertions are enabled
  3. Whether any privileged accounts authenticated through those flows while the deployment was vulnerable

The absence of a KEV listing or public proof of concept lowers the current exploitation signal, but it does not remove the need to patch exposed identity infrastructure.

This article may contain affiliate links. We earn a commission on qualifying purchases at no extra cost to you.

Last verified: 2026-10-28

Disclaimer: This article may contain affiliate links. We earn a commission on qualifying purchases at no extra cost to you.