AdversariaLib: An Open-source Library for the Security Evaluation of Machine Learning Algorithms Under Attack

Igino Corona, Battista Biggio, Davide MaiorcaarXiv 2016

Introduction

AdversariaLib is an open-source Python library designed to stress-test machine learning (ML) models by simulating adversarial attacks. It provides a standardized framework for "security evaluation"—the proactive identification of vulnerabilities in classifiers, such as spam filters or malware detectors, before they are exploited in real-world environments.

The Problem: Violating the Stationarity Assumption

Most machine learning models are built on the assumption of stationarity: the premise that the data encountered during deployment will mirror the data seen during training. In security-sensitive applications like intrusion detection or malware analysis, this assumption is routinely violated. Intelligent adversaries actively manipulate their data to bypass filters or "poison" the learning process. While various attacks and defenses have been proposed, there has historically been a lack of unified, open-source tools to perform systematic security evaluations. AdversariaLib fills this gap by providing a modular environment to simulate attacks and evaluate how ML algorithms perform under adversarial pressure.

System Architecture and Methodology

The library is built with a modular Python architecture, relying on established libraries like scikit-learn and FANN (Fast Artificial Neural Networks) for core ML functionality, while utilizing C/C++ for performance-critical attack simulations.

Figure 1: The modular architecture of AdversariaLib, showing the interaction between third-party libraries, core modules (advlib, prlib, util), and the experimental pipeline.

Key components include:

  • advlib: The core module containing attack algorithms, currently focused on gradient-based evasion.
  • prlib: A wrapper module for handling datasets, distance measures, and standard ML training/evaluation routines.
  • Surrogate Classifiers: A standout feature that allows researchers to simulate realistic "black-box" attacks. Instead of assuming the attacker knows the target model's exact parameters, the library allows the attacker to train a "surrogate" model on similar data to craft attacks that often successfully transfer to the hidden target model.
  • runexp Script: A general experimental pipeline that automates data splitting, model training, attack execution, and result logging.

Experimental Case Study: MNIST Evasion

The library's utility is demonstrated using the MNIST dataset of handwritten digits. In this scenario, a linear Support Vector Machine (SVM) is tasked with distinguishing between the digits '3' and '7'. The authors employ a gradient-based evasion attack to iteratively modify an initial digit '3' until the SVM misclassifies it as a '7'.

Figure 4: Qualitative results of a gradient-based evasion attack on the MNIST dataset, showing the transition of a digit '3' across the decision boundary (g(x)=0) until the final iteration.

Key Insights and Results

  • Proactive Security: By using AdversariaLib, developers can "red-team" their models during the design phase to identify potential weaknesses before deployment.
  • The Power of Surrogates: The experiments confirm that an attacker does not need to know a model's internal weights to break it. Surrogate models can effectively find "evasion points" that transfer to the real system.
  • Evasion is Not Mimicry: As shown in the MNIST example, a '3' can be manipulated to be misclassified as a '7' without actually looking like a '7' to a human. The attack simply pushes the data point across the model's mathematical decision boundary, proving that standard ML models often rely on features that do not align with human perception.

Limitations and Future Work

At present, the library primarily focuses on evasion attacks (manipulating data at test time). Future versions aim to implement poisoning attacks (manipulating data at training time) and include built-in countermeasures to help researchers test the efficacy of "secure" classifiers. As an open-source project, its long-term utility depends on community contributions to keep pace with the evolving field of adversarial machine learning.

Summary updated

BibTeX
@misc{corona2016adversarialib,
  author = {Igino Corona and Battista Biggio and Davide Maiorca},
  title = {{AdversariaLib: An Open-source Library for the Security Evaluation of Machine Learning Algorithms Under Attack}},
  year = {2016},
  eprint = {1611.04786},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1611.04786},
}
Figure