Why This Matters#

You cannot build effective defenses without understanding how attacks work. Offensive security — penetration testing, red teaming, and ethical hacking — validates that your controls actually work against real-world attack techniques. It’s the difference between “we think we’re secure” and “we’ve proven it.”


Penetration Testing#

Methodology#

flowchart LR
    Scope["1: Scope &<br/>Rules of Engagement"] --> Recon["2: Reconnaissance<br/>(passive + active)"]
    Recon --> Enum["3: Enumeration<br/>(services, versions)"]
    Enum --> Vuln["4: Vulnerability<br/>Analysis"]
    Vuln --> Exploit["5: Exploitation"]
    Exploit --> Post["6: Post-Exploitation<br/>(pivot, escalate)"]
    Post --> Report["7: Reporting"]

Phase Details#

PhaseActivitiesOutput
ScopingDefine targets, boundaries, rules, timelineRules of Engagement document
ReconnaissanceOSINT, DNS enumeration, technology fingerprintingTarget profile
EnumerationPort scanning, service identification, version detectionService map
Vulnerability AnalysisIdentify weaknesses, research exploitsVulnerability list
ExploitationAttempt to exploit vulnerabilitiesProof of access
Post-ExploitationPrivilege escalation, lateral movement, data accessImpact demonstration
ReportingDocument findings, evidence, recommendationsPentest report

Testing Types#

TypeTester KnowledgeSimulatesDepth
Black BoxNo internal infoExternal attackerBroad, shallow
Grey BoxPartial info (creds, docs)Insider or compromised accountBalanced
White BoxFull access (source, architecture)Comprehensive auditDeep, thorough

Reconnaissance#

Passive Reconnaissance (No Direct Contact)#

TechniqueToolsFinds
WHOIS lookupwhois, DomainToolsDomain owner, registrar, contacts
DNS enumerationdig, dnsdumpster, subfinderSubdomains, mail servers, records
Certificate transparencycrt.sh, CensysAll issued certificates (reveals subdomains)
Search engine dorkingGoogle, Shodan, CensysExposed files, services, devices
Social media/LinkedInManual, theHarvesterEmployee names, tech stack, org structure
Code repositoriesGitHub, GitLab searchLeaked credentials, internal paths
Job postingsLinkedIn, company siteTechnology stack, tools used

Active Reconnaissance#

TechniqueToolsFinds
Port scanningNmap, masscan, RustScanOpen ports, services
Service fingerprintingNmap -sV, WhatWebSoftware versions
Web crawlingBurp Spider, gospiderPages, forms, parameters
Directory brute-forcingffuf, gobuster, feroxbusterHidden paths, admin panels
Virtual host discoveryffuf, gobuster vhostAdditional web applications

Nmap Essentials#

# Quick scan (top 1000 ports)
nmap -sV -sC target.com

# Full port scan
nmap -p- -sV target.com

# UDP scan (slow but important)
nmap -sU --top-ports 100 target.com

# OS detection
nmap -O target.com

# Aggressive scan (noisy)
nmap -A target.com

Web Application Testing#

Methodology (OWASP Testing Guide)#

CategoryTests
Information GatheringTechnology stack, entry points, application mapping
ConfigurationDefault credentials, HTTP methods, error handling
Identity ManagementUser enumeration, account policies
AuthenticationBrute force, credential stuffing, bypass
AuthorizationIDOR, privilege escalation, path traversal
Session ManagementToken analysis, fixation, timeout
Input ValidationInjection (SQL, XSS, command), file upload
Error HandlingInformation leakage, stack traces
CryptographyWeak algorithms, improper implementation
Business LogicWorkflow bypass, race conditions

Burp Suite Workflow#

flowchart TD
    Proxy["1: Proxy<br/>(intercept traffic)"] --> Spider["2: Spider/Crawl<br/>(map application)"]
    Spider --> Scan["3: Active Scan<br/>(automated testing)"]
    Scan --> Manual["4: Manual Testing<br/>(logic flaws, auth bypass)"]
    Manual --> Intruder["5: Intruder<br/>(fuzzing, brute force)"]
    Intruder --> Repeater["6: Repeater<br/>(craft specific requests)"]

Common Web Exploits#

VulnerabilityTestImpact
SQL Injection' OR 1=1--, sqlmapDatabase access, data theft
XSS<script>alert(1)</script>Session hijacking, phishing
IDORChange ID in URL/requestAccess other users’ data
SSRFInternal URLs in parametersInternal network access
File UploadUpload web shell (.php, .jsp)Remote code execution
DeserializationCrafted serialized objectsRemote code execution

Network Penetration Testing#

Internal Network Attack Path#

flowchart TD
    Initial["Initial Access<br/>(phishing, exploit)"] --> Enum2["Internal Enumeration<br/>(AD, shares, services)"]
    Enum2 --> Creds["Credential Harvesting<br/>(Responder, Kerberoast)"]
    Creds --> Lateral["Lateral Movement<br/>(pass-the-hash, RDP, WMI)"]
    Lateral --> Priv["Privilege Escalation<br/>(domain admin)"]
    Priv --> Objective["Objective<br/>(DC compromise, data access)"]

Active Directory Attacks#

AttackTechniqueTool
KerberoastingRequest service tickets, crack offlineRubeus, GetUserSPNs
AS-REP RoastingTarget accounts without pre-authRubeus, GetNPUsers
Pass-the-HashUse NTLM hash without crackingMimikatz, CrackMapExec
Pass-the-TicketUse Kerberos ticketRubeus, Mimikatz
DCSyncReplicate credentials from DCMimikatz, secretsdump
Golden TicketForge Kerberos TGTMimikatz
BloodHoundMap AD attack pathsBloodHound + SharpHound

Privilege Escalation#

PlatformTechniqueTool
LinuxSUID binariesfind / -perm -4000
LinuxSudo misconfigurationssudo -l, GTFOBins
LinuxKernel exploitsLinPEAS, linux-exploit-suggester
LinuxCron jobs (writable scripts)pspy, manual review
WindowsUnquoted service pathsPowerUp, WinPEAS
WindowsToken impersonationPotato exploits, PrintSpoofer
WindowsDLL hijackingProcess Monitor, manual
WindowsAlwaysInstallElevatedPowerUp

Red Team Operations#

Red Team vs Pentest#

AspectPenetration TestRed Team
ObjectiveFind vulnerabilitiesTest detection and response
ScopeDefined targetsFull organization
DurationDays–weeksWeeks–months
StealthNot requiredEssential (avoid detection)
RulesStrict boundariesBroader (with safety limits)
OutputVulnerability listAttack narrative + detection gaps
Blue team awarenessUsually awareUsually unaware

Red Team Phases#

PhaseActivities
PlanningObjectives, threat profile to emulate, C2 infrastructure
ReconnaissanceDeep OSINT, target profiling, social engineering prep
Initial AccessPhishing, exploit, physical, supply chain
Establish FootholdPersistence, C2 communication
Escalate & MovePrivilege escalation, lateral movement
Achieve ObjectivesData access, demonstrate impact
ReportingFull attack narrative, detection gaps, recommendations

Command and Control (C2)#

FrameworkTypeFeatures
Cobalt StrikeCommercialIndustry standard, malleable C2
SliverOpen sourceCross-platform, modern
MythicOpen sourceModular, multi-agent
HavocOpen sourceModern, evasion-focused

Evasion Techniques#

CategoryTechnique
NetworkDomain fronting, DNS over HTTPS, encrypted C2
EndpointAMSI bypass, ETW patching, unhooking
PayloadObfuscation, encryption, living-off-the-land (LOLBins)
BehavioralSlow operations, business-hours activity, legitimate tools

Purple Team#

Collaborative approach — red and blue work together:

flowchart LR
    Red["Red Team<br/>(attack)"] <-->|"Share TTPs"| Purple["Purple Team<br/>(collaborate)"]
    Purple <-->|"Improve detections"| Blue["Blue Team<br/>(defend)"]
ActivityPurpose
Atomic testingTest specific ATT&CK techniques one at a time
Detection validationVerify SIEM rules trigger on known attacks
Gap identificationFind blind spots in detection coverage
Playbook testingValidate IR playbooks work in practice

Bug Bounty Programs#

Program Types#

TypeScopeParticipantsManagement
PublicOpen to all researchersAnyonePlatform (HackerOne, Bugcrowd)
PrivateInvite-onlyVetted researchersPlatform or self-managed
VDP (Vulnerability Disclosure)Accept reports, no rewardsAnyoneSelf-managed

Severity and Rewards (Typical)#

SeverityImpactReward Range
CriticalRCE, auth bypass, mass data access$5,000–$250,000+
HighPrivilege escalation, significant data exposure$2,000–$50,000
MediumXSS, CSRF, limited data exposure$500–$5,000
LowInformation disclosure, minor issues$100–$1,000

Responsible Disclosure Timeline#

Day 0: Researcher reports vulnerability
Day 1-5: Vendor acknowledges receipt
Day 7-14: Vendor confirms and begins fix
Day 90: Public disclosure (standard deadline)

RuleExplanation
Written authorizationALWAYS have signed scope/ROE before testing
Stay in scopeNever test systems not explicitly authorized
Do no harmAvoid destructive actions, DoS, data deletion
Protect dataDon’t exfiltrate real sensitive data
Report everythingDisclose all findings, even accidental
ConfidentialityDon’t share findings publicly without permission

Without authorization, penetration testing is a crime — regardless of intent.


Key Takeaways#

  1. Authorization first — never test without written permission
  2. Methodology matters — systematic testing finds more than random poking
  3. Think in attack paths — chain low-severity findings into high-impact scenarios
  4. Red teams test people and processes — not just technology
  5. Purple teaming maximizes value — collaboration > adversarial secrecy
  6. Document everything — evidence, screenshots, timestamps, commands
  7. The goal is improvement — findings should lead to better defenses, not blame