Post-exploitation and Lateral Movement
A tester has a shell on a Linux web server and suspects that application config files under /var/www contain hardcoded database passwords. Which command BEST finds them?
Show the answer
Correct answerD. grep -rin "password" /var/www/
AWhy not this: find with -iname matches only file names, so it misses passwords written inside config files.
BWhy not this: strings on the bash binary searches the wrong file; it does not search the web application's config files.
CWhy not this: A listing piped to grep matches only names in the directory listing, never the file contents.
DWhy this is right: Recursive, case-insensitive grep searches file contents and prints matching lines with line numbers.
grep -r searches the contents of every file under the directory for the string, so it shows config lines holding passwords. find and ls piped to grep match only file and directory names, which would miss credentials inside files.