FIELD MANUAL / CODE AUDIT
Code audit
Grep patterns for reviewing application source and configuration.
These searches shorten a first pass over a source tree. They produce candidates, not findings: read the surrounding code, check reachability and confirm the behavior before reporting it.
The PHP examples deliberately search only *.php; inspect templates,
configuration and other languages separately. A clean search is not a clean
audit.
Obsolete password handling
grep -RInE --include='*.php' '(password|pwd|mdp|pass)' . | grep -Ei '(md5|sha1)[[:space:]]*\('Root usage
grep -RIn --include='*.php' --include='*.sql' "'root'" .Check whether a match is a database login, OS command or unrelated string.
SQL injection
grep -RInEi --include='*.php' '(query|select|insert|update|delete)' .Trace untrusted input to the query and check parameterization. A function named
quote does not establish safety, so do not exclude those lines automatically.
Local and remote file inclusion
grep -RInE --include='*.php' '(include|require).*[$]' .Vulnerable upload
grep -RInE --include='*.php' 'move_uploaded_file|tmp_name' .Dangerous PHP function
grep -RInE --include='*.php' '(passthru|exec|shell_exec|system|eval|phpinfo)[[:space:]]*\(' .Debug output enabled
grep -RInE --include='*.php' 'error_reporting|display_errors|display_startup_errors|print_r|mysqli_error' .Suspicious files
find . -type f \( -iname '*.bak' -o -iname '*.backup' -o -iname '*.old' -o -iname '*.sql' -o -iname '*.log' -o -name '*~' \)Files that may not belong in production
Extended file inventory
These extensions are leads to review, not a universal production denylist.
find ./ -type f \( -regex ".*\.\(3ds\|all-wcprops\|back\|backup\|bak\|bat\|bin\|bugs\|ChangeLog\|class\|cmake\|cpp\|CREDITS\|csv\|dat\|db\|dds\|dll\|DS_Store\|entries\|exe\|gitignore\|h\|inc\|INSTALL\|java\|json\|lab\|log\|Makefile\|md\|mtl\|obf\|obj\|old\|path\|pdb\|phtml\|pptx\|project\|properties\|psd\|py\|save\|scc\|scss\|sdf\|smi\|sql\|stl\|svn-base\|temp\|tmp\|txt\|url\|Vagrantfile\|wiki\|xlsx\|xml\|yml\)" -o -regex ".*\(bugs\|ChangeLog\|CREDITS\|INSTALL\|Makefile\|README\|Vagrantfile\)$" \)File types
find ./ -type f -exec file -b {} \; | cut -d ',' -f 1 | sort | uniq -c -i | sort -n -rExtensions
find . -type f -printf "%f\n" | rev | cut -d '.' -f1 | rev | sort | uniq -c -i | sort -n -rCross-site scripting
grep -RInE --include='*.php' 'echo.*[$]_(COOKIE|GET|POST|REQUEST)' .Check output context and escaping; multi-line flows will not necessarily match.
Helpers
Check URLs returned by find
This sends requests to the configured site; it is not part of offline source review. Map paths to URLs carefully and stay within the authorized request budget.
<FIND COMMAND> | sed "s~./~$URL/~" | xargs -P 10 curl --head --silent --write-out "%{http_code} %{url_effective}\n" | grep $URL --color=never | grep -v 404