Skip to main content

Pytorch-based library for creating Adversarial EXEmples against Windows Malware detectors.

Project description

Maltorch: Pentesting Suite for AI-based Windows Malware Detectors

PyPI GitHub code size in bytes GitHub issues PyPI - Python Version PyPI - Downloads

Testing the security of AI-based Windows malware detectors has never been easier! You can deploy maltorch, boot up models already trained with PyTorch, and deploy an arsenal of testing techniques before placing an AV in production.

Installation

You can install maltorch through pip, but you also need a custom version of EMBER due to numpy portability issues.

pip install maltorch
pip install git+https://github.com/zangobot/ember.git

Included manipulations

Maltorch contains most of the practical manipulations of this field:

  • DOS header extension and editing (PartialDOS, FullDOS, Extend)
  • Content shifting
  • Section injection with optimized or goodware content (GAMMA)
  • Padding

Most of the manipulations can be used either with gradient-based and gradient-free optimization.

Loading AI-based Models

The library already provides tons of pre-trained models, you can instantiate one by just:

from maltorch.zoo.malconv import MalConv
model = MalConv.create_model()

and it also accepts device parameter to load the model in GPU.

Evasion Attacks

Straight-forward way to compute attacks! You just neet to load the model, instantiate the attack, and then pass the model to the freshly-created technique:

from torch.utils.data import TensorDataset, DataLoader
from maltorch.adv.evasion.partialdos import PartialDOS
from maltorch.data.loader import load_from_folder, create_labels
from maltorch.zoo.malconv import MalConv

model = MalConv.create_model()

# Load data as a Pytorch DataLoader
folder_with_exe = ...
X = load_from_folder(folder_with_exe, "exe",device=device)
y = create_labels(X, 1, device=device)
dl = DataLoader(TensorDataset(X, y), batch_size=3)

# Store adversarial EXEmples into a new DataLoader
attack = PartialDOS(query_budget=3)
adversarial_loader = attack(model, torch_data_loader)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maltorch-0.3.3.tar.gz (56.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

maltorch-0.3.3-py3-none-any.whl (96.7 kB view details)

Uploaded Python 3

File details

Details for the file maltorch-0.3.3.tar.gz.

File metadata

  • Download URL: maltorch-0.3.3.tar.gz
  • Upload date:
  • Size: 56.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for maltorch-0.3.3.tar.gz
Algorithm Hash digest
SHA256 6bf7ff71d0fd9bd08a26e97da098a466ecb5e593b6673e3d6d2fe3994ddae9df
MD5 e49a445e379f8bf4bb635655aea19b7d
BLAKE2b-256 f3288b67a55e26aa99c1f227ba494b0b0f66b9520fa0af981799a0c0d28cae3c

See more details on using hashes here.

File details

Details for the file maltorch-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: maltorch-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 96.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for maltorch-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8d37395640dba8370fa9d55da3642dd780abd50cfd85fbf980ad8ac0166edd49
MD5 9a15db994845267d66096c10b1dec283
BLAKE2b-256 fc013992a729aa9d4ffc32685cb63a98823020eea714b6b44a1af1b1730d843d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page