VAITP Dataset

← Back to the dataset

CVE-2012-4245

Unauthenticated GIMP 2.6 Script-Fu server allows remote command execution

  • CVSS 6.8
  • CWE-862 Missing Authorization
  • Input Validation and Sanitization
  • Remote

The scriptfu network server in GIMP 2.6 does not require authentication, which allows remote attackers to execute arbitrary commands via the python-fu-eval command.

CVSS base score
6.8
Published
2012-08-31
OWASP
A07 Identification and Authentication Failures
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Input Validation and Sanitization
Subcategory
Command Injection
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
GIMP
Fixed by upgrading
Yes

Solution

Update GIMP to version 2.6.11 or higher.

Vulnerable code sample

import socket

# A simple server that does not require authentication
class VulnerableServer:
    def __init__(self, host='localhost', port=8000):
        self.host = host
        self.port = port

    def handle_client(self, client_socket):
        client_socket.send(b"Welcome to the command server!\n")
        client_socket.send(b"Enter command: ")
        command = client_socket.recv(1024).decode().strip()
        
        # Execute the command without any authentication
        try:
            output = exec(command)  # This is the vulnerability
            client_socket.send(f"Command executed: {output}\n".encode())
        except Exception as e:
            client_socket.send(f"Error: {str(e)}\n".encode())

        client_socket.close()

    def start(self):
        server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        server.bind((self.host, self.port))
        server.listen(5)
        print(f"[*] Listening on {self.host}:{self.port}")

        while True:
            client_socket, addr = server.accept()
            print(f"[*] Accepted connection from {addr}")
            self.handle_client(client_socket)

if __name__ == "__main__":
    vulnerable_server = VulnerableServer()
    vulnerable_server.start()

Patched code sample

import socket
import threading

# Set up a simple server that requires authentication
class AuthenticatedServer:
    def __init__(self, host='localhost', port=8000):
        self.host = host
        self.port = port
        self.username = "admin"
        self.password = "secure_password"

    def handle_client(self, client_socket):
        # Authenticate the user
        client_socket.send(b"Username: ")
        username = client_socket.recv(1024).decode().strip()
        
        client_socket.send(b"Password: ")
        password = client_socket.recv(1024).decode().strip()

        if username == self.username and password == self.password:
            client_socket.send(b"Authentication successful!\n")
            self.execute_command(client_socket)
        else:
            client_socket.send(b"Authentication failed!\n")
        
        client_socket.close()

    def execute_command(self, client_socket):
        client_socket.send(b"Enter command: ")
        command = client_socket.recv(1024).decode().strip()
        
        # Here you would normally execute the command, but for safety:
        client_socket.send(f"Command received: {command}\n".encode())

    def start(self):
        server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        server.bind((self.host, self.port))
        server.listen(5)
        print(f"[*] Listening on {self.host}:{self.port}")

        while True:
            client_socket

Cite this entry

@misc{vaitp:cve20124245,
  title        = {{Unauthenticated GIMP 2.6 Script-Fu server allows remote command execution}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2012},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2012-4245},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2012-4245/}}
}

Download this entry as JSON Download the whole dataset

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 ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.