Malcom is a tool designed to analyze a system's network communication using graphical representations of network traffic, and cross-reference them with known malware sources. This comes handy when analyzing how certain malware species try to communicate with the outside world.
What is Malcom?
Malcom can help you:
- detect central command and control (C&C) servers
- understand peer-to-peer networks
- observe DNS fast-flux infrastructures
- quickly determine if a network artifact is 'known-bad'
Check the wiki for a Quickstart with some nice screenshots and a tutorial on how to add your own feeds.
If you need some help, or want to contribute, feel free to join the mailing list or try to grab someone on IRC (#malcom on freenode.net, it's pretty quiet but there's always someone around). You can also hit up on twitter @tomchop_
Here's an example graph for host tomchop.me
Dataset view (filtered to only show IPs)
- Make sure
- Elevate your privileges to root (yeah, I know, see disclaimer)
- Start the webserver using the default configuration with
./malcom.py -c malcom.conf(or see options with
./malcom.py --help) ** For an example configuration file, you can copy
malcom.conf** Default port is 8080 ** Alternatively, run the feeds from
celery. See the feeds section for details on how to to this.
Malcom is written in python. Provided you have the necessary libraries, you should be able to run it on any platform. I highly recommend the use of python virtual environments (
virtualenv) so as not to mess up your system libraries.
The following was tested on Ubuntu server 14.04 LTS:
redis, and other dependencies
$ sudo apt-get install build-essential git python-dev libevent-dev mongodb libxml2-dev libxslt-dev zlib1g-dev redis-server libffi-dev libssl-dev python-virtualenv
- Clone the Git repo:
$ git clone https://github.com/tomchop/malcom.git malcom
- Create your virtualenv and activate it:
$ cd malcom
$ virtualenv env-malcom
$ source env-malcom/bin/activate
- Get and install
$ cd ..
$ wget http://www.secdev.org/projects/scapy/files/scapy-latest.tar.gz
$ tar xvzf scapy-latest.tar.gz
$ cd scapy-2.1.0
$ python setup.py install
- Still from your virtualenv, install necessary python packages from the
$ cd ../malcom
$ pip install -r requirements.txt
- For IP geolocation to work, you need to download the Maxmind database and extract the file to the
malcom/Malcom/auxiliary/geoIPdirectory. You can get Maxmind's free (and thus more or less accurate) database from the following link: http://dev.maxmind.com/geoip/geoip2/geolite2/:
$ cd Malcom/auxiliary/geoIP
$ wget http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz
$ gunzip -d GeoLite2-City.mmdb.gz
$ mv GeoLite2-City.mmdb GeoIP2-City.mmdb
- Launch the webserver from the
./malcom.py --helpfor listen interface and ports.
- For starters, you can copy the
./malcom.py -c malcom.conf
- For starters, you can copy the
By default, Malcom will try to connect to a local mongodb instance and create its own database, named
malcom. If this is OK for you, you may skip the following steps. Otherwise, you need to edit the
databasesection of your
Set an other name for your Malcom database
By default, Malcom will use a database named
malcom. You can change this behavior by editing the
malcom.conffile and setting the
namedirective from the
databasesection to your liking.
name = my_malcom_database
By default, Malcom will try to connect to
localhost, but your database may be on another server. To change this, just set the
hostsdirective. You may use hostnames or IPv4/v6 addresses (just keep in mind to enclose your IPv6 addresses between
If you'd like to use a standalone database on host
my.mongo.server, just set:
[database]You can also specify the port mongod is listening on by specifying it after the name/address of your server, separated with a
hosts = my.mongo.server
[database]And if you're using a
hosts = localhost:27008
my.mongo2.server, just set:
hosts = my.mongo1.server,my.mongo2.server
You may have configured your mongod instances to enforce authenticated connections. In that case, you have to set the username the driver will have to use to connect to your mongod instance. To do this, just add a
usernamedirective to the
databasesection in the
malcom.conffile. You may also have to set the password with the
passworddirective. If the user does not have a password, just ignore (i.e. comment out) the
[database]If the user is not linked to the
username = my_user
password = change_me
malcomdatabase but to another one (for example the
admindatabase for a admin user), you will have to set the
authentication_databasedirective with the name of that database.
authentication_database = some_other_database
Case of a replica set
When using a replica set, you may need to ensure you are connected to the right one. For that, just add the
replsetdirective to force the mongo driver to check the name of the replicaset
[database]By default, Malcom will try to connect to the primary node of th replica set. You may need/want to change that. In order to change that behaviour, just set the
replset = my_mongo_replica
read_preferencedirective. See the mongo documentation for more information.
[database]Supported read preferences are:
read_preference = NEAREST
The quickest way to get you started is to pull the Docker image from the public docker repo. To pull older, more stable Docker builds, use
$ sudo docker pull tomchop/malcom-automaticConnecting to
$ sudo docker run -p 8080:8080 -d --name malcom tomchop/malcom-automatic
http://<docker_host>:8080/should get you started.
Quick note on TLS interception
Malcom now supports TLS interception. For this to work, you need to generate some keys in Malcom/networking/tlsproxy/keys. See the KEYS.md file there for more information on how to do this.
Make sure you also have IPtables (you already should) and permissions to do some port forwarding with it (you usually need to be root for that). You can to this using the convenient
forward_port.shscript. For example, to intercept all TLS communications towards port 443, use
forward_port.sh 443 9999. You'll then have to tell malcom to run an interception proxy on port
Expect this process to be automated in future releases.
Malcom was designed and tested on a Ubuntu Server 14.04 LTS VM.
If you're used to doing malware analysis, you probably already have tons of virtual machines running on a host OS. Just install Malcom on a new VM, and route your other VM's connections through Malcom. Use
enable_routing.shto activate routing / NATing on the VM Malcom is running on. You'll need to add an extra network card to the guest OS.
As long as it's getting layer-3 network data, Malcom can be deployed anywhere. Although it's not recommended to use it on high-availability networks (it wasn't designed to be fast, see disclaimer), you can have it running at the end of your switch's mirror port or on your gateway.
To launch an instance of Malcom that ONLY fetches information from feeds, run Malcom with the
--feedsoption or tweak the configuration file.
Your database should be populated automatically. If you can dig into the code, adding feeds is pretty straightforward (assuming you're generating
Evilobjects). You can find an example feed in
/feeds/zeustracker. A more detailed tutorial is available here.
You can also use
celeryto run feeds. Make sure celery is installed by running
$ pip install celeryfrom your virtualenv. You can then use
celery worker -E --config=celeryconfig --loglevel=DEBUG --concurrency=12to launch the feeding process with 12 simultaneous workers.
Malcom was written mostly from scratch, in Python. It uses the following frameworks to work:
- flask - a lightweight python web framework
- mongodb - a NoSQL database. It interfaces to python with pymongo
- redis - An advanced in-memory key-value store
- bootstrap - a CSS framework that will eventually kill webdesign, but makes it extremely easy to quickly "webize" applications that would only work through a command prompt.