Step 1: Target Selection: The attacker identifies a target file to read (e.g., /etc/shadow, /etc/passwd).
Step 2: Symbolic Link Creation: The attacker creates a symbolic link from a location where mailx will create a temporary file (e.g., /tmp/mailx.XXXXXX) to the target file.
Step 3: Race Condition Trigger: The attacker rapidly invokes mailx to send a message, triggering the creation of the temporary file. The attacker attempts to win the race against mailx's file creation.
Step 4: File Content Overwrite: If the attacker wins the race, mailx writes the message content to the symbolic link, effectively overwriting the contents of the target file.
Step 5: Information Disclosure: The attacker reads the contents of the overwritten temporary file, which now contains the sensitive information from the target file.