/

CVE-2026-79310

Severity:

HIGH RISK

(8.5)

Server-Side Template Injection (CWE-94) in web.py 0.76

CVE-2026-79310

Awaiting Analysis

Vulnerability type

Category:

Server-Side Template Injection

CWE:

CWE-94

Impact:

Arbitrary Code Execution

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

web.py 0.76 contains a server-side template injection vulnerability that can bypass built-in template security checks when attacker-controlled templates are precompiled and later rendered.

If an attacker can write to the template source directory, the resulting code execution may allow arbitrary Python operations and OS command execution on the server.

Affected context

The vulnerability occurs in web.py applications that:

  • Use the web.py template engine
  • Precompile templates from a directory that an attacker can modify
  • Later render those templates through the precompiled template loader
  • Rely on template security checks that do not remain effective across the precompilation and loading boundary

The risk depends on whether untrusted users or processes can write template source files or influence the precompiled template workflow.

Exploit preconditions

  • Attack surface: Server-side template compilation and rendering
  • Required access: Ability to write or otherwise control files in the template source directory
  • Trigger point: Application precompilation followed by rendering through the precompiled template loader
  • Why exploitation is possible: Attacker-controlled template code can be embedded during precompilation and later executed outside the intended sandbox restrictions

Why this happens

The underlying issue is a server-side template injection flaw caused by treating attacker-influenced template source as trusted code during precompilation.

Security checks intended to reject dangerous template constructs are bypassed because the precompiled template path does not preserve the same trust and validation guarantees as the normal template-processing path. This maps to CWE-94: Improper Control of Generation of Code, where input can influence the creation or execution of program code.

Potential impact

  • Arbitrary Python code execution on the application server
  • OS command execution with the privileges of the web application
  • Access to application secrets, files, and environment variables
  • Modification or destruction of application data
  • Potential lateral movement into connected services or infrastructure

General mitigation guidance

Mitigation generally focuses on preventing untrusted content from entering executable template workflows and maintaining consistent validation across all rendering paths.

Common defensive patterns include:

  • Treating templates as trusted application code rather than user-controlled data
  • Preventing untrusted users and processes from writing to template directories
  • Using non-executable rendering mechanisms for user-provided content
  • Applying strict allowlisted template syntax and validation before compilation
  • Separating template storage from writable upload and temporary-file locations
  • Running the application with least privilege and restricting access to sensitive resources
  • Limiting available operating-system capabilities for the rendering process

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis rules identifying dynamic template compilation or rendering of user-influenced paths
  • Code review checks for writable template directories and precompiled-template loaders
  • Taint analysis tracing file writes or request data into template compilation APIs
  • Runtime monitoring for unexpected template creation, compilation, or execution
  • File integrity policies that restrict changes to application template directories
  • CI security checks that test whether sandbox restrictions remain effective across compilation and loading paths

Automated code review and application security testing tools may help identify unsafe template flows, but findings should be validated against the application's actual file-permission and rendering design.

Sources

SourceLink
github.comgithub.com/lichoin/TraceLoom/blob/main/CVEs/CVE-2026-79310.md
github.comgithub.com/webpy/webpy

Frequently asked

questions

It can be exploitable through an application workflow if a remote or indirectly controlled actor can write to the template source directory and cause the affected templates to be precompiled and rendered. Without that write capability, the described attack path is generally unavailable.

Authentication is not the defining requirement. The critical prerequisite is the ability to influence files used by the precompilation process, which may result from authenticated features, unsafe uploads, compromised services, or overly permissive filesystem access.

Keep template sources in a trusted, non-writable location and ensure that all template compilation and loading paths enforce strict allowlisted syntax and validation. User-provided content should be rendered as data, not executable template code.

Maintain clear trust boundaries around templates, review file permissions, test sandbox behavior across precompiled and normal rendering paths, and run the application with minimal privileges and restricted operating-system access.

Find out what's already
exploitable in your codebase.