• Stars
    star
    294
  • Rank 137,473 (Top 3 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created almost 5 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🦆 Malduck is your ducky companion in malware analysis journeys

🦆 Malduck

Installation ⚙️ | Docs 📚


Malduck is your ducky companion in malware analysis journeys. It is mostly based on Roach project, which derives many concepts from mlib library created by Maciej Kotowicz. The purpose of fork was to make Roach independent from Cuckoo Sandbox project, but still supporting its internal procmem format.

Malduck provides many improvements resulting from CERT.pl codebase, making scripts written for malware analysis purposes much shorter and more powerful.

Features

  • Cryptography (AES, Blowfish, Camelie, ChaCha20, Serpent and many others)
  • Compression algorithms (aPLib, gzip, LZNT1 (RtlDecompressBuffer))
  • Memory model objects (work on memory dumps, PE/ELF, raw files and IDA dumps using the same code)
  • Extraction engine (modular extraction framework for config extraction from files/dumps)
  • Fixed integer types (like Uint64) and bitwise utilities
  • String operations (chunks, padding, packing/unpacking etc)
  • Hashing algorithms (CRC32, MD5, SHA1, SHA256)

Usage examples

AES

from malduck import aes

key = b'A'*16
iv = b'B'*16
plaintext = b'data'*16
ciphertext = aes.cbc.encrypt(key, iv, plaintext)

Serpent

from malduck import serpent

key = b'a'*16
iv = b'b'*16
plaintext = b'data'*16
ciphertext = serpent.cbc.encrypt(key, plaintext, iv)

APLib decompression

from malduck import aplib

# Headerless compressed buffer
aplib(b'T\x00he quick\xecb\x0erown\xcef\xaex\x80jumps\xed\xe4veur`t?lazy\xead\xfeg\xc0\x00')

Fixed integer types

from malduck import DWORD

def sdbm_hash(name: bytes) -> int:
    hh = 0
    for c in name:
        # operations on the DWORD type produce a dword, so a result
        # is also a DWORD.
        hh = DWORD(c) + (hh << 6) + (hh << 16) - hh
    return int(hh)

Extractor engine - module example

from malduck import Extractor

class Citadel(Extractor):
    family = "citadel"
    yara_rules = ("citadel",)
    overrides = ("zeus",)

    @Extractor.string("briankerbs")
    def citadel_found(self, p, addr, match):
        log.info('[+] `Coded by Brian Krebs` str @ %X' % addr)
        return True

    @Extractor.string
    def cit_login(self, p, addr, match):
        log.info('[+] Found login_key xor @ %X' % addr)
        hit = p.uint32v(addr + 4)
        print(hex(hit))
        if p.is_addr(hit):
            return {'login_key': p.asciiz(hit)}

        hit = p.uint32v(addr + 5)
        print(hex(hit))
        if p.is_addr(hit):
            return {'login_key': p.asciiz(hit)}

Memory model objects

from malduck import procmempe

with procmempe.from_file("notepad.exe", image=True) as p:
    resource_data = p.pe.resource("NPENCODINGDIALOG")

How to start

Install it by running

pip install malduck

More documentation can be found on readthedocs.

Co-financed by the Connecting Europe Facility by of the European Union

More Repositories

1

drakvuf-sandbox

DRAKVUF Sandbox - automated hypervisor-level malware analysis system
Python
994
star
2

Artemis

A modular vulnerability scanner with automatic report generation capabilities.
Python
449
star
3

mquery

YARA malware query accelerator (web frontend)
Python
400
star
4

karton

Distributed malware processing framework based on Python, Redis and S3.
Python
366
star
5

mwdb-core

Malware repository component for samples & static configuration with REST API interface.
Python
292
star
6

ursadb

Trigram database written in C++, suited for malware indexing
C++
117
star
7

n6

Automated handling of data feeds for security teams
Python
115
star
8

hfinger

Hfinger - fingerprinting HTTP requests
Python
108
star
9

phobos-cuda-decryptor-poc

C++
65
star
10

training-materials

PHP
50
star
11

mwdblib

Client library for the mwdb service by CERT Polska.
Python
39
star
12

hsn2-bundle

Shell
28
star
13

mailgoose

A web application that allows the users to check whether their SPF, DMARC and DKIM configuration is set up correctly.
Python
28
star
14

nymaim-tools

C
26
star
15

dbglib

C#
21
star
16

Artemis-modules-extra

Python
20
star
17

training-mwdb

MWDB exercises
Python
19
star
18

phishing-api

Python
17
star
19

karton-misp-pusher

Python
16
star
20

n6sdk

Server-side SDK to provide a simple REST API for distribution of security information.
Python
16
star
21

anti-modlishka

Python
12
star
22

karton-playground

Python
12
star
23

mwdb_iocextract

Python
10
star
24

HSN-Capture-HPC-NG

HoneySpider Network version of Capture-HPC
C++
10
star
25

drakpdb

Convert Windows PDB into JSON profile supported by DRAKVUF/LibVMI
Python
8
star
26

karton-config-extractor

Static configuration extractor for the Karton framework
Python
8
star
27

ursadb-cli

Lightweight Python client for ursadb
Python
8
star
28

karton-pcap-miner

Python
8
star
29

proactive-detection-survey

Reference material for the proactive detection of incidents survey
7
star
30

karton-classifier

File type classifier for the Karton framework.
Python
6
star
31

mwdb-plugin-drakvuf

DRAKVUF Sandbox simple integration plugin for mwdb-core.
Python
6
star
32

karton-dashboard

A small Flask application that allows for Karton task and queue introspection.
HTML
6
star
33

swf-tools

Java
5
star
34

karton-yaramatcher

File and analysis artifacts yara matcher for Karton framework
Python
5
star
35

snort3-x509-reputation-plugin

Snort3 x509 reputation plugin
C++
5
star
36

karton-archive-extractor

Extractor of various archive formats for Karton framework
Python
5
star
37

mtracker

Python
5
star
38

hsn2-cuckoo

Python
4
star
39

hsn2-yara

Python
4
star
40

malduck-modules

YARA
4
star
41

hsn2-pcap-extract

Python
3
star
42

hsn2-shell-scdbg

Java
3
star
43

karton-autoit-ripper

AutoIt script ripper for Karton framework
Python
3
star
44

karton-asciimagic

Various decoders for ascii-encoded executables for Karton framework
Python
3
star
45

karton-mwdb-reporter

Karton service that uploads analyzed artifacts and metadata to MWDB Core
Python
2
star
46

hsn2-pcap-analyze

Python
2
star
47

hsn2-malicious-domains

Python
2
star
48

hsn2-unicorn

Java
2
star
49

hsn2-razorback

C
2
star
50

hsn2-framework

Java
2
star
51

hsn2-commons-python-lib

Python
2
star
52

python-deploy

Build, push and deploy k8s services with single deploy.json file to provide common convention for multiple production services.
Python
2
star
53

hsn2-js-sta

C++
1
star
54

hsn2-dnsinfo

Java
1
star
55

hsn2-object-store-mongodb

Java
1
star
56

hsn2-swf-cve

Java
1
star
57

hsn2-url-feeder

Python
1
star
58

hsn2-commons-python-protobuf

Python
1
star
59

hsn2-commons-java

Java
1
star
60

hsn2-cuckoo-java

Java
1
star
61

hsn2-norm-url

Java
1
star
62

hsn2-webclient

Java
1
star
63

hsn2-file-feeder

Java
1
star
64

hsn2-commons-debian

Shell
1
star
65

hsn2-commons-protobuf-definitions

C++
1
star
66

hsn2-console

Python
1
star
67

hsn2-capture-hpc

Java
1
star
68

hsn2-md5-to-ssdeep

Java
1
star
69

hsn2-thug

Python
1
star
70

hsn2-reporter

Java
1
star
71

hsn2-data-store

Java
1
star