Join our Newsletter — 33% off our NHI Course
Home› Glossary› Cyber Security› CWE-94
Cyber Security

CWE-94

← Back to Glossary
By NHI Mgmt Group Updated November 18, 2026 Domain: Cyber Security

Unsafe code evaluation, a weakness where untrusted input is treated as executable code or expressions. It appears in interpreters, template engines, deserialisation paths and scripting features, and can lead to arbitrary code execution if input validation, sandboxing or strict allow-lists are missing.

What CWE-94 Means in Practice

CWE-94 describes a class of software weakness where untrusted input reaches an execution context, so the application treats data as code or an evaluable expression. That is why it is especially dangerous in interpreters, template engines, scripting hooks, and deserialisation paths: the boundary between user data and program logic has effectively been removed.

The key idea is not simply “bad input,” but a broken trust boundary. Once input can influence syntax, operators, method calls, or expression trees, the weakness can become a code injection path rather than a normal validation failure.

Where Unsafe Code Evaluation Appears

Writers and developers usually encounter CWE-94 through features that intentionally process structured text, then accidentally over-trust the content they receive. Common examples include expression languages, server-side templates, embedded scripting, rule engines, and custom parsers that convert input directly into executable behaviour.

This weakness often sits close to convenience features, such as “dynamic” configuration or user-defined formulas. The same flexibility that makes a system extensible can also make it dangerous if the application does not strictly separate data from executable instructions.

For a broader view of how CWEs are grouped and used in secure coding practice, the CWE Top 25 Guide is a useful reference point, and CVE, CWE and CPE Guide helps explain how weaknesses like CWE-94 relate to vulnerabilities and affected products.

Why CWE-94 Is Dangerous

Unsafe code evaluation can escalate from a single malformed parameter to arbitrary code execution, depending on the privileges of the process and the scope of the interpreter. The impact can include data theft, application takeover, environment pivoting, and abuse of any credentials or secrets reachable from the runtime.

The risk is amplified when the vulnerable path runs with service privileges, has filesystem or network access, or can call privileged libraries and APIs. In those cases, the weakness is not just a validation issue, it becomes a direct route to control the application runtime.

From a control perspective, treating input as executable content is the failure mode. Strong allow-lists, strict parsing, sandboxing, and removal of unnecessary evaluation features are the usual ways to reduce that exposure.

How Organisations Reduce Exposure

Exposure review starts with finding every place where user-controlled values can reach an interpreter, expression engine, template renderer, or deserialisation step. Teams should map those paths in code review and testing, then verify whether the affected component is actually interpreting syntax rather than handling plain data.

Once identified, the safer pattern is to replace evaluation with structured parsing, constrained rule sets, or fixed operations wherever possible. If dynamic behaviour is unavoidable, organisations should isolate the execution environment, limit the available built-ins and functions, and keep the runtime on the shortest possible privilege leash.

For development teams, secure coding guidance and weakness prioritisation are easier to operationalise when tied to a defined weakness catalogue rather than ad hoc judgment. The linked CWE Top 25 Guide is useful here because CWE-94 is most dangerous when it appears in repeatable, pattern-based code paths rather than one-off mistakes.

Risk and Threat Considerations

CWE-94 is a high-value target for attackers because it can convert a single input field, header, template variable, or configuration value into code execution. Where the application runs with meaningful privileges, the weakness can become a launch point for data access, lateral movement, or persistence inside the host environment.

Failure mechanism: The application reaches an interpreter or evaluation engine and passes attacker-controlled content into it without adequate sanitisation, allow-listing, or sandboxing, so the injected content is executed as code or as a privileged expression.

Impact: The result can be remote code execution, data exfiltration, service disruption, or compromise of adjacent assets that the application can reach, including files, tokens, session material, and backend systems.

Standards & Framework Alignment

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

OWASP ASVS, NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP ASVSV2 — Validation and Business LogicCWE-94 is an input handling and execution-boundary weakness.
V15 — Secure Coding and ArchitectureCWE-94 is prevented by designing away data-to-code confusion in software architecture.
Recommendation — Validate inputs with strict allow-lists before any expression or template evaluation. Design out dynamic evaluation where data can be handled as plain input.
NIST SP 800-53 Rev 5SA-11 — Developer Testing and EvaluationThis weakness is best reduced through secure code review and targeted testing.
SC-39 — Process IsolationSandboxing and isolation materially reduce the blast radius of unsafe evaluation.
Recommendation — Test code paths that evaluate user-controlled content for unsafe execution behavior. Isolate execution contexts so untrusted input cannot gain broad process access.
CIS Controls v8CIS-16 — Application Software SecurityThis weakness is an application security issue that belongs in secure development controls.
Recommendation — Build secure coding checks that prevent unsafe evaluation in application logic.

Practitioner Guidance

Why practitioners should care: CWE-94 is one of the weaknesses that can turn a “business logic” feature into a full compromise path, so it deserves the same scrutiny as direct injection flaws. Security review should focus on whether a feature genuinely needs execution semantics, not just whether it accepts flexible input.

Common misunderstanding: Teams sometimes assume that quoting, basic escaping, or superficial validation is enough. For this weakness, the safer answer is usually architectural: remove the evaluator, constrain the grammar, or isolate the execution context so untrusted input cannot become instructions.

Practitioner takeaway: If a feature can evaluate user-controlled content, treat the evaluation boundary as a security control boundary and design it like one.

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