Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
modelscan — Protection against Model Serialization Attacks | Kitploit
Tools/GitHubGitHub/protectai/modelscan
Defensive ToolsStatic AnalysisVulnerability ScannersDevSecOpsSupply Chain SecurityMachine LearningAI SecurityAdversarial AttackTop in Adversarial Attack #13Top in AI Security #13
778167487 months agoReviewed by Kitploit

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Top in Machine Learning #8
GitHubprotectai/modelscan

modelscan

Protection against Model Serialization Attacks

View RepositoryWebsite
Share

ModelScan Banner bandit build black mypy tests Supported Versions pypi Version License: Apache 2.0 pre-commit

ModelScan: Protection Against Model Serialization Attacks

Machine Learning (ML) models are shared publicly over the internet, within teams and across teams. The rise of Foundation Models have resulted in public ML models being increasingly consumed for further training/fine tuning. ML Models are increasingly used to make critical decisions and power mission-critical applications. Despite this, models are not yet scanned with the rigor of a PDF file in your inbox.

This needs to change, and proper tooling is the first step.

ModelScan Preview

ModelScan is an open source project from Protect AI that scans models to determine if they contain unsafe code. It is the first model scanning tool to support multiple model formats. ModelScan currently supports: H5, Pickle, and SavedModel formats. This protects you when using PyTorch, TensorFlow, Keras, Sklearn, XGBoost, with more on the way.

TL;DR

If you are ready to get started scanning your models, it is simple:

pip install modelscan

With it installed, scan a model:

modelscan -p /path/to/model_file.pkl

Why You Should Scan Models

Models are often created from automated pipelines, others may come from a data scientist’s laptop. In either case the model needs to move from one machine to another before it is used. That process of saving a model to disk is called serialization.

A Model Serialization Attack is where malicious code is added to the contents of a model during serialization(saving) before distribution — a modern version of the Trojan Horse.

The attack functions by exploiting the saving and loading process of models. When you load a model with model = torch.load(PATH), PyTorch opens the contents of the file and begins to running the code within. The second you load the model the exploit has executed.

A Model Serialization Attack can be used to execute:

  • Credential Theft(Cloud credentials for writing and reading data to other systems in your environment)
  • Data Theft(the request sent to the model)
  • Data Poisoning(the data sent after the model has performed its task)
  • Model Poisoning(altering the results of the model itself)

These attacks are incredibly simple to execute and you can view working examples in our 📓notebooks folder.

Enforcing And Automating Model Security

ModelScan offers robust open-source scanning. If you need comprehensive AI security, consider Guardian. It is our enterprise-grade model scanning product.

Guardian Overview

Guardian's Features:

  1. Cutting-Edge Scanning: Access our latest scanners, broader model support, and automatic model format detection.
  2. Proactive Security: Define and enforce security requirements for Hugging Face models before they enter your environment—no code changes required.
  3. Enterprise-Wide Coverage: Implement a cohesive security posture across your organization, seamlessly integrating with your CI/CD pipelines.
  4. Comprehensive Audit Trail: Gain full visibility into all scans and results, empowering you to identify and mitigate threats effectively.

Getting Started

How ModelScan Works

If loading a model with your machine learning framework automatically executes the attack, how does ModelScan check the content without loading the malicious code?

Simple, it reads the content of the file one byte at a time just like a string, looking for code signatures that are unsafe. This makes it incredibly fast, scanning models in the time it takes for your computer to process the total filesize from disk(seconds in most cases). It also secure.

ModelScan ranks the unsafe code as:

  • CRITICAL
  • HIGH
  • MEDIUM
  • LOW

ModelScan Flow Chart

If an issue is detected, reach out to the author's of the model immediately to determine the cause.

In some cases, code may be embedded in the model to make things easier to reproduce as a data scientist, but it opens you up for attack. Use your discretion to determine if that is appropriate for your workloads.

What Models and Frameworks Are Supported?

This will be expanding continually, so look out for changes in our release notes.

At present, ModelScan supports any Pickle derived format and many others:

Download Tool