What is the significance of the "PATH" variable order, and what security risk can arise from including "." (current directory) in it?
Correct! Well done.
Incorrect.
The correct answer is A) The shell searches $PATH directories in order and runs the first matching executable; including "." (especially early) in $PATH is risky, as it could run a malicious script in the current directory sharing a common command's name instead
Correct Answer
The shell searches $PATH directories in order and runs the first matching executable; including "." (especially early) in $PATH is risky, as it could run a malicious script in the current directory sharing a common command's name instead
This is a classic privilege-escalation vector: if an attacker can place a file named "ls" (or similar) in a directory a privileged user will "cd" into, and "." appears early in that user's $PATH, running "ls" could execute the attacker's script instead of /bin/ls.