VAITP Dataset

← Back to the dataset

CVE-2008-5104

Default root password in Ubuntu VMs: "!

  • CVSS 7.2
  • CWE-255
  • Authentication, Authorization, and Session Management
  • Local

Ubuntu 6.06 LTS, 7.10, 8.04 LTS, and 8.10, when installed as a virtual machine by (1) python-vm-builder or (2) ubuntu-vm-builder in VMBuilder 0.9 in Ubuntu 8.10, have ! (exclamation point) as the default root password, which allows attackers to bypass intended login restrictions.

CVSS base score
7.2
Published
2008-11-17
OWASP
A07 Identification and Authentication Failures
Orthogonal defect classification
Function
Code defect classification
Incorrect Functionality
Category
Authentication, Authorization, and Session Management
Subcategory
Weak Password Policies
Accessibility scope
Local
Impact
Unauthorized Access
Fixed by upgrading
Yes

Solution

Update VMBuilder to version 0.10.0 or higher.

Vulnerable code sample

def set_root_password():
    root_password = '!'

    with open('/etc/shadow', 'a') as f:
        f.write(f'root:{root_password}:\n')

set_root_password()

Patched code sample

import subprocess
import random
import string
import os
import sys

def generate_password(length=16):
    characters = string.ascii_letters + string.digits + string.punctuation
    password = ''.join(random.choice(characters) for i in range(length))
    return password

def set_root_password():
    password = generate_password()
    env = os.environ.copy()
    env['PATH'] = '/usr/sbin:/usr/bin:/sbin:/bin'
    env['HOME'] = '/root'

    try:
        result = subprocess.run(
            ['passwd', '--stdin', 'root'],
            input=password.encode(),
            env=env,
            check=True,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE
        )

        print(f"Root password has been securely set: {password}")

    except subprocess.CalledProcessError as e:
        print(f"Error setting root password: {e}")

if os.geteuid() != 0:
    print("This script must be run as root.")
    sys.exit(1)
else:
    set_root_password()

Cite this entry

@misc{vaitp:cve20085104,
  title        = {{Default root password in Ubuntu VMs: "!}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2008},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2008-5104},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2008-5104/}}
}
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 ::