CVE-2019-3575
SQLA_YAML_FIXTURES 0.9.1 allows local code execution via "fixture_text" argument in "load" function
- CVSS 7.8
- CWE-94 Improper Control of Generation of Code ('Code Injection')
- Input Validation and Sanitization
- Local
Sqla_yaml_fixtures 0.9.1 allows local users to execute arbitrary python code via the fixture_text argument in sqla_yaml_fixtures.load.
- CVSS base score
- 7.8
- Published
- 2019-01-03
- OWASP
- A06 Vulnerable and Outdated Components
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Local
- Impact
- Arbitrary Code Execution
- Affected component
- sqla_yaml_fixtures
- Fixed by upgrading
- Yes
Solution
Update sqla_yaml_fixtures to version 0.9.2 or higher.
Vulnerable code sample
import yaml
def load_fixtures(fixture_text):
# Vulnerable code using unsafe load
data = yaml.load(fixture_text, Loader=yaml.FullLoader)
# Process the data (e.g., save to a database)
for item in data:
# Assuming item is a dictionary that maps to a database model
save_to_database(item)Patched code sample
import yaml
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
def safe_load_yaml(fixture_text):
# Use safe_load to prevent arbitrary code execution
return yaml.safe_load(fixture_text)
def load_fixtures(fixture_text):
data = safe_load_yaml(fixture_text)
# Assuming engine is already created
engine = create_engine('sqlite:///:memory:') # Example engine
Session = sessionmaker(bind=engine)
session = Session()
# Load data into the database
for item in data:
# Assuming item is a dictionary that maps to a database model
session.add(item)
session.commit()Cite this entry
@misc{vaitp:cve20193575,
title = {{SQLA_YAML_FIXTURES 0.9.1 allows local code execution via "fixture_text" argument in "load" function}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2019},
note = {VAITP Python Vulnerability Dataset, entry CVE-2019-3575},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2019-3575/}}
}
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 ::
