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.5.tar.gz (58.4 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.5-py3-none-any.whl (98.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: maltorch-0.3.5.tar.gz
  • Upload date:
  • Size: 58.4 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.5.tar.gz
Algorithm Hash digest
SHA256 62fd2485e4938b99a0b5e6ae2f2e7fcb2b2f01ff83942248a38929697831135d
MD5 c855a8eb57491ff85c396430b84c7e6d
BLAKE2b-256 13e4fa04843a05088c0b143e6a343905abbac7c40bbc7cde8d2eb328a32c0754

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maltorch-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 98.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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 48772cbc038e051d1a6827f92af06139d53a70d6da836ec580b9842001464fde
MD5 d3f6a8beeec302d5b37741412537a958
BLAKE2b-256 e0d20f6d128ebe91b21c0c87a8c7ed2ec353e7c59e4d9b4f4d3a232172957086

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