PT0-003 · Question #130
PT0-003 Question #130: Real Exam Question with Answer & Explanation
Exam Simulation Explanation: Web Attack Identification & Remediation Overall Goal You're acting as a security analyst performing threat classification and hardening. The simulation tests whether you can map malicious HTTP payloads → attack type → correct fix. This is the corr
Question
SIMULATION INSTRUCTIONS Given the following attack signatures, determine the attack type, and then identify the associated remediation to prevent the attack in the future. If at any time you would like to bring back the initial state of the simulation, please click the Reset All button. You are a security analyst tasked with hardening a web server. You have been given a list of HTTP payloads that were flagged as malicious. Answer:
Options
- taskGiven a list of HTTP payloads flagged as malicious, determine the attack type for each signature and identify the associated remediation to harden a web server and prevent future attacks.
- prerequisites
Explanation
Exam Simulation Explanation: Web Attack Identification & Remediation
Overall Goal
You're acting as a security analyst performing threat classification and hardening. The simulation tests whether you can map malicious HTTP payloads → attack type → correct fix. This is the correct approach because remediation is not one-size-fits-all — a fix for SQL Injection won't prevent XSS, and vice versa. Misidentifying the attack leads to the wrong control, leaving the server still vulnerable.
Step-by-Step Breakdown
Step 1 — Examine each HTTP payload You must read the raw payload before classifying it. Skipping this means you're guessing. Look for tell-tale characters and patterns:
',--,UNION SELECT,OR 1=1→ SQL<script>,alert(),onerror=,document.cookie→ XSS; ls,| whoami,&& cat /etc/passwd→ Command Injection../../etc/passwd,%2e%2e%2f→ Local File Inclusion (LFI)?redirect=http://evil.com→ URL Redirectdocument.write(location.hash)in client-side JS → DOM XSS
Step 2 — Identify the specific attack signature This is pattern recognition. Each attack has a distinct fingerprint within the payload. If you jump straight to remediation without identifying the signature, you'll conflate similar-looking attacks (e.g., Reflected XSS vs DOM XSS look similar but require different analysis — one is server-reflected, one is client-side sink/source manipulation).
Step 3 — Determine the Vulnerability Type Map the signature to one of the six categories:
| Payload Pattern | Vulnerability Type |
|---|---|
UNION SELECT, ' OR '1'='1 | SQL Injection |
<script>alert(1)</script> in URL param echoed back | Reflected XSS |
document.location.hash written to DOM | DOM-based XSS |
; cat /etc/passwd appended to OS command | Command Injection |
../../etc/shadow in file path param | Local File Inclusion |
?next=https://attacker.com | URL Redirect |
Skipping this step and going directly to remediation creates ambiguity — "Input sanitization" alone could mean escaping HTML or stripping shell metacharacters, which are different implementations.
Step 4 — Select the Remediation The correct mapping is:
| Vulnerability Type | Remediation |
|---|---|
| SQL Injection | Parameterized queries (prepared statements) |
| Reflected XSS | Input sanitization (output encoding) |
| DOM-based XSS | Input sanitization (avoid dangerous sinks; see PortSwigger DOM XSS docs) |
| Command Injection | Input sanitization (allowlists, avoid shell calls) |
| Local File Inclusion | Input sanitization + Preventing external calls |
| URL Redirect | Preventing external calls (allowlist valid destinations) |
Why parameterized queries for SQLi specifically? Because sanitizing SQL input is fragile — edge cases and encoding tricks bypass it. Parameterized queries structurally separate code from data, making injection impossible regardless of input content.
Step 5 — Verify with security documentation (PortSwigger)
DOM XSS is the trickiest because it never hits the server — it lives entirely in the browser. PortSwigger's DOM XSS lab maps sources (e.g., location.hash) to sinks (e.g., innerHTML, eval). Skipping verification here is the most common exam mistake.
What Goes Wrong Out of Order
- Skipping Step 1 → misclassify attack → wrong remediation → server still vulnerable
- Skipping Step 3 → applying "input sanitization" to SQL Injection (instead of parameterized queries) → still injectable via encoding bypass
- Confusing Reflected XSS with DOM XSS → applying server-side output encoding when the issue is a client-side sink → XSS still fires
Memory Tip
Use the mnemonic "P-I-I" for remediations:
- Parameterized queries → SQL only
- Input sanitization → XSS, Command Injection, LFI (anything involving untrusted data in output/execution)
- Incoming/outgoing call prevention → URL Redirect, SSRF, LFI with remote includes
And remember: DOM XSS is a client-side problem — the server never sees the payload, so server-side filtering alone won't stop it. You must sanitize at the JavaScript sink level.
Topics
Community Discussion
No community discussion yet for this question.