Skip to content
Software development
ASD ISMISM-2058

ASD ISM 2058 Ensure data validation before deserialisation

What it says

Data sources and serialised data inputs are validated before being deserialised.

Quoted as published. Everything else on this page is written by Control Stack.

In plain English

Both the source of serialised data and the data itself must be validated before it is deserialised, that is, turned back into objects the software uses.

Data sources and serialised data inputs must both be validated before the data is deserialised. Serialised data is data turned into bytes or text so it can be stored or sent, for example as structured text or a language's own object format; deserialising turns it back into objects in memory. Validating the source confirms the data came from where it should, such as by authenticating the sender or checking a digital signature. Validating the input checks its size, structure and types against what is expected.

Why it matters

Deserialising untrusted data can let a malicious actor create unexpected objects or even run code, especially with formats that can rebuild any object type. Checking the source and content first means tampered or unexpected data is rejected before the deserialiser handles it.

How to implement

  1. Find every place the software deserialises data.

    Search the code for deserialisation functions and libraries, covering API requests, cookies and tokens, message queues, caches, imported files and loaded AI model files. Record where each one's data comes from. Where a component you cannot change deserialises data, validate it before passing it in.

  2. Validate the source before accepting the data.

    Accept serialised data only from expected sources, and authenticate the sender wherever the interface is not public. Where it passes through anything you do not control, such as a browser cookie or shared storage, protect it with a digital signature or message authentication code (a keyed checksum) and verify that before deserialising.

  3. Validate the serialised input itself.

    Check its size first, then its structure and types against a strict schema or allowed types list, and reject anything else. Where a format can rebuild any object type or run code while loading, move to a data-only format (ISM-2072 requires this for stored AI models).

  4. Test that bad data is stopped before deserialising.

    Add negative tests (ISM-2057) that send oversized and unexpected-type data, and tampered or unsigned data where a signature or message authentication code is used, from expected and unexpected sources, and confirm each is rejected before any object is built from it.

Keep it running

Recheck when a new data feed, queue, cache, file import or library is added, and when a deserialisation flaw is published for a library or format in use. Keep the allowed object types as few as the software needs.

Evidence and audit

  1. Check 1 of 3What an auditor asks for

    Ask for

    The list of places where the software deserialises data, and a code search for deserialisation functions and libraries to compare with it.

    Look at

    Whether every deserialisation point the search finds is listed with its source and the checks that run before it.

    Good evidence

    Every deserialisation point found by the search is listed, and each has a source check and a content check that both run before the data is deserialised.

  2. Check 2 of 3What an auditor asks for

    Ask for

    A test of a sample of deserialisation points with oversized and unexpected-type data, and with tampered or unsigned data wherever the data passes through anything the organisation does not control, sent from both expected and unexpected sources.

    Look at

    Where each test input is stopped, using application logs or a debugger.

    Good evidence

    Every test input is rejected by validation before any object is built from it, and data from an unexpected source is refused even when it is well formed.

  3. Check 3 of 3What an auditor asks for

    Ask for

    The code paths leading to a sample of deserialisation points.

    Look at

    Whether any route, such as an error handler, older API version or background job, deserialises data without passing both checks.

    Good evidence

    No route deserialises data without first passing both the source check and the content check.

Mappings

Closest match in ISO/IEC 27001: A.8.28, Secure coding, which this control partially meets.

ISO 27001

ISO/IEC 27001: 1 mapping

  • A.8.28Secure codingPartially meets

Mappings show how controls relate across frameworks. They do not imply full equivalence or certification.