mquery is a malware query accelerator developed at CERT Polska. This project provides full instrumentation around UrsaDB suitable for performing fast YARA queries.
Recommended way of installing things is to build from sources using docker-compose
:
git clone --recurse-submodules https://github.com/CERT-Polska/mquery.git
docker-compose up --scale daemon=3
where --scale daemon=...
refers to the number of workers which will execute select/index tasks.
- Run
ursadb
database (seeursadb
project for further instructions on that topic). - Install
redis-server
andpython2
. - Install requirements:
pip install -r requirements.txt
- Copy
config.example.py
toconfig.py
, remember to adjust the settings and set uniqueSECRET_KEY
. - Setup a flask application originating from
webapp.py
in your favourite web server. - Run
daemon.py
- a standalone script which should work constantly, consider putting it in systemd.
- Start up the whole system (see "Installation").
- Web interface (by default) should be available on http://localhost:80/
- Upload files to be indexed to the
mquery_samples
volume. From the host it should be visible at/var/lib/docker/volumes/mquery_samples/_data
. If in doubt, debug usingdocker image inspect mquery_samples
command. - Open web interface, choose "admin" tab and click "Index /mnt/samples".
- While indexing, the current progress will be displayed in the "backend" section of "admin" tab (no auto refresh), ursadb will also periodically report something on the console.
- After successful indexing, your files should be searchable. Go to the main tab and upload some Yara, e.g.:
rule emotet4_basic: trojan
{
meta:
author = "psrok1/mak"
module = "emotet"
strings:
$emotet4_rsa_public = { 8d ?? ?? 5? 8d ?? ?? 5? 6a 00 68 00 80 00 00 ff 35 [4] ff 35 [4] 6a 13 68 01 00 01 00 ff 15 [4] 85 }
$emotet4_cnc_list = { 39 ?? ?5 [4] 0f 44 ?? (FF | A3)}
condition:
all of them
}
Questions/comments/pull requests are welcome.
- Michał Leszczyński ([email protected])