Join our Newsletter — 33% off our NHI Course
Home› FAQ› AI Security› How can security teams reduce the risk of…
AI Security

How can security teams reduce the risk of a model serialisation attack?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated October 18, 2026 Domain: AI Security

Reduce the risk by avoiding unsafe deserialisation of model artefacts and by loading only trusted formats from trusted sources. Validate files before import, isolate the loading process, and remove unnecessary execution privileges from the runtime. If a serialised model can trigger code during loading, treat it as an executable file, not inert data.

Why model serialisation attacks are different from ordinary file-upload risk

A model serialisation attack is dangerous because the loader may execute attacker-controlled instructions while reading what looks like a data file. That makes the trust decision happen before the model is fully in memory, so the main failure is not just malicious content, but a parser or runtime that treats untrusted artefacts as code-bearing objects.

The practical security problem is usually imported trust. If teams accept models, checkpoints, or weights from outside their controlled build and signing process, the loading step becomes an execution path. That is why trusted provenance, format discipline, and loader hardening matter more than file extension checks or simple malware scanning alone.

How to narrow the attack surface before a model is loaded

The safest pattern is to minimise the number of formats and loaders that can reach production. Prefer non-executable serialisation formats where possible, and restrict supported artefacts to those your team can verify end to end. If a format can embed object graphs, callbacks, or custom classes, treat it as high risk unless the use case genuinely requires that behaviour.

Loading should also happen in a constrained environment, not in the same runtime that serves traffic or holds broad credentials. Separate import, validation, and execution stages so the loader cannot reach sensitive files, network paths, or privileged APIs. That containment does not make unsafe serialisation safe, but it reduces the blast radius if a hostile artefact is encountered.

Provenance checks are most useful when they are paired with policy enforcement. A trusted source list, integrity verification, and explicit approval gates should be part of the ingestion path, not informal reviewer habit. AI Supply Chain Security and AI-BOM Guide is a useful reference for how model provenance, artefact integrity, and dependency tracking fit together in practice.

What defenders should assume about compromise and recovery

When a serialised model can execute code during loading, the right assumption is that the artefact may already be hostile even if it came from a familiar repository or teammate. That means the loading host, its credentials, and any files reachable from that process may already be part of the exposure. In other words, the question is not only whether the model runs, but what it can touch while being opened.

If there is any chance the loader was exposed to an untrusted artefact, review the environment as if a malicious program executed there. Check for unexpected child processes, outbound connections, dropped files, altered startup scripts, and changes to adjacent artefact stores. If the loading runtime had access to tokens, keys, or deployment credentials, rotate them quickly and invalidate any sessions that could have been reused.

Teams should also be prepared for the “benign model” assumption to fail in CI, testing, and notebook workflows. Those environments often have broader file access and weaker isolation than production, which makes them attractive initial footholds. The State of NHI & AI Agent Breach Report 2026 reinforces a broader lesson: once an attacker reaches a trusted execution path, credential and environment exposure tends to matter as much as the original payload.

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 addresses the attack and risk surface, while CIS Controls v8 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-02 — Secret LeakageLoaded artefacts can expose keys or tokens if the loader is compromised.
Recommendation — Rotate exposed secrets and limit loader access to sensitive credentials.
CIS Controls v8CIS-5 — Account ManagementCompromised loaders may expose or abuse accounts used by the runtime.
Recommendation — Restrict and review accounts available to model-loading services.
NIST SP 800-53 Rev 5SI-10 — Information Input ValidationModel artefacts are untrusted input and must be validated before processing.
SC-28 — Protection of Information at RestTrusted model artefacts and integrity controls rely on protecting stored files.
CM-7 — Least FunctionalityReducing runtime privileges limits what a malicious serialised model can reach.
Recommendation — Validate model artefacts before deserialising or executing them. Protect stored model artefacts and verify their integrity before use. Remove unnecessary execution privileges from the model-loading runtime.

Practitioner Guidance

What to verify: Confirm that every model import path enforces the same allowlist, integrity check, and isolation boundary. A secure training pipeline that is bypassed by a looser notebook or ad hoc deployment script leaves a gap attackers can target.

Decision rule: If the format can execute code, deserialize into objects, or invoke custom logic, do not treat the artefact as routine content. Require a safer format or move the load into a quarantined, low-privilege environment before approving it for wider use.

What good looks like: The loading process is boring, observable, and tightly scoped. It accepts only expected artefacts, runs with minimal permissions, and leaves a clear audit trail for source, validation, and execution decisions.

Practitioner takeaway: The key control is not just “scan the file,” but “make untrusted model loading unable to become trusted code execution.”

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 October 18, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org