ASD ISM 1241 Ensuring secure web application output encoding
What it says
Output encoding is performed on all output produced by web applications.
Quoted as published. Everything else on this page is written by Control Stack.
In plain English
Encode every piece of output a web application produces for the context it lands in, including data from databases, files and other systems, not only user input.
Web applications must perform output encoding on everything they output. Output encoding converts characters with special meaning where the data lands, such as the angle bracket that opens an HTML tag, into a form the browser shows as text, not code. Everything includes data from databases, files and other systems, not just user input, and each context (HTML, attributes, JavaScript, URLs) needs its own encoding. Input validation and sanitisation (ISM-1240) do not replace it. There is no exception for bought applications, though ASD places this under web application development.
Free. Save your status, tasks and notes.
Why it matters
Unencoded output lets script hidden in data, whether typed by a user or pulled from another system, run in a visitor's browser as part of the page (cross-site scripting) and act as that visitor. Encoding makes the browser treat such data as text.
How to implement
Use a framework or template engine that encodes output by default.
Turn automatic context-aware encoding on for every template, and list each place code switches it off, such as raw or 'safe' output helpers, so each can be reviewed. ISM-1239 already requires robust web application frameworks.
Encode for the exact context where data lands.
Use the framework's or a maintained library's encoder for HTML text, HTML attributes, JavaScript, URLs and CSS, and avoid building markup by joining strings. For data returned to other software, use a serialiser such as a JSON library and declare the correct content type.
Find and fix output that skips encoding.
Search code for raw output helpers, HTML built from strings and browser-side script that writes markup directly, such as setting innerHTML, and add static analysis rules for these to the testing ISM-0402 requires.
Test with harmless payloads from every data source.
Put markup and script test strings into form fields, URL parameters, uploaded files, database records and feeds from connected systems, then confirm every place they appear shows them as text. Run these tests on bought products and on each delivery from a supplier, and have the vendor fix any failure.
Keep it running
Keep the static analysis rules and payload tests in the build pipeline so new code is checked automatically. Look again when a new data source feeds the application, its framework or template engine changes, or a page starts showing user-supplied rich text.
Evidence and audit
- Check 1 of 2What an auditor asks for
Ask for
A payload test on web applications sampled from DNS records or a scan, with harmless markup and script placed in user input, database records and data from connected systems.
Look at
How the payload appears in every page, attribute, script block and response where it is output.
Good evidence
Wherever the payload appears, it is shown as text or encoded for its context and never runs, including where it came from a database or another system rather than a form.
- Check 2 of 2What an auditor asks for
Ask for
Static analysis results and a code search of sampled applications for raw output helpers, HTML built from strings and direct writes of markup in browser-side script.
Look at
Each place output bypasses the template engine's automatic encoding, and whether the data is encoded another way first.
Good evidence
Every output path encodes its data for the context, and no raw output helper or direct markup write carries unencoded data.
Mappings
Closest match in ISO/IEC 27001: A.8.25, Secure development life cycle, which this control partially meets.
ISO/IEC 27001: 2 mappings
This control partially meets A.8.25.
ISM-1241 addresses a specific secure development requirement: encoding all web application output to prevent unsafe interpretation in browsers. Annex A 8.25 requires rules for secure development of software and systems to be established and applied, which would normally include standards for output encoding/escaping for web applications. ISM-1241 is one concrete rule within a secure development lifecycle, while Annex A 8.25 is broader and covers the full set of secure development rules and practices.
This control partially meets A.8.28.
ISM-1241 requires that output encoding is performed on all output produced by web applications to prevent injection-style client-side attacks (e.g. XSS). Annex A 8.28 requires secure coding practices to be applied across software development, which commonly includes output encoding/escaping in web applications. ISM-1241 is a specific secure coding requirement focused on web output handling, while Annex A 8.28 is broader and covers many additional coding practices beyond output encoding.
Mappings show how controls relate across frameworks. They do not imply full equivalence or certification.




