Hunting for Malicious Files with MISP + OSSEC

Published: 2016-07-12
Last Updated: 2016-07-13 06:14:54 UTC
by Xavier Mertens (Version: 1)
2 comment(s)

A few months ago, I wrote a diary called “Unity Makes Strength” which was illustrated with an example of integration between a malware analysis solution and a next-generation firewall. The goal is to increase the ability to block malicious traffic as soon as possible. Today, I’d like to explain how to improve the detection of malware on Windows computers thanks to the integration of MISP and OSSEC. I already presented the Malware Information Sharing Platform in another diary. About OSSEC, in a few words, it is a host-based IDS with many extra features like log centralisation, real-time alerting, file integrity monitoring and much more. 

To achieve the detection of malicious files or registry keys on the Windows host, let's use a very interesting feature of OSSEC called "rootcheck" that performs rootkit detection. OSSEC comes with a default configuration that contains interesting examples but the malware landscape changing daily, this configuration is obsolete. The goal is to search a MISP database for recent IOC's and inject them into the OSSEC configuration. Both solutions are really open to the world and an integration is quite easy. 

MISP instance can be fully managed with the available REST API. To simplify the use of this API, there is even a Python library called PyMISP. Here is a very simple example to get the latest events from MISP:

from pymisp import PyMISP
from keys import misp_url, misp_key, misp_verifycert
misp = init(miss_url, misp_key)
result = misp.download_last(“1d”)
for event in result:
  print json.dumps(e) + “\n"

The data flow will be:

MISP > (via the REST API) > IOC-list > OSSEC > OSSEC agents

I wrote a small script called "MOF" which stands for "MISP OSSEC Feeder". It extracts the interesting file names from MISP. The following type of attributes are extracted:

  • Artefacts dropped
  • Payload delivery
  • Payload installation

To reduce the risk of false positives, only filenames containing Windows environment variables are exported (%TEMP%, %WINDIR%, %APPDATA%, ...). Registry keys are also exported. The script usage:

# ./ -h
usage: [-h] -t TIME [-o OUTPUT]

Extract IOC's from MISP and generate an OSSEC rootcheck file.

optional arguments:
  -h, --help            show this help message and exit
  -t TIME, --time TIME  Time machine (ex: 5d, 12h, 30m).
  -o OUTPUT, --output OUTPUT
                        Output file
# ./ -o /var/ossec/etc/shared/misp_windows_ioc.txt

The script requires the PyMISP library that can be installed easily via a "pip install pymisp".

The generated rootcheck configuration file looks like below. IOC's are grouped by MISP events.

# OSSEC RootCheck IOC generated by MOF (MISP OSSEC Feeder)
# Generated on: Mon Jul 11 22:06:56 2016
# MISP url:
# Wayback time: 30d

[MISP_2073] [any] [Packrat: Seven Years of a South American Threat Actor]

[MISP_2200] [any] [Click-Fraud Ramdo Malware Family Continues to Plague Users]
r:HKCU\SOFTWARE\Adobe\Acrobat Reader\14.0\Globals\LastLoggedOnProvider;
r:HKCU\SOFTWARE\Adobe\Acrobat Reader\14.0\Globals\IconUnderline;
r:HKCU\SOFTWARE\Adobe\Acrobat Reader\14.0\Globals\HangDetect;
r:HKCU\SOFTWARE\Adobe\Acrobat Reader\14.0\Globals\LastProgress;
r:HKCU\SOFTWARE\Adobe\Acrobat Reader\14.0\Globals\ShowTabletKeyboard;

[MISP_2210] [any] [Jigsaw Ransomware Decrypted: Will delete your files until you pay the Ransom]

The next step is to integrate this new file into your OSSEC agent.txt file. Please have a look at the OSSEC documentation for a complete description of this shared agents configuration. Here is mine (stored in '/var/ossec/etc/shared/agent.conf' by default):

<ossec_agent os="Windows">

To implement a full automation, install the script on your OSSEC server and execute it from a crontab at a regular interval (example: once a day). Note that the agent.conf is not pushed immediately to agents - it may take a while depending on your configuration! The Python script is available here. And you, how do you search for malicious files across multiple hosts/locations?

Happy hunting!

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


2 comment(s)

Microsoft Patch Tuesday Summary for July 2016

Published: 2016-07-12
Last Updated: 2016-07-12 17:17:07 UTC
by Johannes Ullrich (Version: 1)
7 comment(s)

As usual for the second Tuesday fo the month, Microsoft today released its monthly security updates. Microsoft released a total of 11 bulletins. 6 are rated critical, and the remaining five are rated important.

One of the Bulletins (MS16-093) affects Adobe's Flash player and is a copy of Adobe's advisory.

None of the bulletins stick out as "special". There are no bulletins that affect vulnerabilities for which exploits have been observed. But two bulletins included already known vulnerabilities:

CVE-2016-3287 , a vulnerability in Secure Boot.
CVE-2016-3272 , an information disclosure vulnerability in the Windows Kernel.


I don't consider either vulnerability very serious.

As far as prioritizing the patches go, I would as usual attend to the Internet Explorer, Edge, Flash and Office patches first.

The printer spool issue is "interesting". An attacker could use the vulnerability to install arbitrary print drivers, which of course would lead to arbitrary code execution. As a workaround, Microsoft suggests that you do restrict printer that your users can use to print. This sounds like a good control, and you should use this vulnerability to make sure the printer configurations are sufficiently adjusted.

For a full list of Bulletins, see our summary here. If you prefer a more structured view, you can also retrieve the bulletin data via our API here.


Johannes B. Ullrich, Ph.D.

7 comment(s)
ISC Stormcast For Tuesday, July 12th 2016


What's this all about ..?
password reveal .
<a hreaf="">the social network</a> is described as follows because they respect your privacy and keep your data secure:

<a hreaf="">the social network</a> is described as follows because they respect your privacy and keep your data secure. The social networks are not interested in collecting data about you. They don't care about what you're doing, or what you like. They don't want to know who you talk to, or where you go.

<a hreaf="">the social network</a> is not interested in collecting data about you. They don't care about what you're doing, or what you like. They don't want to know who you talk to, or where you go. The social networks only collect the minimum amount of information required for the service that they provide. Your personal information is kept private, and is never shared with other companies without your permission
<a hreaf=""> public bathroom near me</a>
<a hreaf=""> nearest public toilet to me</a>
<a hreaf=""> public bathroom near me</a>
<a hreaf=""> public bathroom near me</a>
<a hreaf=""> nearest public toilet to me</a>
<a hreaf=""> public bathroom near me</a>
Enter comment here... a fake TeamViewer page, and that page led to a different type of malware. This week's infection involved a downloaded JavaScript (.js) file that led to Microsoft Installer packages (.msi files) containing other script that used free or open source programs.
distribute malware. Even if the URL listed on the ad shows a legitimate website, subsequent ad traffic can easily lead to a fake page. Different types of malware are distributed in this manner. I've seen IcedID (Bokbot), Gozi/ISFB, and various information stealers distributed through fake software websites that were provided through Google ad traffic. I submitted malicious files from this example to VirusTotal and found a low rate of detection, with some files not showing as malware at all. Additionally, domains associated with this infection frequently change. That might make it hard to detect.
Enter corthrthmment here...

Diary Archives