Step 1: Trigger the Vulnerability: A local user executes the kcms_configure command with a specially crafted input string as an argument. This input is designed to be larger than the allocated buffer within the command's code.
Step 2: Buffer Overflow: The kcms_configure command attempts to copy the oversized input string into the fixed-size buffer. Due to the lack of bounds checking, the copy operation overflows the buffer, overwriting adjacent memory locations.
Step 3: Overwrite Critical Data: The overflow overwrites critical data on the stack, including the return address. The return address is the memory location where the program should resume execution after the current function completes.
Step 4: Execute Malicious Code: The attacker crafts the input string to overwrite the return address with the address of their injected shellcode. When the kcms_configure command attempts to return, it jumps to the attacker's shellcode.
Step 5: Privilege Escalation: The shellcode executes with the privileges of the kcms_configure command, which typically runs with root privileges. The shellcode then grants the attacker root access, allowing them to execute arbitrary commands with elevated privileges.