6.5.2. Penetration Testing
š” First Principle: Penetration testing validates security by simulating real attacks. Unlike vulnerability scanning (which finds known weaknesses), penetration testing exploits vulnerabilities, chains them together, and demonstrates actual business impact.
Testing types by knowledge level:
- Known-environment (white box) ā testers have full knowledge of the target (architecture, source code, credentials). Most thorough but least realistic of attacker perspective.
- Unknown-environment (black box) ā testers have no prior knowledge, simulating an external attacker. Most realistic but may miss vulnerabilities due to time constraints.
- Partially known (gray box) ā testers have some information (user-level credentials, network diagrams). Balances thoroughness with realism.
Offensive vs. defensive teams:
- Red team ā offensive team simulating attackers, using real-world TTPs (tactics, techniques, procedures) to test defenses.
- Blue team ā defensive team detecting and responding to the red team's activities. Tests SOC effectiveness.
- Purple team ā collaborative approach where red and blue teams share information during the exercise to maximize learning. Red team shows how they bypassed controls; blue team adjusts defenses in real time.
Physical penetration testing ā testing physical security controls: tailgating into buildings, attempting badge cloning, testing access control vestibules, social engineering reception staff.
Rules of engagement ā formal agreement defining the scope, boundaries, timing, and legal authorization for penetration testing. Critical for ensuring testing stays within approved limits and doesn't damage production systems.
Reconnaissance precedes active testing: passive reconnaissance gathers publicly available information (OSINT ā domain records, social media, job postings revealing technology stack) without touching the target. Active reconnaissance directly probes the target (port scans, service enumeration). The testing methodology typically follows: reconnaissance ā scanning ā gaining access ā maintaining access ā covering tracks ā reporting.
Bug bounty programs offer financial rewards to external researchers who discover and responsibly report vulnerabilities. Unlike formal pen tests (scoped, time-limited, contracted), bug bounties provide continuous testing from diverse perspectives. Many organizations run both: formal pen tests for compliance, bug bounties for ongoing discovery.
ā ļø Exam Trap: Black box = unknown environment (tester knows nothing). White box = known environment (tester knows everything). CompTIA uses "known/unknown environment" rather than "white/black box" in SY0-701 ā recognize both terminologies. Purple team = collaborative, not adversarial.
