VAITP Dataset

← Back to the dataset

CVE-2022-34060

PyPI "Togglee" v0.0.8: Critical code execution backdoor

  • CVSS 9.8
  • CWE-284: Improper Access Control
  • Authentication, Authorization, and Session Management
  • Remote

The Togglee package in PyPI version v0.0.8 was discovered to contain a code execution backdoor. This vulnerability allows attackers to access sensitive user information and digital currency keys, as well as escalate privileges.

CVSS base score
9.8
Published
2022-06-24
OWASP
A06 Vulnerable and Outdated Components
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Authentication, Authorization, and Session Management
Subcategory
Privilege Escalation
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Fixed by upgrading
Yes

Solution

Update Togglee package to version v0.0.9 or higher.

Vulnerable code sample

class Togglee:
    def __init__(self):
        self.settings = {}

    def set_setting(self, key, value):
        self.settings[key] = value

    def execute_code(self, code):
        exec(code)

togglee = Togglee()
togglee.set_setting('setting1', 'value1')
togglee.execute_code('import os; os.system("echo Vulnerable!")')

Patched code sample

class Togglee:
    def __init__(self):
        self.settings = {}

    def set_setting(self, key, value):
        self.settings[key] = value

    def execute_command(self, command):
        allowed_commands = {
            "print_settings": self.print_settings,
        }

        action = allowed_commands.get(command)
        if action:
            action()
        else:
            raise ValueError("Invalid command")

    def print_settings(self):
        for key, value in self.settings.items():
            print(f"{key} = {value}")

togglee = Togglee()
togglee.set_setting('setting1', 'value1')
togglee.execute_command('print_settings')

Cite this entry

@misc{vaitp:cve202234060,
  title        = {{PyPI "Togglee" v0.0.8: Critical code execution backdoor}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2022},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2022-34060},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2022-34060/}}
}
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 ::