| Titel | pyspur-dev pyspur <= 0.1.18 Server-Side Template Injection (SSTI) (CWE-1336) |
|---|
| Beschreibung | # Technical Details
A Server-Side Template Injection (SSTI) exists in the `apply_template` method in `backend/pyspur/rag/chunker.py` and `backend/pyspur/nodes/subworkflow/base_subworkflow_node.py` of pyspur.
The application fails to sandbox Jinja2 templates, evaluating raw `jinja2.Template()` without a `SandboxedEnvironment`.
# Vulnerable Code
File: backend/pyspur/rag/chunker.py
Method: apply_template
Why: Without wrapping the template engine in a SandboxedEnvironment, Jinja2 exposes its native global namespace to the evaluation context. An attacker can use standard Jinja2 built-in functions, such as `lipsum`, to traverse object attributes to reach the `__globals__` dictionary and execute system commands.
# Reproduction
1. Construct and send a POST request to `/api/rag/collections/preview_chunk/`.
2. Provide a payload using `{{ lipsum.__globals__['os'].popen('commands').read() }}` in the `chunking_config` JSON.
3. The server renders the Jinja2 template and executes the OS command.
# Impact
- Remote Code Execution (RCE) on the underlying server.
- Exfiltration of sensitive API keys and environment variables.
|
|---|
| Quelle | ⚠️ https://gist.github.com/YLChen-007/6fd98811ed9a6ad23d1d67e297d143a7 |
|---|
| Benutzer | Eric-b (UID 96354) |
|---|
| Einreichung | 06.04.2026 05:44 (vor 5 Monaten) |
|---|
| Moderieren | 25.04.2026 15:49 (19 days later) |
|---|
| Status | Duplikat |
|---|
| VulDB Eintrag | 313638 [PySpur-Dev pyspur bis 0.1.18 Jinja2 Template single_llm_call.py SingleLLMCallNode user_message erweiterte Rechte] |
|---|
| Punkte | 0 |
|---|