CASE 0x212-002
Case status: Closed
PCAP Analysis
We have captured this traffic from P13's computer. Can you help him?
Scenario
We are given a network capture taken from P13’s computer and asked to help him make sense of it.
The goal is to identify the parties of the communication, the web server and its software, the uploaded file and where it landed on the server, and how long the transfer took.
Evidence provided
| Artifact | Type | Notes |
|---|---|---|
Pcap_Analysis.pcapng | PCAPNG file | Network capture from P13’s computer: 25,262 packets over ~337 s, captured on 2023-05-23. |
SHA256 (Pcap_Analysis.pcapng): 97e9b5e4a2c0e5bbc924f5d4edf5c5f67951f770059d69f5c6f820ecc932865b
Methodology & tools
The capture is small, but it is mostly noise: QUIC, TLS and DNS from normal browsing make up almost all of the bytes. So the approach was to start broad and narrow down step by step:
- Preserve the evidence: hash the PCAP and record its metadata (
sha256sum,capinfos) before analysing anything. - Triage with statistics: Protocol Hierarchy to see what kind of traffic is there, then Conversations and Endpoints to see who talks to whom.
- Pivot on what stands out: raw TCP
datawith no known protocol (the chat), and HTTPPOSTrequests (the upload). - Follow the streams: Follow TCP/HTTP Stream to read the chat, the upload request and the server’s response.
- Measure and verify: TCP conversation statistics and per-stream timestamps for the transfer time, then export the uploaded bytes to check whether the file is really encrypted.
Everything was done in Wireshark, and the key results were cross-checked with tshark so they can be reproduced from the command line:
sha256sum Pcap_Analysis.pcapngcapinfos Pcap_Analysis.pcapngtshark -r Pcap_Analysis.pcapng -q -z io,phs # protocol hierarchytshark -r Pcap_Analysis.pcapng -q -z conv,ip # IPv4 conversationstshark -r Pcap_Analysis.pcapng -q -z conv,tcp # TCP conversations (duration)Investigation
Question 1: In network communication, what are the IP addresses of the sender and receiver?
A PCAP file can contain more than one communication, so this is a good question to start with: it makes sure we focus on the right conversation and the right parties.
To see all the communications in a PCAP file, simply go to Statistics -> Conversations -> IPv4.
We see several conversations. Clicking the Bytes column header sorts them, highest first.
We see that the IP 192.168.235.137 appears in almost all conversations, which indicates that this is the IP of P13’s machine (the machine the capture was taken from).
But sorting by bytes alone won’t show us the conversation we want. A chat is tiny (a few kB) compared to the MBs of QUIC and TLS browsing traffic, so it ends up far down the list. To find it, let’s search the content of the packets for P13’s name. In Wireshark, frame is not an OSI layer: it is Wireshark’s top-level field that holds the whole captured packet, so frame contains searches every byte of every packet.
frame contains "P13"
Opening the first TCP packet and looking at the Data field, we see a message from P13 to Cu713.
Another way to find the same conversation, without guessing a keyword: in Statistics -> Protocol Hierarchy, there are 25 frames classified as plain data, meaning TCP payload that Wireshark has no dissector for. Filtering on data shows the whole chat, which runs over TCP port 250 (a non-standard port) in clear text. Cu713 (192.168.235.131:59576) opened the connection to P13 (192.168.235.137:250) at 17:58:54 UTC.
That is the conversation we were looking for, between P13 and Cu713. Now we submit their IPs, P13 first since he is the sender of the first message.
Answer: 192.168.235.137,192.168.235.131
Question 2: P13 uploaded a file to the web server. What is the IP address of the server?
For this one, we should first understand what the question wants from us.
P13 uploaded a file to a web server. If you know how HTTP works, you know that an upload uses either the POST or the PUT method, not GET, so we can narrow down the packets we are looking at:
http.request.method == "POST" || http.request.method == "PUT"
That filter returns a bunch of packets, but almost all of them are OCSP requests sent by the browser to certificate authorities (ocsp.pki.goog, ocsp.digicert.com, etc.). Only one request is different: POST /panel.php sent to 192.168.1.7. Since the question explicitly mentions a web server, that’s the one we want.
For general knowledge : OCSP (Online Certificate Status Protocol) is used to check whether a digital certificate has been revoked. Instead of downloading static revocation lists (CRLs), the browser asks the CA’s OCSP responder, and that request is itself an HTTP POST. That’s why it shows up in our filter.
To confirm that 192.168.1.7 is the server and not the client: it’s the destination of the request, it listens on port 80, and it’s the side that answers with HTTP/1.1 200 OK. Note also that it’s on a different subnet from P13’s machine (192.168.235.0/24), so the traffic is routed.
So the answer is simply the destination IP.
Answer: 192.168.1.7
Question 3: What is the name of the file that was sent through the network?
We already found the packet where P13 uploaded the file (frame 3513) by filtering on POST and PUT.
We simply right-click that packet and select Follow -> HTTP Stream.
A trick: Follow HTTP Stream shows the whole conversation, meaning both P13’s request and the web server’s response. I prefer to use the drop-down at the bottom left of the window and select only the client -> server direction (192.168.235.137:40740 -> 192.168.1.7:80). It shows only the request, so there’s less output to analyse.
The request is a multipart/form-data upload. In the part’s Content-Disposition header we see two values, and it’s important not to mix them up:
name="file"is the name of the HTML form field.filename="file"is the name of the uploaded file. This is the one the question asks for.
In this case both happen to be file, but in a real investigation they’re usually different, so always read filename=.
Answer: file
Question 4: What web server software is running on the target machine?
To answer this question we need to move to the other end of the conversation, server -> client (192.168.1.7:80 -> 192.168.235.137:40740), which is the server’s response.
As we know, when a web server sends a response it usually leaks information about its technology in the Server header, and sometimes the exact version.
And there you go: the response says Server: Apache/2.4.54 (Win64) OpenSSL/1.1.1p PHP/8.0.25, plus X-Powered-By: PHP/8.0.25. So it’s Apache running on Windows with PHP. Notice that the question only asks for the software name, not the version.
Answer: Apache
Question 5: What directory was the file uploaded to?
Looking at the same response from the web server, the body tells us where P13’s file was saved: file uploaded at uploads/file.
Don’t include the file name: the question asks for the directory, not the full path of the uploaded file.
Answer: uploads
Question 6: How long did it take the sender to send the encrypted file?
This question is a good one, because “how long” can be measured in several ways. So before answering, let’s define what we measure: the duration of the TCP connection that carried the upload, from the first packet (SYN) to the last one.
We’re going back to Statistics -> Conversations. But this time, unlike the first time when we knew nothing, we know everything we need to make it quick. The TCP stream number is 22. We found it when we filtered on POST and PUT and opened the upload packet (tcp.stream field in the TCP layer).
That simplifies things. Let’s apply it as a filter:
tcp.stream == 22Then go to Statistics -> Conversations. Now there’s only one result, the one we’re looking for, and the Duration column gives us the answer.
To be sure about the value, I cross-checked it with per-stream timestamps. Enable Edit -> Preferences -> Protocols -> TCP -> Calculate conversation timestamps, then add the field tcp.time_relative (time since the first frame of the stream) as a column:
tshark -r Pcap_Analysis.pcapng -o tcp.calculate_timestamps:TRUE -Y "tcp.stream eq 22" \ -T fields -e frame.number -e tcp.time_relative -e tcp.flags.str -e tcp.len -e _ws.col.Info| Frame | Time in stream (s) | Event |
|---|---|---|
| 3365 | 0.000000 | SYN from P13 to 192.168.1.7:80 |
| 3368 | 0.000756 | First segment of POST /panel.php |
| 3513 | 0.004390 | Last segment of the request (upload complete) |
| 3518 | 0.005797 | HTTP/1.1 200 OK: “file uploaded at uploads/file” |
| 3523 | 0.007310 | Last packet of the connection (final ACK) |
The last packet is at 0.007310 s, which matches the 0.0073 s shown in the Conversations dialog (it rounds to 4 decimals). For the record, the request body alone took about 0.0036 s (frame 3368 to 3513), and the server answered 0.0014 s after the request was complete (http.time on frame 3518). HTB expects the full conversation duration.
Answer: 0.0073
Extra: is the file really encrypted?
The question calls it an “encrypted file”, so instead of just taking that for granted, let’s check it.
In frame 3513, expand MIME Multipart Media Encapsulation -> the part with filename="file" -> Media, then right-click -> Export Packet Bytes (Ctrl+Shift+X). This exports exactly the file content (107,391 bytes), without the multipart headers.
Note: File -> Export Objects -> HTTP also works, but the panel.php object it gives you is the whole multipart body (107,671 bytes, with boundaries and headers), not the file itself.
Then compute the Shannon entropy of the exported file:
python3 -c "import sys,math,collections as c; d=open(sys.argv[1],'rb').read(); print(len(d), -sum(v/len(d)*math.log2(v/len(d)) for v in c.Counter(d).values()))" file.binsha256sum file.binResult:
- Size: 107,391 bytes
- Entropy: 7.99 bits/byte (8.0 is the maximum: fully random data)
filecommand: justdata, no known file signature (magic bytes)- SHA256:
562acf902ebdbb0183268c22ce63ffabfe57ff72beb6c25049a005a2af3e01f2
Near-maximum entropy with no recognisable header is consistent with encrypted data (or strongly compressed data). Together with the chat, where Cu713 talks about his “file encryption script”, this supports the claim that the uploaded file is encrypted.
Attack timeline
-
2023-05-23 17:57:09 UTC
Capture
Capture starts on P13’s machine (192.168.235.137).
-
2023-05-23 17:58:54 UTC
Communication
Cu713 (192.168.235.131) opens a TCP connection to P13 on port 250.
-
2023-05-23 17:58:59 UTC
Communication
First clear-text chat message from P13. Cu713 mentions a hidden “file encryption script”.
-
2023-05-23 18:00:58 UTC
Communication
Last chat message: Cu713 says he left the country and will “just send something”.
-
2023-05-23 18:01:22.211 UTC
Transfer
P13’s machine opens a connection to 192.168.1.7:80 (TCP stream 22).
-
2023-05-23 18:01:22.216 UTC
Transfer
POST /panel.php completes: high-entropy file “file” (107,391 bytes) uploaded.
-
2023-05-23 18:01:22.217 UTC
Transfer
Apache answers 200 OK: “file uploaded at uploads/file”. Connection closed 0.0073 s after the SYN.
-
2023-05-23 18:02:46 UTC
Capture
Capture ends.
IOCs
| No. | Type | Indicator | Context | Copy |
|---|---|---|---|---|
| E-01 | ip | 192[.]168[.]1[.]7 | Web server receiving the upload (Apache/2.4.54 Win64, PHP/8.0.25) | |
| E-02 | url | hxxp[://]192[.]168[.]1[.]7/panel[.]php | Upload endpoint ("My Corp. Panel") | |
| E-03 | ip | 192[.]168[.]235[.]131 | Cu713, chat peer over TCP/250 | |
| E-04 | ip | 192[.]168[.]235[.]137 | P13, capture host and uploader | |
| E-05 | sha256 | 562acf902ebdbb0183268c22ce63ffabfe57ff72beb6c25049a005a2af3e01f2 | Uploaded encrypted file, stored at uploads/file |
ATT&CK mapping
This Sherlock doesn’t present the activity as an attack. But if we treat it as an insider moving encrypted data out over the network, it maps as follows:
| Tactic | Technique | Evidence |
|---|---|---|
| Collection | T1560.003 Archive Collected Data: Archive via Custom Method | Cu713 mentions his own “file encryption script”; uploaded file has 7.99 bits/byte entropy and no known header |
| Exfiltration | T1048.003 Exfiltration Over Unencrypted Non-C2 Protocol | File sent with a clear-text HTTP POST (multipart) to 192.168.1.7/panel.php |
Detection opportunities
Network (IDS): alert on multipart file uploads to the upload panel. In a real environment, scope it to hosts that aren’t approved upload destinations.
alert http $HOME_NET any -> any any (msg:"LOCAL HTTP multipart file upload to panel.php"; flow:established,to_server; http.method; content:"POST"; http.uri; content:"/panel.php"; endswith; http.content_type; content:"multipart/form-data"; startswith; classtype:policy-violation; sid:1000001; rev:1;)Web server logs: the same activity seen from the Apache side.
title: File Upload To PHP Upload Panelstatus: experimentaldescription: Detects POST requests to the panel.php upload page seen in the PCAP Analysis Sherlock.logsource: category: webserverdetection: selection: cs-method: 'POST' cs-uri-stem|endswith: '/panel.php' condition: selectionfalsepositives: - Legitimate use of the upload panellevel: lowOther things worth hunting for in this kind of traffic:
- Clear-text TCP sessions on non-standard ports (here TCP/250) carrying readable text with no known protocol (Wireshark shows them as
data). - High-entropy HTTP request bodies (close to 8 bits/byte) going to internal or unknown hosts, a common sign of encrypted data leaving.
- User-Agent mismatches: one host suddenly sending a different OS/browser User-Agent with a minimal, script-like header set.
Recommendations
Short-term
- Retrieve
uploads/filefrom 192.168.1.7, preserve it, and compare its SHA256 with the one carved from the PCAP (562acf90…). - Identify the owner of 192.168.235.131 (Cu713), and look for the “encryption script” on his machine. That’s the only realistic way to decrypt the file.
- Review the upload panel’s access and its logs, to see who else uploaded files and when.
Longer-term
- Enforce HTTPS on the panel: here the file and the
PHPSESSIDsession cookie travelled in clear text. - Harden the upload panel: authentication, file type and size validation, and storing uploads outside the web root (
uploads/appears to be directly under it). - Reduce information leakage:
ServerTokens Prodin Apache andexpose_php = Offin PHP hide versions from theServerandX-Powered-Byheaders. - Update the stack: PHP 8.0 and OpenSSL 1.1.1 are both end-of-life.
- Monitor egress for uploads to unapproved hosts and for chat or other traffic on non-standard ports.
Lessons learned
- Sorting conversations by bytes is a good first step, but it can hide small and important traffic. Here the chat was only a few kB, buried under MBs of QUIC and TLS. The Protocol Hierarchy
dataentry, meaning TCP payload with no known protocol, pointed straight to it. - In a
multipart/form-dataupload,name=is the form field andfilename=is the actual file name. Easy to mix up when both are the same. - For timing questions, decide first what “how long” means (whole connection, request body only, or until the server’s response), then measure it in two independent ways. The Conversations dialog also needs “Limit to display filter” ticked to show only the filtered stream.
- Don’t take “encrypted” for granted: exporting the file and checking its entropy and magic bytes takes two minutes and turns an assumption into evidence.
- Next time, I’ll script the triage steps (
capinfos, protocol hierarchy, conversations, POST requests) withtsharkso every write-up starts from the same reproducible baseline.