CVE-2005-4890

7.8 HIGH

📋 TL;DR

This vulnerability allows local users to escape restricted shell sessions and execute arbitrary commands with elevated privileges. It affects systems running vulnerable versions of shadow and sudo where users can execute commands via 'su - user -c program'. The attack involves using the TIOCSTI ioctl to inject characters into the terminal input buffer.

💻 Affected Systems

Products:
  • shadow
  • sudo
Versions: shadow 4.x before 4.1.5, sudo 1.x before 1.7.4
Operating Systems: Linux distributions using affected versions
Default Config Vulnerable: ⚠️ Yes
Notes: Requires local shell access and ability to execute 'su - user -c program' commands.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Local privilege escalation to root, allowing complete system compromise and persistence.

🟠

Likely Case

Local users gaining unauthorized access to other user accounts or elevated privileges.

🟢

If Mitigated

Limited impact with proper user separation and minimal privilege assignments.

🌐 Internet-Facing: LOW - This is a local privilege escalation vulnerability requiring local access.
🏢 Internal Only: HIGH - Internal users with shell access can exploit this to escalate privileges.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires local access and understanding of terminal ioctl operations.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: shadow 4.1.5+, sudo 1.7.4+

Vendor Advisory: http://www.openwall.com/lists/oss-security/2012/11/06/8

Restart Required: No

Instructions:

1. Update shadow package to 4.1.5 or later. 2. Update sudo package to 1.7.4 or later. 3. Use package manager: 'apt-get update && apt-get upgrade shadow sudo' or 'yum update shadow sudo'.

🔧 Temporary Workarounds

Restrict su command usage

linux

Limit which users can execute su commands via PAM or sudoers configuration

# Edit /etc/pam.d/su to restrict access
# Configure /etc/sudoers to limit su usage

Disable TIOCSTI ioctl

linux

Use kernel security modules to restrict TIOCSTI ioctl operations

# Configure SELinux/AppArmor policies
# Use grsecurity/PaX if available

🧯 If You Can't Patch

  • Implement strict user privilege separation and least privilege principles
  • Monitor and audit all su and sudo command executions

🔍 How to Verify

Check if Vulnerable:

Check installed versions: 'rpm -q shadow sudo' or 'dpkg -l shadow sudo' and compare against vulnerable versions.

Check Version:

shadow --version && sudo -V

Verify Fix Applied:

Verify updated versions: 'shadow --version' should show 4.1.5+, 'sudo -V' should show 1.7.4+.

📡 Detection & Monitoring

Log Indicators:

  • Unusual su command patterns
  • Multiple failed su attempts followed by successful escalation
  • Commands executed from unexpected user contexts

Network Indicators:

  • Not applicable - local attack only

SIEM Query:

source="auth.log" AND ("su:" OR "sudo:") AND (user!="root" AND success)

🔗 References

📤 Share & Export