/

CVE-2026-77177

Severity:

CRITICAL RISK

(9.8)

Server-Side Template Injection (CWE-94) in Open GenAI Stack

CVE-2026-77177

Deferred

Vulnerability type

Category:

Server-Side Template Injection

CWE:

CWE-94

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

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

Open GenAI Stack contains a server-side expression evaluation flaw in its prompt-processing workflow. A crafted prompt containing template syntax may execute attacker-controlled expressions on the backend when input is processed without adequate sanitization, potentially resulting in arbitrary code execution.

Affected context

The vulnerability occurs in Open GenAI Stack deployments that process user-controlled prompts through Jinja2 or a similar template engine. Risk increases when prompt content is incorporated into templates and evaluated without strict separation between data and executable template logic, including deployments supporting Meta AI backend integrations or other connected products.

Exploit preconditions

  • Attack surface: Prompt-processing or AI backend interfaces that accept attacker-influenced text
  • Required access: The ability to submit or influence prompts reaching the vulnerable template-rendering workflow
  • Trigger point: Server-side processing of prompt content containing template expressions
  • Why exploitation is possible: Template syntax is evaluated as executable server-side logic because input is not sufficiently sanitized or isolated from the template engine

Why this happens

The underlying bug is a server-side template injection condition mapped to CWE-94: Improper Control of Generation of Code. Untrusted prompt content is allowed to reach a Jinja2 expression-evaluation context, causing data intended for model interaction to be interpreted as template logic. The insecure pattern is treating user-controlled text as part of an executable template rather than as inert data.

Potential impact

  • An attacker may execute arbitrary code in the backend process context
  • Sensitive application secrets or environment data could be exposed
  • Connected services, models, or data stores may be accessed or modified
  • The AI backend could be used for persistence, lateral movement, or service disruption
  • Downstream products may experience data integrity or supply-chain risks

General mitigation guidance

Mitigation generally focuses on ensuring that untrusted prompts remain data throughout processing.

Common defensive patterns include:

  • Avoiding evaluation of user-controlled text as a template
  • Using fixed templates with explicit variable binding and strict allowlists
  • Disabling unnecessary template features, functions, filters, and object access
  • Applying context-aware validation before template processing
  • Separating prompt rendering from privileged backend operations
  • Running the service with least privilege and tightly scoped access to secrets and connected systems
  • Enforcing isolation boundaries so a compromised worker cannot freely reach internal resources

How teams detect issues like this

Organizations can look for server-side template injection risks through:

  • Static analysis rules identifying template rendering of request, prompt, or message content
  • Code review checks for concatenation of untrusted text into Jinja2 templates
  • Dependency and configuration reviews for enabled template features or unrestricted expression evaluation
  • Runtime monitoring for unexpected template errors, expression markers, child processes, or unusual outbound connections
  • Policy enforcement requiring fixed templates, explicit variable binding, and security tests for prompt-processing paths

Automated code review and application security testing tools may help identify unsafe data-to-template flows.

Sources

SourceLink
gist.github.comgist.github.com/abhi04anon/8ce0b68a5a7dda8a0501cbaf933173eb

Frequently asked

questions

It may be remotely exploitable when an exposed prompt or message interface sends attacker-controlled content to the vulnerable server-side template-processing path.

The attacker generally needs the ability to submit or influence prompts processed by the affected backend. Authentication requirements depend on the deployment's access controls.

Keep prompts and other user-controlled text as inert data, use fixed templates with explicit variable binding, and prevent untrusted content from reaching unrestricted expression evaluation.

Review all data-to-template flows, restrict template capabilities, apply least privilege, test prompt-processing boundaries, and monitor backend execution for unexpected behavior.

Find out what's already
exploitable in your codebase.