CVE-2026-5559
Improper Neutralization in PyBlade AST Validation Enables Remote Attack
Publication date: 2026-04-05
Last updated on: 2026-04-29
Assigner: VulDB
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| antaresmugisho | pyblade | From 0.1.8-alpha (inc) to 0.2.0-alpha (inc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-1336 | The product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine. |
| CWE-791 | The product receives data from an upstream component, but does not completely filter special elements before sending it to a downstream component. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
The vulnerability in PyBlade versions 0.1.8-alpha and 0.1.9-alpha arises from a logic flaw in the _is_safe_ast() function within sandbox.py, which improperly validates Abstract Syntax Tree (AST) nodes during template rendering.
Specifically, the function only checks ast.Name nodes against a whitelist but ignores ast.Constant nodes, allowing attackers to bypass security checks and access dangerous Python magic methods like __class__.
This enables attackers to traverse Python's object model (e.g., __mro__, __subclasses__) and inject malicious code remotely via crafted templates.
In version 0.2.0-alpha, the vulnerability is even more severe because the evaluator.py file uses Python's eval() function directly on expressions without any AST validation, making arbitrary code execution trivial.
How can this vulnerability impact me? :
This vulnerability allows remote attackers to perform arbitrary code execution on the server by injecting malicious templates.
Successful exploitation can lead to full system compromise, including unauthorized access to system commands and sensitive data.
How can this vulnerability be detected on my network or system? Can you suggest some commands?
The vulnerability in PyBlade versions 0.1.8-alpha and 0.1.9-alpha arises from unsafe AST validation in the _is_safe_ast() function, allowing Server-Side Template Injection (SSTI) and Remote Code Execution (RCE). Detection involves identifying if your system is running these vulnerable versions and if templates are being rendered without proper AST validation.
To detect exploitation attempts, monitor logs for suspicious template expressions that attempt to access Python's object model, such as payloads containing '__class__', '__mro__', or '__subclasses__'.
- Check the PyBlade version installed on your system to confirm if it is vulnerable (v0.1.8-alpha or v0.1.9-alpha).
- Search application logs or template inputs for suspicious template expressions like: {{ ''.__class__.__mro__[1].__subclasses__() }} or similar patterns.
- Use commands such as grep or similar tools to scan source code or logs for unsafe eval usage or the presence of the vulnerable _is_safe_ast function in sandbox.py.
- Example command to find suspicious template usage in logs: grep -r "__class__" /path/to/logs/
- Example command to check PyBlade version: pip show pyblade
What immediate steps should I take to mitigate this vulnerability?
The primary mitigation step is to upgrade PyBlade to the latest version that includes the fix introduced in commit 62c95c47 (dated 2026-02-24). This fix implements a SafeEvaluator class that properly validates all AST node types, blocks access to private attributes, and restricts method calls to a whitelist.
Until an upgrade is possible, avoid using vulnerable versions (0.1.8-alpha and 0.1.9-alpha) in production environments and restrict template inputs to trusted users only.
- Upgrade PyBlade to the fixed version that includes the SafeEvaluator implementation.
- Audit and sanitize all template inputs to prevent injection of malicious expressions.
- Monitor logs for exploitation attempts and block suspicious requests at the network or application firewall level.
- If possible, apply additional runtime restrictions such as limiting permissions of the application user to reduce impact of potential exploitation.
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
The vulnerability in PyBlade allows remote attackers to perform arbitrary code execution on the server by injecting malicious templates, potentially leading to full system compromise.
Such a compromise could result in unauthorized access to sensitive data, which may impact compliance with data protection regulations like GDPR and HIPAA that require safeguarding personal and health information.
However, the provided information does not explicitly discuss the direct effects of this vulnerability on compliance with these standards or any regulatory implications.