Join our Newsletter — 33% off our NHI Course
Home› Glossary› AI Security› Malicious Model
AI Security

Malicious Model

← Back to Glossary
By NHI Mgmt Group Updated November 2, 2026 Domain: AI Security

An AI model that has been altered or packaged to harm users, systems, or data. The danger may come from embedded code, hidden instructions, poisoned weights, or deceptive packaging that causes credential theft, data leakage, or unauthorized system behavior after download or execution.

What Makes a Malicious Model Dangerous

A malicious model is dangerous because it looks like a normal AI artifact while carrying hidden behaviour that activates after download, import, or execution. The harm can be immediate, such as credential theft or data leakage, or delayed, such as unauthorized actions triggered by embedded code, poisoned weights, or deceptive packaging.

The key security issue is trust in the model supply chain. A model file is not just data; in many toolchains it can also be executable content, dependency metadata, or a wrapper that changes how the runtime behaves. That makes provenance, signing, and controlled intake part of the threat model rather than optional hardening.

How Malicious Models Work in Practice

Malicious models can be altered in several ways. Some abuse serialization formats that execute code when loaded. Others use hidden instructions, backdoors, or manipulated weights so the model behaves normally during casual testing but acts differently when prompted in a certain way. A deceptive package may also bundle scripts, hooks, or unsafe configuration that expands the compromise path beyond the weights themselves.

This is why model format matters. “Safe” handling options reduce exposure, but they do not eliminate risk if the surrounding pipeline trusts unverified artifacts, auto-loads custom code, or grants the model excessive runtime privileges. The danger is not only what the model predicts, but what the loader, runtime, and surrounding automation allow it to do.

Exposure Points and Supply Chain Checks

Organisations should think about exposure at acquisition time, not after deployment. The first questions are whether the model came from a trusted source, whether the artifact was reviewed before import, whether the package was scanned for unsafe deserialisation or bundled code, and whether the organisation can prove which version was approved.

That is why model registries, artifact review, and source verification matter. A malicious model often enters through the same pathways as a legitimate one, so inventory and provenance are the control points that determine whether the environment can distinguish an approved artifact from a hostile one. For a practical defence model, see the Model Supply Chain Guide, which covers safe intake, format risks, signing, and scanning.

Where organisations operate hub-based workflows, repository trust is also part of the problem. A model hosting platform can become the delivery vector for poisoned weights, malicious wrappers, or compromised publisher accounts, so access control and publisher verification are part of model assurance, not just platform hygiene. NHIMG’s Hugging Face Security Guide addresses the platform-side controls that reduce that exposure.

Detection, Containment, and Recovery After Exposure

Detection is difficult because malicious models may behave correctly during validation and only trigger under specific prompts, inputs, or runtime conditions. Security teams therefore need to review not only the artifact but also the environment it touched, including logs, outbound connections, secret access, unusual file writes, and unexpected tool or shell execution.

After a suspicious model has been imported or run, the response should include containment of the host or environment, withdrawal of any credentials exposed to the model runtime, and review of downstream artifacts that may have been modified. The model itself may be only the first compromise step; sessions, tokens, API keys, and data accessed during execution can become the lasting security issue.

For attackers, the attraction is clear: a model artifact can reach places ordinary code review does not always inspect, and it may be trusted by humans and automation alike. That makes malicious models a supply-chain and execution-risk problem at the same time.

Risk and Threat Considerations

Malicious models can create both direct compromise risk and broad trust risk. A poisoned or deceptive model may appear benign until it is loaded into a production workflow, at which point it can exfiltrate secrets, alter outputs, or trigger unauthorized behaviour in the surrounding system.

Failure mechanism: The model package exploits trust in the artifact, loader, or repository by embedding executable behaviour, hidden instructions, or modified weights that change runtime behaviour after ingestion.

Impact: The result can be credential theft, data leakage, unauthorized actions, persistence in the AI pipeline, or downstream compromise of systems that consume the model’s output.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10, OWASP Agentic AI Top 10 and MITRE ATT&CK define the specific risk controls and attack patterns relevant to this term.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-03 — Vulnerable Third-Party NHIMalicious models often arrive through third-party artifacts and packaged trust relationships.
NHI-02 — Secret LeakageMalicious models can steal credentials, tokens, and keys from their runtime.
Recommendation — Verify third-party model provenance and block untrusted artifacts before import. Restrict model access to secrets and monitor for leakage from model execution paths.
OWASP Agentic AI Top 10ASI04 — Agentic Supply Chain VulnerabilitiesPackaged model artifacts can introduce supply-chain compromise into AI systems.
ASI05 — Unexpected Code ExecutionUnsafe model loading can execute embedded code or hooks during ingestion.
Recommendation — Validate AI artifacts and publishing paths before allowing them into production use. Use safe loading modes and deny executable model content where possible.
MITRE ATT&CKT1027 — Obfuscated Files or InformationDeceptive packaging and hidden instructions obscure malicious behaviour in artifacts.
T1059 — Command and Scripting InterpreterMalicious models may trigger scripts or shell behaviour after execution.
Recommendation — Inspect model artifacts for hiding, packing, and other obfuscation techniques. Hunt for interpreter and script execution that follows model ingestion.

Practitioner Guidance

Why practitioners should care: A malicious model is not just a bad prediction source; it is a potentially executable supply-chain object. Treat model intake, provenance checks, and runtime permissions as part of the same control boundary.

Common misunderstanding: Teams often assume a model is safe if it passes a quick functional test. That misses hidden code paths, poisoned behaviour, and packaging tricks that only appear after deployment or under specific prompts.

Practitioner takeaway: Review the artifact source, the loading path, and the privileges granted to the model runtime as one combined trust decision, not three separate ones.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 2, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org