/

CVE-2026-42849

Severity:

CRITICAL RISK

(9.3)

Cross-Site Scripting (CWE-79) in authentik AutosubmitStage SFE Flow

CVE-2026-42849

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Session hijacking and arbitrary actions in the authenticated browser context

Severity:

CRITICAL RISK

(9.3)

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

A cross-site scripting (XSS) vulnerability in authentik's Simple Flow Executor (SFE), specifically in the AutosubmitStage, allows malicious script injection into browser-executed content.

When a user is directed through a flow that processes attacker-controlled data in this stage, the browser may execute arbitrary JavaScript, leading to session compromise or unauthorized actions in the identity provider context.

Affected context

This vulnerability occurs in authentik deployments that use flows implemented via the Simple Flow Executor (SFE), particularly those including the AutosubmitStage to maintain compatibility with legacy browsers.

The issue manifests when data that can be influenced by an attacker is rendered into the AutosubmitStage output without sufficient encoding or sanitization, allowing scripts to be injected into the HTML or JavaScript executed by the end user's browser.

It is most relevant where users are redirected or auto-submitted through flows that process external or user-controllable parameters.

Exploit preconditions

  • Attack surface: Web-based flows in authentik exposed to end users via browsers.
  • Required access: Ability to control or influence data that is rendered inside the AutosubmitStage (e.g., crafted URLs, parameters, or data sources feeding the flow).
  • Trigger point: A victim user (often authenticated) must load or be redirected to a flow that includes the AutosubmitStage containing the injected content in their browser.
  • Why exploitation is possible: The AutosubmitStage rendering logic did not consistently perform context-appropriate output encoding, allowing attacker-controlled data to be interpreted as executable script by the browser.

Why this happens

The root cause is insufficient output encoding for user-controllable content rendered by the AutosubmitStage within the Simple Flow Executor.

In order to remain compatible with legacy browsers, the stage likely relied on auto-submitting HTML or script-heavy templates, but failed to properly escape or sanitize data that could be influenced by an attacker.

This aligns with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting), where untrusted input is incorporated into a web page in a way that lets the browser treat it as active script rather than inert data.

Potential impact

  • Theft of session cookies or tokens associated with authentik or related applications (where not otherwise protected).
  • Execution of arbitrary JavaScript in the context of the authentik domain, which could manipulate flows, approvals, or user attributes.
  • Unauthorized actions performed on behalf of the victim user through forged requests in the browser context.
  • Phishing or UI redress within the identity provider interface, misleading users into disclosing additional sensitive information.

General mitigation guidance

Effective mitigation focuses on treating all data rendered into flow stages as untrusted unless strictly proven otherwise.

Common defensive patterns include:

  • Applying context-aware output encoding for all variables rendered into HTML, attributes, URLs, and inline JavaScript within stages like AutosubmitStage.
  • Avoiding inline script execution where possible and favoring Content Security Policy (CSP) that disallows unsafe-inline script and restricts script sources.
  • Minimizing or eliminating dynamic HTML/JS construction for auto-submit flows; use standard, declarative markup and event handlers where feasible.
  • Clearly separating trusted configuration from user- or externally supplied data, and sanitizing any values that cross that boundary before rendering.
  • Designing flows so that browser-side auto-submission is not required for correctness, reducing dependency on fragile, script-heavy compatibility workarounds.

How teams detect issues like this

Detection efforts can focus on both code patterns and runtime behavior:

  • Static analysis rules searching for direct injection of request parameters or flow variables into templates or JavaScript within SFE and AutosubmitStage code paths without encoding.
  • Code review checklists that specifically flag:
  • Inline JavaScript in templates.
  • Use of unescaped variables in HTML, script blocks, or event handler attributes.
  • Manual string concatenation to build HTML or script fragments.
  • Template linting or security-focused template engines that enforce or default to escaping, with explicit opt-outs that are reviewed carefully.
  • Application security testing (DAST) targeting flow endpoints with XSS payloads in query parameters, form fields, and other flow inputs to observe whether scripts are reflected and executed.
  • Optional use of automated SAST/IAST tools configured to detect CWE-79 within the authentication and flow-handling components.

Sources

SourceLink
github.comgithub.com/goauthentik/authentik/security/advisories/GHSA-pgff-5mx8-fqj3

Frequently asked

questions

Yes. An attacker can remotely trigger the issue by crafting links or requests that cause attacker-controlled data to be processed by the AutosubmitStage. Exploitation requires a victim to load the maliciously crafted flow in a browser.

Often the attacker aims at authenticated users (e.g., administrators or regular users logged into authentik) because the impact is greater in that context. However, whether the attacker must themselves be authenticated depends on how the flows and parameters are exposed and whether untrusted parties can influence inputs to the AutosubmitStage.

Apply strict, context-aware output encoding for all data rendered into templates used by the AutosubmitStage and other flow stages, avoid inline scripts, and, where possible, redesign flows to rely on standard form submissions instead of custom script-based auto-submit logic.

Use templating systems that escape variables by default, adopt a strong Content Security Policy, ban unsafe inline JavaScript patterns in coding standards, and integrate security-focused code review and automated static analysis specifically targeting CWE-79 in all web-facing components.

Find out what's already
exploitable in your codebase.