Your AI Model Passed the Scanner. What Did It Fail to Detect?

Malicious model files, scanner-evasion research and safer serialization formats have changed the security requirements for open-weight AI. An investigation into what Hugging Face's controls can verify—and what enterprises must assess independently.

A machine-learning engineer downloads a pretrained model from a public repository. The model has documentation, a recognizable file format and no visible malware warning. It appears suitable for evaluation. When the engineer loads it, however, the model file executes instructions that were never part of the intended machine-learning task.

The risk has been documented in real repositories. In February 2024, JFrog researchers disclosed malicious machine-learning models hosted on Hugging Face that could execute attacker-controlled code during loading. A year later, ReversingLabs identified another technique, called nullifAI, that used deliberately malformed model files to evade security scanning while retaining the ability to execute malicious instructions. Academic research has since demonstrated additional weaknesses in model-loading defenses and scanning systems.

The findings expose a limitation in Hugging Face model security that extends across the open-model ecosystem: a repository security check cannot independently establish that every component of a downloaded model is safe. The issue is not unique to Hugging Face, which has invested in malware scanning, pickle-file inspection, third-party security integrations and safer serialization formats. The larger problem lies in the difference between the properties those controls assess.

A file can pass a malware scanner while retaining dangerous loading behavior. A model can use a serialization format designed to prevent arbitrary code execution while containing an intentionally induced behavioral backdoor. A signed repository commit can establish who published a particular artifact without demonstrating that the artifact is safe. For enterprises incorporating externally sourced models into production systems, these distinctions shape the security responsibilities that begin after a model is selected.

Earlier in this series, Part 2 examined behavioral backdoors embedded through training and whether downstream adaptation could remove them. This article examines a different model-supply-chain problem: what enterprise security controls can—and cannot—establish when an externally sourced model first enters the development environment.

Hugging Face has become a distribution point for enterprise AI

Public model repositories have changed how organizations build machine-learning applications. Instead of training every model from the beginning, developers can obtain pretrained models, evaluate them and adapt them for particular tasks.

Hugging Face supports this exchange through its Hub, which hosts models, datasets and applications contributed by organizations and individual developers. The availability of reusable artifacts reduces development costs and shortens experimentation, but it also means that a model may enter an enterprise environment through a development workflow rather than a formal software procurement process.

A developer might select a model because it performs well on a benchmark, has an acceptable license or appears popular within the community. Those characteristics can be relevant to technical evaluation, but they are not evidence that the model’s files, accompanying code and training history have received the level of security scrutiny required for deployment.

This is one manifestation of the broader fragmented-assurance problem examined in Part 1 of the aiautomatein AI Supply Chain Security series. A model repository can contain serialized weights, configuration files, tokenizers, Python modules and other artifacts. Some files are data; others can influence software execution. A complete security assessment has to distinguish between them.

Why pickle became a model-loading security problem

Python’s pickle serialization system is widely used to store and restore software objects. Historically, pickle-based serialization was also common in machine-learning workflows, including PyTorch checkpoint files.

The format is flexible because it can represent complex Python objects, but that flexibility creates security risk. Deserializing untrusted pickle content can invoke Python functions and execute code during loading. A malicious model file can therefore act as an executable attack vehicle even when it is presented as a collection of model weights.

Hugging Face’s Pickle Scanning documentation explicitly warns about arbitrary-code-execution attacks associated with loading pickle files. The platform provides scanning and import inspection to help identify suspicious files, but inspecting a serialized artifact is different from executing it inside an unrestricted development environment.

A scanner attempts to recognize unsafe patterns before loading. An attacker attempts to construct a file whose dangerous behavior is not recognized by that scanner. This creates an ongoing contest between detection techniques and malicious serialization methods.

The danger is associated with loading, not merely downloading

A malicious model file does not necessarily compromise a machine simply because it exists in a repository or has been downloaded. The consequential operation may occur when a developer or application loads the artifact using an unsafe deserialization process.

The distinction matters during incident investigation because repository download counts cannot automatically be interpreted as infections. A file may have been downloaded but never executed, examined inside an isolated environment or rejected by another security control.

Conversely, a single unsafe loading operation may expose a development environment containing credentials, source code or network access to other systems. The resulting consequence depends on the privileges available to the loading process.

JFrog found malicious models with remote-access payloads

On February 27, 2024, JFrog researcher David Cohen published an investigation into malicious machine-learning models hosted on Hugging Face.

The researchers identified a model whose loading could execute a payload providing a remote shell on the affected machine. Their investigation described approximately 100 malicious model instances detected through the company’s research and scanning activities at that time.

The figure represented the research team’s findings, not the total number of malicious models on Hugging Face. JFrog also identified different model-file formats that could expose users to executable payloads.

The investigation demonstrated why model repositories must be evaluated as potential software-distribution channels. An attacker does not necessarily need to exploit the language model’s inference behavior because the model-loading process itself can become the point of compromise.

That changes the enterprise threat model. The victim may be a machine-learning engineer evaluating a model, an automated training pipeline or a server responsible for loading artifacts before deployment. The target is not always the eventual user of the AI application; it may instead be the infrastructure used to build it.

ReversingLabs demonstrated how malformed files can defeat scanners

In February 2025, ReversingLabs disclosed a technique it named nullifAI. The researchers found malicious models that used corrupted pickle streams to evade existing security checks.

The method exploited an important property of pickle deserialization. A malicious operation could be placed near the beginning of the serialized content while a later portion of the file was deliberately malformed. The scanning process could fail when it encountered the corrupted structure, yet unsafe loading could execute the earlier malicious instructions before reaching the error.

The result was a model that could fail to load correctly while still compromising the system attempting to load it. ReversingLabs described the technique in its February 6 research report.

The investigation demonstrated a problem with treating parsing failure as a harmless condition. A file that cannot be fully inspected should not be considered safe merely because the scanner did not produce a positive malware finding. The appropriate conclusion may instead be that the file remains unverified.

Why scanner errors should not be interpreted as clean results

Security controls commonly produce several possible outcomes. A scanner may determine that a file matches a known malicious pattern, complete an inspection without detecting the patterns it was designed to identify, or fail to inspect the file fully.

Those states should remain distinct. A successful scan with no findings is not a guarantee of safety, while an incomplete scan provides even less assurance.

For enterprises receiving models from external repositories, a scan failure should trigger investigation or rejection according to the organization’s risk policy. Treating a failed scan as equivalent to a clean scan undermines the purpose of the control.

Research at ACM CCS 2025 quantified the trade-off in secure model loading

The peer-reviewed paper PickleBall: Secure Deserialization of Pickle-based Machine Learning Models, presented at ACM CCS 2025, examined model-loading security in the Hugging Face ecosystem.

Andreas D. Kellas and colleagues studied the continued use of pickle-based model formats despite the availability of safer alternatives. The researchers found that repositories containing pickle-based models still attracted substantial download activity and also identified a practical limitation of restrictive loading systems: some legitimate models require functionality that strict loading policies prohibit.

The research evaluated PickleBall, a system designed to derive permissible loading behavior from the libraries associated with a model. The evaluation used 336 model samples, including 252 benign models and 84 malicious examples.

PickleBall successfully loaded approximately 79.8% of the benign models while preventing the malicious payloads in the study from executing. The authors reported an average runtime overhead of approximately 2.62%, with a median overhead of 1.75%.

These results demonstrate that more selective loading policies can reduce particular deserialization risks, but they also expose an operational difficulty. A security mechanism that blocks too many legitimate models can disrupt workflows or encourage developers to disable protection, while a permissive loader may support more models while allowing unsafe behavior.

The appropriate balance depends on the deployment environment. No performance figure from one benchmark should be interpreted as universal protection.

In 2026, researchers continued finding scanner-evasion techniques

Two additional studies published in 2026 extended the evidence. The July 2026 preprint ShadowPickle: Evading Machine Learning Model Scanners via Stealthy Pickle Deserialization Attacks investigated three attack techniques exploiting pickle loading behavior.

The researchers reported evasion of ten evaluated scanners and four model-hub defenses under their experimental conditions. The strongest reported evasion rate for one attack configuration was 63%, demonstrating that scanner effectiveness could vary significantly depending on the serialization technique an attacker used.

An October 2026 preprint, DITTO: A Context-aware Pickle-based Pre-Trained Model Scanner for Effective Security Audits, examined another limitation of existing scanners: the trade-off between detecting malicious behavior and producing excessive false alarms.

The researchers analyzed more than 10,000 popular Hugging Face repositories and found that 9.3% relied on pickle. They also constructed a benchmark containing 959 benign models and 92 malicious models. Under the evaluated conditions, DITTO reported full scanning coverage, a zero false-negative rate and a 0.7% false-positive rate.

These are the authors’ benchmark results, not independent verification that the system detects every possible malicious pickle. The study nevertheless illustrates an important direction for defensive research: analyzing serialized operations in their execution context instead of relying exclusively on fixed lists of suspicious functions.

The research results should not be treated as vendor rankings

The studies used different datasets, attack techniques and evaluation methods. PickleBall examined secure loading policies, ShadowPickle investigated scanner evasion, and DITTO evaluated context-aware detection.

Their percentages therefore cannot be combined into a single comparison of commercial security vendors. A lower attack-success rate in one experiment does not prove that the tested product is superior across every relevant model format.

Enterprise buyers should examine the exact attack classes, loading conditions and artifact types covered by each evaluation.

Safetensors addresses one specific category of risk

Hugging Face developed safetensors as a format designed to store tensor data without relying on the executable object-deserialization behavior associated with pickle. The design significantly reduces the risk of arbitrary code execution arising from the weight-file serialization mechanism.

Hugging Face’s current serialization documentation recommends safe serialization for security reasons. PyTorch has also introduced safer loading behavior: according to its serialization documentation, torch.load uses weights_only=True by default beginning with version 2.6 when a custom pickle_module is not supplied.

These developments reduce exposure to unsafe loading patterns, but they do not establish that every model saved in safetensors is safe. The format does not validate a model’s training history, license, performance, fairness or resistance to hidden behavioral triggers, nor does it establish that every file accompanying the weights is harmless.

A repository may contain configuration files, scripts or custom model implementations that require separate inspection. Safetensors is therefore an important defense against malicious weight-file deserialization, not an end-to-end model-security certificate.

Custom model code introduces a separate execution boundary

Some models require custom Python code beyond the standard implementations available in a machine-learning framework. Hugging Face Transformers supports loading such implementations through its trust_remote_codesetting.

The Transformers documentation describes the setting as permission to use custom model code from a repository and warns that enabling it executes repository code on the local machine.

This creates a significant distinction between loading model data and executing repository-provided code. A developer may download a model in safetensors format while also allowing custom Python modules to execute; the weight-file format does not make those modules safe.

For enterprises, custom code should be subject to the same review expectations as other externally sourced software. It may require controlled execution, dependency inspection and restrictions on filesystem and network access.

Model versions should be pinned to approved revisions

Hugging Face repositories use Git-based versioning, and developers can specify a model revision using a commit identifier. The practice reduces the risk of a model changing unexpectedly between development and deployment and makes security investigations more reproducible.

An organization that records only a model’s public name may struggle to establish which exact files were downloaded. A revision identifier and relevant file hashes provide stronger evidence.

However, pinning a revision does not establish that the selected version is free from malicious content. It helps preserve the identity of the artifact being evaluated.

Signing establishes origin, not safe behavior

Hugging Face supports signed commits using GPG. Its commit-signing documentation explains how contributors can provide evidence associating commits with cryptographic signing identities, which can assist verification of repository history.

The mechanism addresses a different question from malware scanning. A valid signature can support confidence that a commit was made by an expected signing identity and has not been altered without detection, but it does not establish that the signer performed adequate security testing.

A malicious file can be distributed through a correctly signed commit if the signer is malicious or the publishing process has been compromised. Model provenance therefore requires more than a verified identity.

Enterprises need to assess the trustworthiness of the publisher, the integrity of the publication process and the security properties of the resulting artifacts. These issues connect directly to the AI-BOM and provenance problem examined in Part 3 of the series. An inventory can identify a model, supplier, revision and associated dependencies, but it cannot independently demonstrate that the model’s learned behavior is safe or that every associated executable component has been thoroughly examined.

Model malware and behavioral backdoors are different threats

The word backdoor is used to describe several distinct problems in AI security. One involves malicious software executed when a model file is loaded; another involves model behavior deliberately influenced during training.

The first may produce remote access to the machine running the loading process. The second may cause the model to generate attacker-selected outputs when particular conditions appear.

Safetensors and restrictive deserialization controls primarily address the first category. Behavioral backdoors require different forms of evaluation.

Research such as BadNets and Sleeper Agents has shown that models can retain deliberately induced behavior under selected experimental conditions. A clean model-file scan cannot prove that such behavior is absent.

This distinction is particularly important for organizations purchasing models for sensitive applications. A model can be free from executable malware and still be unsuitable for a particular business decision. Conversely, a model with ordinary inference behavior can compromise infrastructure if it is packaged in a malicious executable format.

Model security must address both possibilities without treating them as one vulnerability.

The July 2026 Hugging Face incident illustrates another trust boundary

In July 2026, Hugging Face disclosed an intrusion involving autonomous AI-driven offensive activity against its infrastructure.

The company’s later technical reconstruction described approximately 17,600 recovered attacker actions during the campaign. The incident involved exploitation of infrastructure and credentials rather than demonstrating a malicious model loaded through a pickle file.

That distinction matters. The compromise should not be presented as another example of the nullifAI technique or as evidence that Hugging Face’s model-scanning controls failed.

It illustrated a different supply-chain concern: the security of the hosting platform and the systems that support artifact distribution. A model marketplace depends on account security, service availability, access controls and the integrity of publishing infrastructure, and even a well-designed artifact scanner cannot substitute for those controls.

In its disclosure, Hugging Face recommended precautionary credential actions and described changes to its infrastructure. The incident is therefore a reminder that model repository security includes more than examining uploaded files. The identity and authority of publishers, integrity of platform services and protection of credentials all influence the trustworthiness of the distribution channel.

What commercial platforms currently protect

The AI model-security market contains several distinct product categories. Hugging Face provides repository-hosting controls and security checks, security vendors offer malicious-model detection and artifact scanning, and cloud platforms maintain model registries, development environments and deployment controls.

These capabilities overlap, but they are not interchangeable.

Provider or ecosystemDocumented capabilityWhat it addressesWhat remains outside the guarantee
Hugging Face HubMalware scanning, pickle inspection, signed commits and repository controlsSelected malicious artifacts, repository identity and access securityComprehensive behavioral safety and every unknown scanner-evasion technique
JFrogMalicious-model research and scanning integrationsSelected executable payloads in model artifactsAbsence of all hidden behavioral backdoors
Palo Alto Networks Prisma AIRSAI model scanning and broader AI security capabilitiesModel-file threats, backdoors, unsafe serialization and related AI deployment risksUniversal assurance across all model architectures and attack types
ReversingLabsSoftware artifact analysis and malicious-model researchMalicious serialized content and related package risksAll forms of model poisoning and runtime misuse
NVIDIA NGCModel signing and distribution controlsArtifact origin and integritySafety of the model’s learned behavior
AWS, Microsoft and Google CloudModel registries, identity, governance and deployment securityLifecycle management, configured access and infrastructure controlsSecurity of every third-party artifact incorporated by customers

The comparison describes published capabilities rather than an independent certification or product ranking. For enterprise buyers, the key procurement question is which threats a control has actually been tested against.

A claim to scan models should be accompanied by information about supported formats, detection methods and how the product handles files it cannot inspect. A claim to provide provenance should identify which artifacts and transformations are covered, while a claim to protect runtime behavior should specify which actions can be blocked and how enforcement occurs.

The same principle applies beyond model artifacts. Part 5 of this series examined how an approved external tool can remain a security risk when supplier-controlled metadata influences an agent at runtime. In both cases, knowing the identity of an external component is not the same as constraining what that component can cause the system to do.

The operational risk is greatest during model intake

Many organizations focus AI security reviews on production applications. Model intake may receive less attention because downloading and testing a model appears to be a development activity.

That assumption can be dangerous. Development environments may have access to repositories, cloud credentials, internal data and training infrastructure, so a malicious artifact loaded in such an environment may compromise systems well beyond the eventual model-serving application.

The appropriate intake process therefore needs to treat externally sourced model artifacts as untrusted until the relevant checks are complete. The organization should establish the source of the model, select an exact revision and review the files included in the repository.

It should distinguish serialized weights from executable scripts and custom implementations. Where possible, safer serialization formats should be preferred, while suspicious files and incomplete scan results should be investigated before the model is loaded.

An isolated evaluation environment can limit the consequences of unexpected code execution. These measures do not guarantee that every malicious artifact will be detected, but they reduce the likelihood that an unverified model can compromise an environment with valuable credentials or unrestricted network access.

aiautomatein analysis: A clean model scan is a limited security statement

Hugging Face model security illustrates a broader weakness in enterprise AI assurance. Organizations often compress several distinct questions into a single approval status: Was the artifact downloaded from the expected publisher? Did its file pass the available malware scans? Can it be loaded without executing untrusted code? Has its behavior been evaluated for the intended business task?

Those questions require different forms of evidence. A repository may provide useful answers to the first two while leaving the buyer responsible for the others.

A model may pass all available scanners without proving that it is free from unknown malicious serialization techniques. A safetensors artifact may reduce loading risks without establishing that custom code is safe, and a signed model may be authentic without being appropriate for a consequential decision.

The security industry has made progress in detecting malicious model files and strengthening loading mechanisms. The remaining challenge is making the limits of those assurances explicit to enterprise buyers.

A proposed five-part model-intake evidence standard

Publisher identity establishes which organization or account supplied the artifact and what evidence supports that identity.

Artifact integrity establishes which exact revision and files were evaluated and whether they can be verified against the deployed copies.

Execution exposure identifies which files and loading procedures can execute code and under what permissions.

Behavioral evaluation records which tasks, misuse scenarios and adversarial conditions were tested.

Lifecycle accountability establishes how the organization will identify affected deployments if an upstream artifact or dependency is later found to be unsafe.

These five requirements are an aiautomatein editorial synthesis of the published research and technical guidance, not a formal industry certification. They separate the information a model repository can provide from the assurance an enterprise must establish for its own environment.

The principle also applies to the broader software dependencies used by AI applications. Legitimate package-distribution channels can become routes for malicious code, but model repositories create an additional complication because the loading behavior of an artifact may not be obvious from its apparent function as trained weights.

DITTO research infographic showing 9.3% pickle reliance among more than 10,000 popular Hugging Face repositories examined, alongside 959 benign and 92 malicious PickleBench models.
Figure 1. The October 2026 DITTO study reports pickle reliance in 9.3% of more than 10,000 popular Hugging Face repositories examined. Its separate PickleBench dataset contains 959 benign and 92 malicious models.

Research and security signals to watch through 2027

EvidencePublished findingImplication for buyers
JFrog, 2024Approximately 100 malicious model instances identified in its researchModel files can distribute executable payloads
ReversingLabs, 2025nullifAI used malformed pickle content to evade scanningParser failure must not be equated with safety
PickleBall, ACM CCS 2025336 samples evaluated; approximately 79.8% of benign models loaded successfullySecure loaders face compatibility trade-offs
ShadowPickle, 2026Evasion demonstrated against ten evaluated scannersDetection coverage varies by attack technique
DITTO, 20269.3% of more than 10,000 popular repositories studied relied on pickleUnsafe serialization remains relevant
Hugging Face, July 2026Infrastructure intrusion disclosedRepository-platform security is distinct from file scanning

These are separate datasets and incident types. Their figures cannot be combined into an overall Hugging Face compromise rate.

Three developments deserve attention during 2027. The first is whether safer model formats continue to displace pickle in active repositories and enterprise deployments. The second is whether independent scanner benchmarks become sufficiently standardized to support meaningful comparisons across different vendors and model formats. The third is whether enterprises begin treating model-intake evidence as a persistent lifecycle record rather than a one-time download check.

The commercial opportunity extends beyond malware detection. Organizations need systems capable of connecting publisher identity, artifact integrity, execution exposure and deployment history. That evidence becomes valuable when a model is updated, a dependency is compromised or a repository reports a security incident.

Frequently asked questions

Is Hugging Face safe for enterprise use?

Hugging Face provides security controls including malware scanning, access management and signed commits. Enterprise safety depends on the specific model, repository, files, loading process and deployment environment. A model’s presence on the Hub is not a security certification.

What is Hugging Face pickle scanning?

Pickle scanning examines serialized model files for suspicious imports and potentially dangerous behavior. It helps identify certain executable payloads but cannot guarantee detection of every malicious pickle technique.

Can a Hugging Face model contain malware?

Yes. Security researchers have documented malicious model artifacts distributed through Hugging Face repositories, including files that executed attacker-controlled code during unsafe loading.

Is safetensors safer than pickle?

Safetensors is designed to avoid the arbitrary-code-execution behavior associated with pickle deserialization of model weights. It reduces that category of loading risk but does not establish that the model or accompanying repository code is safe in every respect.

Does a clean malware scan prove a model is secure?

No. A clean result means that the scanner did not detect the threats covered by its inspection under the conditions used. Unknown techniques, incomplete inspection and behavioral model backdoors can remain outside its scope.

What is nullifAI?

nullifAI is a malicious-model technique disclosed by ReversingLabs in February 2025. It used deliberately malformed pickle files to evade scanning while permitting malicious instructions to execute during unsafe deserialization.

What does trust_remote_code do in Hugging Face Transformers?

The setting allows custom model code supplied through a repository to be loaded and executed. It should be used only when the code and its source have been appropriately reviewed and trusted.

Does signing a model prevent malicious behavior?

Signing helps establish artifact authenticity and integrity. It does not prove that the model’s code, training data or learned behavior is free from malicious characteristics.

Can a model be compromised without changing its weights?

Yes. Malicious scripts, dependencies, configuration files or tool integrations can compromise the environment surrounding a model while the model weights remain unchanged.

What should enterprises verify before downloading a third-party model?

They should establish the publisher’s identity, evaluate the repository’s files and license, identify the exact revision, review relevant security findings and define a controlled process for inspecting and loading the artifact.

What is the difference between model malware and model poisoning?

Model malware commonly involves executable payloads distributed with model artifacts. Model poisoning involves manipulating training data or model parameters to influence learned behavior. The mechanisms and appropriate defenses differ.

Conclusion

Public model repositories are essential infrastructure for modern machine-learning development. They make models easier to discover, evaluate and reuse. They also create a distribution channel through which externally supplied artifacts enter enterprise development environments.

Hugging Face and its security partners provide meaningful controls over that process. The research record demonstrates why those controls must be understood according to their actual scope.

Malicious pickle files can exploit unsafe loading. Scanner-evasion techniques can defeat particular detection methods. Safer serialization formats can reduce executable loading risks without proving that a model’s behavior is trustworthy. Signed commits and pinned revisions improve artifact identity but do not replace security evaluation.

For enterprises, the appropriate objective is not to find one scanner capable of declaring every model safe. It is to establish a defensible chain of evidence from the publisher to the exact artifact, the loading environment and the deployed model.

The question that matters after a model passes its scanner is not whether the repository has declared it clean. It is whether the enterprise understands precisely what was examined, what was not examined and what the model is still capable of doing.

Research references and technical documentation

Author

  • Sudipto Ghosh

    Sudipto Ghosh is the Publisher of aiautomatein, covering enterprise artificial intelligence, cloud infrastructure, intelligent automation and the technologies reshaping business operations. His analysis examines the intersection of emerging technology, enterprise strategy, governance and commercial adoption, with a focus on how organizations translate technical capabilities into measurable business outcomes.

Leave a Reply

Your email address will not be published. Required fields are marked *