Briefing
When the shell resolves a bare command like ls, it walks the directories listed in
$PATH from left to right, executing the first match it finds. An attacker who can
write to any directory that appears before the legitimate binary's location can place a trojanized
binary there. Every user who runs that command will silently execute the attacker's payload while
seeing normal-looking output. This technique requires no root access and leaves a minimal footprint.
You have been granted access to a server under active compromise. The threat actor has
placed a malicious ls wrapper in /tmp. Your task is to discover the
technique, weaponize it, then restore the environment.
With /tmp prepended, the shell finds the trojan first. The real binary at /usr/bin/ls is never reached.