/

CVE-2026-25227

Severity:

CRITICAL RISK

(9.1)

Code Injection in authentik Delegated Permissions

CVE-2026-25227

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution within the authentik Server Container

Severity:

CRITICAL RISK

(9.1)

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

authentik's delegated permissions feature contains a code injection flaw where users with specific "view" permissions can execute arbitrary code through the property mapping/policy test endpoint.

In affected versions, the endpoint that previews mappings and expression policies evaluates attacker-controlled input on the server, allowing remote code execution inside the authentik container when misused by a low-privileged but authenticated user.

Affected context

This vulnerability affects authentik deployments that:

  • Run versions from 2021.3.1 up to (but not including) 2025.8.6, 2025.10.4, or 2025.12.4, and
  • Use delegated permissions for managing property mappings or expression policies, and
  • Grant users the capability "Can view * Property Mapping" or "Can view Expression Policy."

In these conditions, the "test" or "preview" endpoint used to evaluate how a property mapping or expression policy behaves can be reached by users who are only supposed to view configuration, but can instead trigger server-side code execution.

Exploit preconditions

  • Attack surface: HTTP(S) API/UI exposed by the authentik server, specifically the endpoint that tests property mappings or expression policies.
  • Required access: An authenticated account with delegated permissions that include either:
  • "Can view * Property Mapping", or
  • "Can view Expression Policy".
  • Trigger point: Invoking the test/preview functionality for a property mapping or expression policy, supplying crafted input that the server-side evaluation engine processes.
  • Why exploitation is possible: The test endpoint executes expressions or mappings using a powerful evaluation context without adequately separating "view-only" capability from "evaluate arbitrary expression" capability. User-controlled expression content is interpreted as executable logic on the server, enabling arbitrary code execution rather than a constrained, data-only evaluation.

Why this happens

The root cause is a code injection vulnerability consistent with CWE-94: Improper Control of Generation of Code ('Code Injection').

The application exposes a dynamic expression or policy evaluation mechanism to support flexible property mappings and policies. The test endpoint reuses this evaluation engine but fails to impose strict limits on what expressions can be executed or who can execute them. Viewing and testing are conflated: "view" permissions still permit the user to trigger evaluation of expressions that can contain or expand into server-side code.

Conceptually, this is an insecure design where:

  • Data (expressions and mappings) is treated as executable code.
  • Security boundaries around delegated permissions assume "view" is read-only, but the underlying operation (evaluation) is not read-only.
  • The evaluation engine likely has access to sensitive runtime objects, leading to arbitrary code execution when misused.

Potential impact

  • Remote execution of arbitrary code within the authentik server container.
  • Complete compromise of the identity provider instance (including configuration, secrets accessible to the process, and session data).
  • Impersonation of users and unauthorized issuance or modification of tokens and assertions.
  • Lateral movement into adjacent services relying on authentik for authentication or SSO.
  • Data exfiltration of user directories, OAuth/OIDC client secrets, and integration credentials.
  • Disruption of authentication services, including denial of service by altering critical policies or mappings.

General mitigation guidance

Addressing this class of issue usually involves reducing the power of dynamic evaluation and hardening permission boundaries:

  • Constrain expression engines:
  • Use sandboxed, domain-specific expression languages rather than exposing general-purpose code execution.
  • Limit accessible built-ins, modules, and objects to a minimal, well-reviewed API surface.
  • Separate view and execute privileges:
  • Treat "test" or "preview" capabilities as an active operation requiring a distinct permission beyond simple "view."
  • Ensure delegated permissions cannot invoke dynamic evaluation unless explicitly intended and strictly controlled.
  • Validate and restrict inputs:
  • Enforce static validation of expressions/policies to ensure they conform to a safe subset (e.g., no calls out to arbitrary functions or system APIs).
  • Reject or neutralize constructs that would escape the intended policy/mapping domain.
  • Privilege minimization at runtime:
  • Run the authentik service with the least OS and network privileges necessary.
  • Segment secrets and restrict what the evaluated expressions can reach in memory or environment variables.
  • Secure-by-default configuration:
  • Disable or tightly restrict "test"/"preview" functionality in production or expose it only to highly trusted administrative roles.
  • Document security implications of delegated permissions and avoid granting broad "view *" rights when not strictly necessary.

How teams detect issues like this

Organizations can detect or monitor for this vulnerability class by focusing on dynamic evaluation hotspots and permission design:

  • Static analysis and code scanning:
  • Search for use of generic expression or template evaluators that receive user-influenced input (e.g., policy evaluation frameworks, template engines with execution capabilities).
  • Flag code paths where "view" or read-only permissions are allowed to hit endpoints that call dynamic evaluators or interpreters.
  • Manual code review:
  • Review any "test," "preview," or "debug" endpoints to ensure they cannot be reached by low-privileged users and do not evaluate arbitrary expressions.
  • Check that delegated permissions are implemented in a least-privilege manner, with explicit separation between viewing configuration and executing it.
  • Runtime monitoring and logging:
  • Log invocations of expression/policy test endpoints with user identity and expression content (with care for sensitive data handling).
  • Monitor for unusual spikes in evaluation calls or complex, uncharacteristic expressions originating from non-admin users.
  • Security policy enforcement in CI/CD:
  • Integrate SAST/IAST tools that recognize patterns indicative of code injection risk (dynamic evaluation of configurable expressions).
  • Use policy-as-code rules to block merges that introduce new powerful evaluation endpoints without adequate access control checks.

Sources

SourceLink
github.comgithub.com/goauthentik/authentik/commit/c691afaef164cf73c10a26a944ef2f11dbb1ac80
github.comgithub.com/goauthentik/authentik/releases/tag/version%2F2025.10.4
github.comgithub.com/goauthentik/authentik/releases/tag/version%2F2025.12.4
github.comgithub.com/goauthentik/authentik/releases/tag/version%2F2025.8.6
github.comgithub.com/goauthentik/authentik/security/advisories/GHSA-qvxx-mfm6-626f

Frequently asked

questions

Exploitation is limited to authenticated users who are granted specific delegated permissions ("Can view * Property Mapping" or "Can view Expression Policy"). However, in environments where such permissions are broadly delegated, this can effectively become a high-impact, low-privilege remote code execution path.

No. The attacker only needs an account with the affected "view" permissions. They do not need full administrator privileges, which makes the issue particularly severe if delegated permissions are used widely across teams or tenants.

The safest pattern is to decouple "view" and "execute" behaviors and to ensure test/preview endpoints only evaluate expressions under tightly controlled, sandboxed conditions. Expressions should be interpreted by a restricted, domain-specific engine that cannot access arbitrary system resources or execute arbitrary code.

Avoid treating configuration, expressions, or templates as direct inputs to general-purpose code execution APIs. When dynamic behavior is required, use constrained expression languages, apply strict authorization checks to any "test" or "preview" functions, and follow least-privilege principles for delegated permissions and runtime execution contexts.

Find out what's already
exploitable in your codebase.