Join our Newsletter — 33% off our NHI Course

Field Code

A field code is an internal Office instruction that controls how content is displayed or calculated in a document. In attack scenarios, a field code can be modified to invoke a command or payload, turning a normal document feature into a code execution path when the file is opened.

What a field code is

A field code is a document instruction, not just visible content. In office files, it tells the application how to display, calculate, or update a result, which means the same document can contain both rendered text and hidden logic.

How field codes work inside a document

Field codes are typically stored as structured instructions that the editor interprets when the document opens, refreshes, or updates fields. Common examples include page numbers, dates, cross-references, and calculated values. The key point is that the displayed output is generated from the instruction, so the visible text may not reveal the underlying field content.

That separation between instruction and display is useful for automation and formatting, but it also creates a trust boundary inside an otherwise ordinary document. If a user or system assumes the rendered text is the full story, the hidden field logic can be missed.

Why field codes matter for document security

Field codes become security-relevant when attackers modify them to change document behaviour. In a malicious file, a field can be repurposed to reference external content, trigger a command, or influence execution flow when the document is opened in a vulnerable or permissive environment.

This is why document features that seem purely presentational can still be part of an attack path. A field code is not a macro by default, but it can still be abused as a code execution path when the surrounding application, parser, or user workflow treats the document as safe.

Where field codes fit in office security and review

Field codes sit in the broader category of office-document active content. They matter most in environments that rely on email attachment filtering, user-driven document opening, and automatic content refresh. Reviewers should treat unexpected field logic as part of the document’s attack surface, especially when files arrive from outside the organisation or contain unusual references, embedded instructions, or prompts to update content.

Because field codes are often invisible to casual viewing, they are easy to overlook during manual inspection. Security teams should understand them as a document-native mechanism that can support legitimate formatting and also enable abuse when integrity checks are weak.

Risk and Threat Considerations

Field codes are risky because they can hide executable or action-triggering behaviour inside a file that appears harmless at first glance. The main threat is not the field itself, but the way a malformed or malicious field can be interpreted by the document application during open or update.

Failure mechanism: An attacker alters the field instruction so the office application resolves it into unexpected behaviour, such as external retrieval, command invocation, or another payload-bearing action.

Impact: The result can be code execution, content manipulation, data exposure, or another compromise triggered through a trusted document workflow.

Standards & Framework Alignment

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

MITRE ATT&CK addresses the attack and risk surface, while CIS Controls v8, NIST SP 800-53 Rev 5 and OWASP ASVS set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
MITRE ATT&CK T1204 — User Execution Field code abuse depends on a user opening the document and triggering its logic.
T1059 — Command and Scripting Interpreter Malicious field codes can be repurposed to invoke commands or payloads.
Recommendation — Monitor for documents that rely on user opening to activate hidden behavior. Detect document flows that reach command or scripting execution paths.
CIS Controls v8 CIS-9 — Email and Web Browser Protections Office documents with active content commonly arrive through email or browser download paths.
Recommendation — Filter and sandbox suspicious documents before users open them.
NIST SP 800-53 Rev 5 SI-10 — Information Input Validation Malicious field content is an untrusted input path inside document processing.
Recommendation — Validate document-derived input before the application interprets field logic.
OWASP ASVS V15 — Secure Coding and Architecture The term involves hidden logic in a content-processing workflow that must be designed safely.
Recommendation — Design document-processing paths to treat embedded instructions as untrusted input.

Practitioner Guidance

What to watch for: Treat documents with unusual field behaviour, suspicious update prompts, or unexpected embedded logic as higher risk, especially when they originate outside trusted channels. If a document’s rendered output does not match expectations, inspect the underlying field structure rather than trusting the visible text alone.

Practitioner takeaway: Field codes are normal document functionality, but in security review they should be handled as potentially active content whenever the source, structure, or behaviour does not fit the expected use case.