CVE-2019-18874
psutil (python-psutil) <= 5.6.5: Double-free vulnerability due to refcount mishandling in system data conversion
- CVSS 7.5
- CWE-415 Double Free
- Memory Corruption
- Remote
psutil (aka python-psutil) through 5.6.5 can have a double free. This occurs because of refcount mishandling within a while or for loop that converts system data into a Python object.
- CVSS base score
- 7.5
- Published
- 2019-11-12
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Memory Corruption
- Subcategory
- Use-After-Free Errors
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Fixed by upgrading
- Yes
Solution
Update psutil to version 5.6.6 or higher.
Vulnerable code sample
import psutil
def get_cpu_times():
cpu_times = psutil.cpu_times()
for _ in range(10):
cpu_times_dict = cpu_times._asdict()
print(cpu_times_dict)
get_cpu_times()Patched code sample
import psutil
def get_cpu_times():
try:
cpu_times = psutil.cpu_times()
return cpu_times._asdict()
except Exception as e:
print(f"Error retrieving CPU times: {e}")
return None
cpu_times_dict = get_cpu_times()Cite this entry
@misc{vaitp:cve201918874,
title = {{psutil (python-psutil) <= 5.6.5: Double-free vulnerability due to refcount mishandling in system data conversion}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2019},
note = {VAITP Python Vulnerability Dataset, entry CVE-2019-18874},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2019-18874/}}
}
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 ::
