Step 1: Input Preparation: The attacker crafts a malicious input string exceeding the allocated buffer size within the mkcookie utility. This input will contain shellcode designed to execute privileged commands and overwrite the return address on the stack.
Step 2: Input Delivery: The attacker executes mkcookie with the crafted input, typically through a local shell or a compromised account on the target system.
Step 3: Buffer Overflow Trigger: The mkcookie utility attempts to process the oversized input, causing a buffer overflow. This overwrites critical memory locations, including the return address.
Step 4: Shellcode Execution: The overwritten return address is set to point to the attacker's injected shellcode. When mkcookie attempts to return, it jumps to the attacker's code.
Step 5: Privilege Escalation: The shellcode executes with the privileges of the mkcookie process, which typically runs with root privileges. This allows the attacker to gain root access to the system.