Our CERT has issued an advisory warning about a new type of trojan. The CERT folks cannot provide many details about the malware at this point. However, to find compromised systems, they recommend watching for hosts which perform the following steps in the given order:

  1. There is an incoming SSH connection to port 2222.

  2. The host requests a file called download.html from a Web server.

  3. The host initiates two FTP sessions to (potentially different) FTP hosts, requesting one file from each of them. From the first server, a Windows executable is downloaded. From the second one, a ZIP archive is downloaded.

  4. The host joins an IRC channel on some IRC server.

Write a Bro script which monitors all internal hosts for such activity and reports when it detects a hosts doing all of these steps in the correct order.

Run your script on the trace fingerprint.pcap and validate the results. Assume that all hosts in 192.168.0.0/16 are internal and all others are external.

Solution

The complete script fingerprint.bro.