Handling captures that may carry executables

3 min read188 courses on OnlySecurity

A packet capture is data, but it can contain files. Any protocol that transfers a file, whether SMB, FTP, HTTP or a backup agent, leaves the file’s bytes in the capture. Wireshark can export those objects, and a careless export puts a live executable on your disk. The inventory flags at least one robotics run as carrying such content, and notes that backup runs may too. Treat the whole family as untrusted until you have checked.

Start with the environment. Work in a virtual machine or a dedicated analysis host with no credentials, no shared folders, and no route to anything you care about. Snapshot it before you begin so you can roll back. Keep the capture files read only and record their checksums with a tool such as sha256sum, so you can say exactly which file you analysed.

Next, look before you extract. In Wireshark, the Export Objects feature lists what it can find for each protocol, with sizes and content types. A list entry is not a reason to save it. Often the metadata, such as a file name and a size, is enough for the question you are asking. If you do need the bytes, extract to a folder that is not executable and not indexed, and leave the extension as it is, since renaming does not make a file safe.

Then identify without running. The file command and a hash lookup tell you the type and whether the hash is known. Strings and a header dump show whether a Windows executable begins with the MZ marker. None of these steps executes the file. Anything beyond that, such as detonation in a sandbox, is a separate activity with its own controls and is out of scope here.

Never replay the capture. Replay tools send the recorded bytes, including any file transfers, to whatever they are pointed at. If the point is to study timing, read it from the capture itself: frame times, tshark interval statistics and the Wireshark I/O graph show it without sending a packet.

For sharing, the rule is hash and link. Publish the checksum and the source link, not the file. If a teaching slice must include a transfer, strip the payload or substitute a harmless dummy that carries the same markers, such as a file with the MZ header and no code, and say so in the description.

Finally, record what you did. A short note listing the file, its checksum, the steps taken and what you chose not to do protects both you and anyone who reads your work later.

One more point concerns teaching material. If you build an exercise from a capture that may contain files, decide in advance what the learner will download and from where. The safest design sends learners to the original publisher for the data and gives them only the questions and the filters. That keeps the executable-bearing content out of your own hosting, avoids a redistribution question, and means the learner takes the same precautions you describe in the lesson. Where you do need a self-contained exercise, generate your own capture with a harmless dummy file and a known checksum, so the lesson teaches the same extraction and identification steps with no risk attached.

Antivirus on the analysis host is a useful extra layer, though it can also quarantine files mid-analysis and change your results. Decide whether to exclude the working folder, and note the choice in your records. Either option is defensible when written down, and neither is when it is left to chance.

For structured practice on this topic, see the OnlySecurity course Is It OT-Safe? Security Controls against Control Traffic.

More from this author