Vulnerability in in.rlogind in SunOS 4.0.3 and 4.0.3c allows local users to gain root privileges.
SunOS 4.0.3 and 4.0.3c systems are vulnerable to a critical local privilege escalation via a flaw in the in.rlogind service, allowing attackers to gain root access. This vulnerability, dating back to 1991, presents a significant risk to legacy systems still in operation, potentially leading to complete system compromise and data breaches.
Step 1: Input Injection: The attacker crafts a malicious input string designed to overflow a buffer within the in.rlogind service. This input is typically sent via a remote login attempt, leveraging the service's intended functionality.
Step 2: Buffer Overflow: The crafted input exceeds the allocated buffer size within in.rlogind. This overwrites adjacent memory locations, including the stack.
Step 3: Code Injection: The attacker's input includes shellcode, which is injected into the overwritten memory region. This shellcode is designed to execute arbitrary commands.
Step 4: Control Flow Hijacking: The buffer overflow corrupts the return address on the stack. When in.rlogind attempts to return from a function, it instead jumps to the attacker-controlled shellcode.
Step 5: Privilege Escalation: The shellcode executes with the privileges of the in.rlogind process, which is often running as root. This allows the attacker to execute commands with root privileges, effectively taking control of the system.
The vulnerability lies within the in.rlogind service, specifically related to insufficient input validation and buffer handling. The service, designed for remote login, fails to properly sanitize user-supplied input, leading to a buffer overflow. This overflow allows an attacker to overwrite critical memory regions, including the stack, and inject malicious code. The injected code then executes with the privileges of the rlogind process, which typically runs with root privileges. The root cause is a lack of bounds checking on input parameters, allowing for an overflow of a fixed-size buffer. This is a classic example of a stack-based buffer overflow vulnerability.