VAITP Dataset

← Back to the dataset

CVE-2023-38898

Sensitive information exposure in _asyncio._swap_current_task

  • CVSS 5.3
  • CWE-200: Information Exposure
  • Information Leakage
  • Local

An issue in Python cpython v.3.7 allows an attacker to obtain sensitive information via the _asyncio._swap_current_task component.

CVSS base score
5.3
Published
2023-08-15
OWASP
A05 Security Misconfiguration
Orthogonal defect classification
Timing/Serialization
Code defect classification
Timing Issues
Category
Information Leakage
Subcategory
Insecure Handling of Sensitive Data
Accessibility scope
Local
Impact
Information Disclosure
Fixed by upgrading
Yes

Solution

Upgrade to Python version 3.7.3 or later.

Vulnerable code sample

import asyncio

async def sensitive_coroutine():
    sensitive_data = "secret_information"
    print("Running sensitive coroutine")
    return sensitive_data

async def main():
    task = asyncio.create_task(sensitive_coroutine())
    current_task = asyncio._asyncio._swap_current_task(task)
    
    print("Current task:", current_task)

asyncio.run(main())

Patched code sample

import asyncio

class TaskManager:
    def __init__(self):
        self._current_task = None

    def set_current_task(self, task):
        self._current_task = task

    def get_current_task(self):
        if self._current_task is None:
            raise RuntimeError("No current task set.")
        return self._current_task

async def example_coroutine():
    print("Running example coroutine")

async def main():
    task_manager = TaskManager()
    task = asyncio.create_task(example_coroutine())
    task_manager.set_current_task(task)
    
    await task

asyncio.run(main())

Cite this entry

@misc{vaitp:cve202338898,
  title        = {{Sensitive information exposure in _asyncio._swap_current_task}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2023},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2023-38898},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2023-38898/}}
}
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 ::