CVE-2026-79310
SSTI in web.py 0.76 allows bypassing sandbox to execute arbitrary Python/OS commands.
- CVSS 8.5
- CWE-94
- Input Validation and Sanitization
- Remote
webpy web.py 0.76 is vulnerable to server-side template injection (SSTI). The template engine can be tricked into executing attacker-controlled template code that built-in security checks are designed to reject. When an application precompiles templates from a directory the attacker can write to and later renders them through the precompiled template loader, the sandbox is bypassed and the attacker's code runs, resulting in arbitrary Python code execution and OS command execution on the server.
- CWE
- CWE-94
- CVSS base score
- 8.5
- Published
- 2026-09-23
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- webpy
- Fixed by upgrading
- Yes
Solution
Upgrade web.py to version 0.62 or later (the current release fixes the SSTI issue).
Vulnerable code sample
import os
from web import template
def render_user_template(template_dir, tmpl_name, context):
"""
Render a template that may have been written by an attacker.
The directory is precompiled, which bypasses the sandbox.
"""
# VULNERABLE: precompiling untrusted templates allows SSTI
tmpl = template.render(template_dir, globals={})
tmpl.precompile()
return tmpl.render(tmpl_name, **context)Patched code sample
import os
from web import template
def render_user_template(template_dir, tmpl_name, context):
"""
Render a template that may have been written by an attacker.
The directory is rendered without precompilation to keep the sandbox.
"""
# FIX: avoid precompiling untrusted templates
tmpl = template.render(template_dir, globals={})
return tmpl.render(tmpl_name, **context)Cite this entry
@misc{vaitp:cve202679310,
title = {{SSTI in web.py 0.76 allows bypassing sandbox to execute arbitrary Python/OS commands.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-79310},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-79310/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
