GCIH Exam Prep · Topic 3 of 5

Exploitation, Password Attacks & Web Vulnerabilities

Password Cracking · Buffer Overflows · Social Engineering · SQLi · XSS · CSRF · Metasploit

Study with Practice Tests →

Exploitation, Password Attacks & Web Vulnerabilities

Topic 3 covers the attacker's playbook once reconnaissance is complete: cracking credentials, overflowing buffers, manipulating humans, and exploiting web apps. Understanding these techniques is essential for both detection and response.

GCIH · Topic 3 of 5 · ~106 Questions · 4 Hours

Topic Coverage in Context

TopicKey Concepts
1. Incident Handling ProcessPICERL, chain of custody, IR team roles, MITRE ATT&CK, IOCs, threat intelligence
2. Reconnaissance & ScanningOSINT, Nmap, vulnerability scanning, passive vs active recon
3. Exploitation & Web Attacks ← You are herePassword attacks, buffer overflows, social engineering, SQLi, XSS, CSRF, Metasploit
4. Network Attacks & IDSARP poisoning, DoS/DDoS, packet analysis, IDS/IPS evasion, NetFlow
5. Malware & Lateral MovementMalware types, C2, persistence, Pass-the-Hash, YARA, memory forensics

Core Concepts at a Glance

Password Attack Types

Six distinct attack methods: brute force (every combo), dictionary (wordlist), rainbow table (pre-computed hashes — beaten by salting), credential stuffing (reused breach data), spraying (one password, many accounts), and offline (cracking stolen hashes). Know which defense counters each.

Buffer Overflow Mechanics

Stack-based overflows overwrite the EIP/RIP (instruction pointer) to redirect execution. Process: fuzz → find offset → control EIP → point to shellcode. Defenses: ASLR (randomize addresses), DEP/NX (non-executable stack), Stack Canaries (detect overwrite). Safe functions (strncpy, snprintf) prevent the vulnerability.

Social Engineering

Exploits human psychology rather than technical flaws. Key types: phishing (bulk email), spear phishing (targeted), whaling (executives), vishing (voice), BEC (fake CEO wire transfer), baiting (USB drop), pretexting (fabricated scenario), tailgating (physical access). Training + technical controls together.

SQL Injection

User input is interpreted as SQL commands. Types: Classic (auth bypass), UNION (data extraction), Blind Boolean/Time-based (no output), Error-based (leak DB info). Primary defense: parameterized queries / prepared statements — not just input validation or a WAF.

Cross-Site Scripting (XSS)

Inject malicious JavaScript into pages. Stored (in DB, serves all visitors — most dangerous), Reflected (URL parameter, one victim at a time), DOM-based (no server, JavaScript reads attacker input). Impacts: session hijacking via cookie theft. Defense: output encoding + CSP + HTTPOnly cookies.

CSRF & Other Web Attacks

CSRF: forged request from victim's browser using their session cookies — defense: CSRF tokens + SameSite cookies. Also know: Command Injection, Path Traversal (../../etc/passwd), IDOR (change user_id), XXE (XML entities), SSRF (169.254.169.254 cloud metadata). All are injection/access-control failures.

Exam Tips

Primary vs Compensating Controls

The GCIH exam distinguishes best defenses from compensating controls. For SQLi: parameterized queries = primary (WAF = compensating). For XSS: output encoding = primary (CSP = defense-in-depth). For rainbow tables: salting = primary. Always pick the most direct technical fix.

XSS vs CSRF — Get It Right

These are frequently tested together. Remember: XSS exploits the user's trust in the site (injected script runs in their browser). CSRF exploits the site's trust in the user's authenticated browser (forged request sent with valid cookies). Different mechanisms, different defenses.

Spray vs Brute — Avoid Lockout

Password spraying tests one common password (e.g., "Summer2024!") across many accounts before moving to the next. This deliberately stays below account lockout thresholds. Detect by looking for the same source IP hitting many different accounts — not repeated failures on one account.

Password Attacks

From online brute-forcing to offline hash cracking — know the attack spectrum, the tools, and which defense counters each method.

Attack Types

1

Brute Force

Try every possible character combination — slow but thorough, guaranteed to find password eventually. Defense: account lockout, rate limiting, long/complex passwords to make it computationally infeasible.

2

Dictionary Attack

Use a curated wordlist (rockyou.txt has 14M passwords; SecLists collection). Faster than pure brute force — exploits the fact that people pick predictable passwords. Defense: enforce complexity and block known-bad passwords.

3

Rainbow Table Attack

Use pre-computed hash → plaintext lookup tables. Trades storage for speed — instant results once table is built. Defeated entirely by salting (unique random value per password makes pre-computation impossible).

4

Credential Stuffing

Take username/password pairs from breached databases and try them against other services — exploits password reuse. Effective because most users reuse passwords across sites. Defense: MFA defeats this; password managers encourage unique passwords.

5

Password Spraying

Try one common password against many accounts before trying the next — deliberately stays below lockout thresholds. Detection: look for login failure spikes across many different accounts from the same source, not repeated failures on one account.

6

Offline Attack

Crack hashes stolen from /etc/shadow (Linux) or NTDS.dit (Active Directory) — no lockout risk since you're not hitting a live service. GPU acceleration makes this extremely fast against weak hash algorithms.

7

Pass-the-Hash (PtH)

Use a captured NTLM hash directly to authenticate without cracking it — the hash IS the credential in NTLM. No need to know the plaintext password. Covered in depth in Topic 5 (Lateral Movement).

Tools

Hashcat — GPU Cracking

  • GPU-accelerated; extremely fast
  • -a 0 — dictionary mode
  • -a 3 — brute force / mask mode
  • -a 6 — hybrid (wordlist + mask)
  • Specify hash type with -m flag

John the Ripper — CPU Cracking

  • CPU-based; versatile and widely supported
  • john --wordlist=rockyou.txt hashes.txt
  • --format= flag to specify hash type
  • Auto-detects common hash types
  • Supports rules for wordlist mutation

Hydra — Online Brute Forcer

  • Online authentication brute-forcing
  • hydra -l admin -P wordlist.txt ssh://target
  • Supports SSH, FTP, HTTP, RDP, SMB, and more
  • Multi-threaded; use responsibly

Medusa — Multi-Protocol

  • Similar to Hydra — online brute forcer
  • Multi-protocol: SSH, FTP, HTTP, SMTP, etc.
  • Parallel attacks across multiple hosts
  • Modular design

CrackMapExec (CME)

  • Swiss-army knife for SMB/Active Directory
  • Enumerate shares, users, spray credentials
  • Execute commands, dump SAM/LSA secrets
  • Heavily used in AD environments

Hash Types — Hashcat -m Values

Hash AlgorithmHashcat -mUse CaseSecurity Status
MD50Legacy; many systems still store theseBroken — fast to crack
SHA-1100Git objects, older systemsBroken — fast to crack
NTLM1000Windows authentication hashesWeak — no salt
bcrypt3200Password storage (correct choice)Strong — slow, salted
WPA2 (PMKID)22000Wi-Fi handshake crackingDepends on password strength

Password Storage & Defense

Salting — Beats Rainbow Tables

  • Unique random value added to each password before hashing
  • Makes pre-computed tables useless — each hash is unique even for same password
  • Salt is stored alongside the hash (it's not secret)
  • Modern libraries (bcrypt, Argon2) handle salting automatically

Memory-Hard Algorithms

  • bcrypt: adjustable work factor; widely supported
  • Argon2: winner of Password Hashing Competition; configurable memory + time cost
  • scrypt: memory-hard; used in some cryptocurrencies
  • Goal: make each hash attempt slow and memory-intensive — defeats GPU acceleration

Key Stretching

  • PBKDF2: iterates a base hash function thousands of times
  • Each iteration increases the time cost for attackers
  • Used in WPA2, many password managers
  • Not as strong as bcrypt/Argon2 because it's not memory-hard

Defense Summary

  • Brute force → account lockout + rate limiting
  • Dictionary → block known-bad passwords + complexity policy
  • Rainbow tables → salting (use modern algorithms)
  • Credential stuffing → MFA + breach monitoring
  • Spraying → monitor failed logins across accounts
  • Offline → protect hash stores (NTDS.dit, /etc/shadow)

Buffer Overflows & Social Engineering

Two very different attack vectors that share a common theme: exploiting design flaws. Buffer overflows abuse memory handling; social engineering abuses human psychology. Both appear on the GCIH exam.

Buffer Overflow — Stack-Based

Core Concept

When a program writes more data to a buffer than it can hold, the excess overwrites adjacent memory — including the saved return address (EIP/RIP) on the stack. By controlling that address, the attacker redirects execution to shellcode.

1

Fuzzing — Find the Crash

Send increasingly large inputs until the application crashes. The crash reveals that a buffer overflow exists. Tools: custom scripts, Boofuzz, Peach fuzzer.

2

Pattern — Find the Offset

Send a unique cyclic pattern (Metasploit's pattern_create) so you can calculate exactly how many bytes it takes to reach EIP. Use pattern_offset with the EIP value from the crash.

3

Control EIP

Send offset bytes of padding + 4 bytes that overwrite EIP with a controlled value. Confirm you can write an arbitrary address into EIP (e.g., 42424242 = "BBBB").

4

NOP Sled + Shellcode

Insert a NOP sled (\x90\x90\x90...) before shellcode to increase landing probability. Point EIP to an address inside the sled. Shellcode slides down to execute. Generate with msfvenom.

Memory Protections & How They Help

ProtectionWhat It DoesBypassed By
ASLR (Address Space Layout Randomization)Randomizes base addresses of stack, heap, libraries on each run — prevents hardcoded addressesInfo leaks, brute force (32-bit), heap spraying
DEP / NX (Data Execution Prevention / No-Execute)Marks stack and heap memory non-executable — shellcode placed there cannot runReturn-Oriented Programming (ROP)
Stack CanaryPlaces random value before return address; checks it before function returns — detects overwriteInfo leaks that reveal canary value, format string bugs
Safe Functionsstrncpy (vs strcpy), snprintf (vs sprintf), fgets (vs gets) — bounds-checked variantsN/A — prevents the vulnerability at the source
RELRO / PIEMakes GOT/PLT read-only; Position Independent Executables add ASLR to binary itselfRequires full ASLR bypass

Heap Overflow

Overflows the heap (dynamic memory) rather than the stack. Corrupts heap metadata or function pointers. Harder to exploit than stack overflows but can lead to arbitrary code execution. Use-after-free is a related heap vulnerability where memory is accessed after being freed.

Metasploit Framework

Core workflow: msfconsolesearch [module]use [path]show optionsset RHOSTS/LHOST/LPORTexploit. Payloads: singles (self-contained), stagers (small loader), stages (meterpreter downloaded by stager). Auxiliary modules: no payload — used for scanning/enumeration.

Meterpreter

Advanced in-memory payload. Communicates over encrypted channel. Key commands: hashdump (dump SAM hashes), migrate (move to another process), getsystem (privilege escalation), download/upload (file transfer), shell (drop to OS shell), sysinfo (target info).

Social Engineering Techniques

TechniqueMethodKey Characteristic
PhishingBulk email with malicious links/attachmentsLow targeting, high volume
Spear PhishingTargeted email using personalized info (name, role, recent activity)Higher success rate than generic phishing
WhalingSpear phishing targeting executives (CEO, CFO, Board)High-value targets; often precedes BEC
VishingVoice phishing — impersonating IT support, bank, IRSReal-time psychological pressure
SmishingSMS phishing with malicious linksMobile users less suspicious of SMS
PretextingFabricated scenario to establish trust (fake helpdesk, vendor, regulator)Attacker creates a believable backstory first
BEC (Business Email Compromise)Impersonate executive to authorize wire transfer or change payment detailsOften follows whaling; financial impact
BaitingUSB drop attack — malware-laden USB left in parking lot or lobbyExploits curiosity
Tailgating / PiggybackingPhysical access by following authorized person through a secured doorPhysical security bypass; no technical skill needed

Technical Controls Against SE

  • Email filtering + anti-spoofing (SPF, DKIM, DMARC)
  • MFA defeats credential-based SE attacks
  • USB port disablement / endpoint DLP
  • Physical access controls (mantrap, badge scanners)
  • DMARC enforcement prevents domain spoofing in BEC

Response to SE Incident

  • Phishing report → quarantine similar emails, block sender/domain
  • BEC → contact bank immediately to recall wire transfer
  • USB drop → isolate system, image drive, malware analysis
  • Tailgating → review CCTV, badge access logs, notify physical security
  • Training reinforcement after every SE incident

SE Red Flags

  • Urgency and pressure ("act now or account closed")
  • Authority claims ("this is the CEO, transfer funds")
  • Too-good-to-be-true offers
  • Requests for credentials or sensitive data via email/phone
  • Slight domain misspellings (paypa1.com vs paypal.com)
  • Unexpected attachments from known contacts

Web Application Attacks

SQL injection, XSS, CSRF, and related vulnerabilities are heavily tested in GCIH. Know the mechanism, the impact, and — critically — the correct primary defense for each.

SQL Injection (SQLi)

Core Concept

User-supplied input is interpreted as SQL code because it is concatenated directly into a query string. The attacker breaks out of the data context and writes their own query logic.

SQLi TypeTechniqueHow to Detect
Classic / Auth Bypass' OR '1'='1 in login field — makes WHERE clause always trueSuccessful login without valid credentials
UNION-based' UNION SELECT username,password FROM users-- — appends extra SELECT to return attacker-chosen dataExtra data returned in application response
Blind BooleanAND 1=1 (normal response) vs AND 1=2 (different response) — infers data bit-by-bitBehavioral differences with true/false conditions
Blind Time-based'; WAITFOR DELAY '0:0:5'-- (MSSQL) or '; SELECT SLEEP(5)-- (MySQL) — measures response delayAbnormal response times on certain inputs
Error-basedForce SQL errors that include database version, table names in error messagesVerbose error messages containing DB info in response

SQLi Defenses — Priority Order

  • 1. Parameterized queries / prepared statements — PRIMARY defense; separates code from data at the database driver level
  • 2. Stored procedures (when correctly parameterized)
  • 3. Input validation — secondary; rejects obviously invalid input
  • 4. Least privilege DB user — limits damage if exploited
  • 5. WAF — compensating control only; can be bypassed
  • Never concatenate user input into SQL strings

SQLi Detection & Response

  • Watch for single quotes, double dashes, UNION, SLEEP in logs
  • Unusual volume of database queries from a single session
  • Error messages in application responses referencing SQL
  • Response: patch with parameterized queries, rotate DB credentials, review what data was accessed, notify per breach requirements
  • Tool: SQLmap (automated SQLi detection and exploitation)

Cross-Site Scripting (XSS)

XSS TypeMechanismPersistenceDanger Level
Stored (Persistent)Malicious script saved in database; served to every visitor of the affected pagePermanent until removedHighest
Reflected (Non-persistent)Script in URL parameter reflected back in response; victim must click attacker-crafted linkOne-time per requestMedium
DOM-basedJavaScript reads attacker-controlled input (URL fragment, postMessage) and writes to DOM — no server involvementOne-time; client-side onlyMedium-High

XSS Impact

  • Session hijacking: steal session cookie via document.cookie, send to attacker
  • Credential theft: inject fake login form, capture credentials
  • Keylogging: log every keypress and exfiltrate
  • Defacement: modify page content
  • BeEF (Browser Exploitation Framework): hook browser, pivot to further attacks
  • Malware delivery: redirect to exploit kit

XSS Defenses

  • Output encoding: convert <, >, &, " to HTML entities — PRIMARY defense; renders script as text not code
  • Content Security Policy (CSP): HTTP header restricting script sources; blocks inline scripts
  • HTTPOnly cookie flag: prevents JavaScript from reading cookies — directly mitigates session hijacking via XSS
  • X-XSS-Protection: browser-level filter (legacy)
  • Input validation: secondary; not sufficient alone

CSRF (Cross-Site Request Forgery)

Core Concept

The victim's browser is tricked into sending a forged request to a trusted site using the victim's existing authenticated session cookies. The server cannot distinguish the forged request from a legitimate one — both arrive with valid cookies.

CSRF Example

Attacker hosts an image tag on a malicious site:

<img src="https://bank.com/transfer?to=attacker&amount=10000">

When the victim (who is logged into bank.com) visits the malicious page, their browser automatically sends the GET request with their bank cookies. The bank processes it as if the victim initiated it.

CSRF Defenses

  • CSRF Token: unique random per-form value server verifies — attacker can't forge what they can't read (SOP prevents cross-origin reads)
  • SameSite Cookie attribute: Strict (never sent cross-site) or Lax (sent for top-level navigation GET only) — browser-enforced
  • Verify Origin/Referer header: check request originated from same site
  • Re-authentication: require password confirmation for sensitive actions

XSS vs CSRF — Key Distinction

  • XSS: exploits user's trust in the site — malicious code runs in the victim's browser in the context of the trusted site
  • CSRF: exploits site's trust in the user's browser — forged request from victim's browser is trusted by the server
  • XSS can steal cookies; CSRF abuses them without needing to steal them
  • HTTPOnly prevents XSS cookie theft but does NOT prevent CSRF

Other Web Attacks

Command Injection

User input executed as an OS command. Attacker appends commands with ;, |, &&:

; ls -la or | cat /etc/passwd

Defense: Never pass user input to shell; use parameterized APIs; input whitelist

Path / Directory Traversal

Escape web root using ../ sequences to read arbitrary files:

../../etc/passwd or ..%2F..%2Fetc%2Fshadow

Defense: Resolve canonical path, verify it starts with allowed base directory

IDOR (Insecure Direct Object Reference)

Change a reference to access another user's resource:

/profile?user_id=123 → change to user_id=124

Defense: Server-side authorization check — verify caller owns requested resource

XXE (XML External Entity)

Malicious XML references an external entity to read local files or trigger SSRF:

<!ENTITY xxe SYSTEM "file:///etc/passwd">

Defense: Disable external entity processing in XML parser configuration

SSRF (Server-Side Request Forgery)

Make the server fetch internal resources the attacker cannot reach directly. Classic target:

http://169.254.169.254/latest/meta-data/

(AWS IMDSv1 instance metadata — leaks IAM credentials)

Defense: Allowlist outbound URLs; use IMDSv2 (requires session token); network segmentation

OWASP Context

OWASP Top 10 CategoryAttacks Covered
A01 — Broken Access ControlIDOR, path traversal, CSRF
A03 — InjectionSQL injection, command injection, XXE
A07 — Identification & Auth FailuresCredential stuffing, brute force, session hijacking
A10 — Server-Side Request ForgerySSRF (cloud metadata, internal services)
Cross-CuttingXSS spans A03 (injection) and A07 (session)

Practice Quiz

10 exam-style questions covering password attacks, buffer overflows, social engineering, and web vulnerabilities. Select your answer, then click Check to reveal the result.

Memory Hooks

Six high-retention mnemonics to lock in the most tested concepts from Topic 3. Use these for last-minute review before the exam.

🔑
Password Attack Spectrum
"Brute · Dictionary · Rainbow · Spray"
Brute=Every combo · Dictionary=Wordlist · Rainbow=Pre-computed (salting beats it) · Spray=One password, many accounts → avoids lockout. Add Credential Stuffing=Reused breach pairs (MFA beats it).
💥
Buffer Overflow Defenses
"ASLR · DEP/NX · Canary · Safe Functions"
ASLR=Random addresses (attacker can't hardcode) · DEP/NX=No-execute stack (shellcode can't run) · Canary=Detects overwrite before return · Safe functions=strncpy not strcpy. All four together = layered defense.
🎭
Social Engineering Types
"Phish → Spear → Whale → Vish → BEC"
Phish=Email bulk · Spear=Targeted email · Whale=Executive target · Vish=Voice · Smish=SMS · Pretexting=Fabricated story · BEC=Fake CEO wire transfer · Baiting=USB drop · Tailgating=Physical follow-through.
💉
SQLi Defense
"Parameterized queries = PRIMARY"
Input validation = secondary. WAF = compensating. Never concatenate user input into SQL strings. Parameterized queries separate code from data at the driver level — no amount of malicious input can change the query structure.
🕸️
XSS vs CSRF
"XSS injects; CSRF forges"
XSS=inject script into page (site→user: exploits user's trust in site) · CSRF=forge request using victim's session (user→site: exploits site's trust in user's browser). XSS steals cookies; CSRF abuses them. HTTPOnly stops XSS cookie theft but NOT CSRF.
🎯
Metasploit Workflow
"search → use → options → set → exploit"
search [term] → use [module] → show options → set RHOSTS/LHOST/LPORT → exploit/run → meterpreter. Payloads: singles (self-contained), stagers (loader), stages (meterpreter). Auxiliary = no payload, just scanning/enumeration.

Flashcards & Advisor

Click any card to flip and reveal the answer. Use the Advisor below for guided topic deep-dives.

Click a card to flip it · Click again to flip back

Topic Advisor

Select a topic to see key exam points, common traps, and what to focus on.

Select a topic to begin

Choose a category from the left to see focused exam guidance for that area.

Ready to Test Your Knowledge?

Practice with full-length GCIH mock exams and adaptive question sets.

Start Free Practice Tests →