Truncating Payloads and Anonymizing PCAP files

Published: 2018-08-15
Last Updated: 2018-08-16 05:44:51 UTC
by Xavier Mertens (Version: 1)
2 comment(s)

Sometimes, you may need to provide PCAP files to third-party organizations like a vendor support team to investigate a problem with your network. I was looking for a small tool to anonymize network traffic but also to restrict data to packet headers (and drop the payload). Google pointed me to a tool called ‘TCPurify’. 

It’s an old tool (last updated in 2008) but it still makes the job! The original website is offline but it is possible to find it using the Internet Archive[1]. They are two main features that are interesting with TCPurify:

  • It truncates almost all packets immediately after the last recognized header (IP or Ethernet), removing all data payload before storing the packet.
  • It has the capability of randomizing some or all IP addresses (based on the network portion of the address) to mask exactly where packets are where or to while still retaining some general idea. 

The latest source code is available also through the Intenet Archive. I did not find any package ready for latest Linux distributions so, let's install it the old-way: compilation! The installation is straightforward on a standard UNIX system. The only requirement is the libpcap and C header files:

# apt-get install libpcap-dev
# wget
# tar xvf tcpurify-0.11.2.tar.gz
# cd tcpurify-0.11.2
# ./configure
# make install

Now, you have a single executable available in /usr/local/bin. There are different ways to use TCPurify: it can listen to packets from an interface:

# tcpurify -i eth1 -o /tmp/capture.pcap

Or from another PCAP file:

# tcpurify -r /tmp/source.pcap -o /tmp/destination.pcap

What about the anonymization of the packets? There are different modes offered: “none” (does nothing, default), “nullify” (replace all IP addresses with or ‘table’. This one is the most interesting. It allows defining which subnets will be anonymized using filters. Those filters are save in a map file to be able to reconstruct the original PCAL if required later.

Filters are defined like this:



This will randomize IP addresses from except the network & broadcast addresses (example: '' will be anonymized to '')

The ‘table’ mode requires an extra argument, 'mapfile' which will point to the filename that will contain the mappings.

Here is an example of usage:

# tcpurify -i eth1 -o /tmp/test.pcap table mapfile=/tmp/

The tool looks a very light tcpdump clone and does not allow to fine-tune the capture session. The most important missing option is the non-support for BPF filters. This means that you can’t restrict the traffic when reading from an interface. But you could collect traffic via a regular tcpdump and then anonymize it:

# tcpdump -i eth1 -w /tmp/test.pcap port 80
# tcpurify -r /tmp/test.cap -o /tmp/test_anonymized.pcap table mapfile=/tmp/

The tool is not perfect and does not follow modern standards. For example, it does not allow reading PCAP data from stdin and writing to stdout but it can be helpful in many cases. It deserve to be added to your toolbox.


Xavier Mertens (@xme)
Senior ISC Handler - Freelance Cyber Security Consultant

2 comment(s)

More malspam pushing password-protected Word docs for AZORult and Hermes Ransomware

Published: 2018-08-15
Last Updated: 2018-08-15 22:32:54 UTC
by Brad Duncan (Version: 1)
0 comment(s)


This is a follow-up to a previous diary from last month on malicious spam (malspam) distributing password-protected Word docs with malicious macros designed to infect vulnerable Windows computers with ransomware.


Today, I found five examples of malspam with password-protected Word docs using 1234 as the password.  The Word doc had a malicious macro that retrieved AZORult malware.  The AZORult malware conducted callback traffic, then the infected host retrieved Hermes ransomware.

Shown above:  Screen shot of a malspam example from today (1 of 2).

Shown above:  Screen shot of a malspam example from today (2 of 2).

Shown above:  Opening the password-protected Word doc on a Windows host.

Shown above:  After entering the password, a victim must enable macros.

Shown above:  Traffic from an infection filtered in Wireshark.

Shown above:  Desktop of an infected Windows host.


Malspam information from 5 email samples: 

  • Date:  Wednesday 2018-08-15
  • Received: from ([])
  • Received: from ([])
  • Received: from ([])
  • Received: from ([])
  • Received: from ([])
  • From:  Karan Fabiano =?UTF-8?B?wqA=?= <>
  • From:  Eloisa Liechty =?UTF-8?B?wqA=?= <>
  • From:  "Edgar Blanding =?UTF-8?B?wqA=?=" <>
  • From:  "Jackqueline Wroblewski =?UTF-8?B?wqA=?=" <>
  • From:  "Toni Cerulli =?UTF-8?B?wqA=?=" <>
  • Subject:  Invoice Due
  • Attachment name:  Invoice.doc

Network traffic:

  • port 80 - - GET /azo.exe
  • port 80 - - POST /index.php (AZORult traffic)
  • port 80 - - POST /index.php (AZORult traffic)
  • port 80 - - GET /hrms.exe

Associated malware:

Contact info from the decryption instructions:

  • primary email: 
  • reserve email: 

Final words

As usual, properly-administered and up-to-date Windows hosts are not likely to get infected.  System administrators and the technically inclined can also implement best practices like Software Restriction Policies (SRP) or AppLocker to prevent these types of infections.

Pcap and malware associated with today's diary can be found here.

Brad Duncan
brad [at]

0 comment(s)
ISC Stormcast For Wednesday, August 15th 2018


Diary Archives