Table of Contents

BBC Ch 22: Code Reviews

Source: Bug Bounty Bootcamp by Vickie Li

Source code review is one of the most effective ways to find vulnerabilities. Even partial access to source code (leaked repos, JS files, open-source components) dramatically increases your attack surface visibility.

Dangerous Functions

Start by grepping for functions known to introduce vulnerabilities. Their presence doesn't confirm a bug – trace the input to determine if attacker-controlled data reaches them.

Language Function Vulnerability
PHP eval(), assert() Code injection
PHP system(), exec(), shell_exec(), passthru(), popen(), backticks RCE / command injection
PHP include(), require() RFI / LFI
PHP unserialize() Insecure deserialization
Python eval(), exec(), os.system() Code injection / RCE
Python pickle.loads(), yaml.load() Insecure deserialization
JavaScript document.write(), document.writeln() XSS
JavaScript document.location.href Open redirect
Ruby system(), exec(), %x(), backticks RCE / command injection
Ruby Marshal.load(), yaml.load() Insecure deserialization

Leaked Secrets and Weak Cryptography

Grep for keywords that indicate hardcoded credentials or weak algorithms:

grep -rn "key\|secret\|password\|encrypt\|API\|login\|token" .

GitHub personal access tokens follow the pattern [a-f0-9]{40}. Use TruffleHog for entropy-based secret scanning across git history:

trufflehog filesystem --directory=.

Weak/broken cryptographic algorithms to flag:

Outdated Dependencies

Grep for import and dependency statements:

grep -rn "import\|require" . | grep -v "node_modules"
cat package.json
cat requirements.txt
cat pom.xml

Cross-reference library versions against:

Developer Comments

Developers leave notes that reveal internal details, removed features, and security TODOs:

grep -rn "TODO\|FIXME\|HACK\|completed\|config\|setup\|removed\|password\|secret" .

Look for comments like: