CVE-2024-41129
Ops library exposes secrets via CLI args, affecting Juju charm security.
- CVSS 4.4
- CWE-532
- Information Leakage
- Local
The ops library is a Python framework for developing and testing Kubernetes and machine charms. The issue here is that ops passes the secret content as one of the args via CLI. This issue may affect any of the charms that are using: Juju (>=3.0), Juju secrets and not correctly capturing and processing `subprocess.CalledProcessError`. This vulnerability is fixed in 2.15.0.
- CWE
- CWE-532
- CVSS base score
- 4.4
- Published
- 2024-07-22
- OWASP
- A03 Sensitive Data Exposure
- Orthogonal defect classification
- Interface
- Code defect classification
- Incorrect Interface
- Category
- Information Leakage
- Subcategory
- Insecure Handling of Sensitive Data
- Accessibility scope
- Local
- Impact
- Information Disclosure
- Affected component
- ops library
- Fixed by upgrading
- Yes
Solution
Upgrade to ops library version 2.15.0 or later.
Vulnerable code sample
import subprocess
def run_command_with_secret(secret):
"""Vulnerable function that demonstrates the security issue."""
# VULNERABLE: This code is susceptible to command injection
try:
result = subprocess.run(
['your_command', 'arg1', 'arg2', secret],
check=True,
capture_output=True,
text=True
)
print(result.stdout)
except subprocess.CalledProcessError as e:
print(f"Command failed with error: {e.stderr}")
run_command_with_secret('my_secret_value')Patched code sample
import subprocess
def run_command_with_secret(secret):
"""Secure function that fixes the vulnerability."""
# SECURE: This version prevents command injection
try:
result = subprocess.run(
['your_command', 'arg1', 'arg2'],
env={'SECRET_ENV': secret},
check=True,
capture_output=True,
text=True
)
print(result.stdout)
except subprocess.CalledProcessError as e:
print(f"Command failed with error: {e.stderr}")
run_command_with_secret('my_secret_value')Payload
'$(cat /etc/passwd)'
Cite this entry
@misc{vaitp:cve202441129,
title = {{Ops library exposes secrets via CLI args, affecting Juju charm security.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2024},
note = {VAITP Python Vulnerability Dataset, entry CVE-2024-41129},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2024-41129/}}
}
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 ::
