CWE-1265: Unintended Reentrant Invocation of Non-reentrant Code Via Nested Calls

BaseDraft

The product invokes code that is believed to be reentrant, but the code performs a call that unintentionally produces a nested invocation of the non-reentrant code.

View on MITRE
Back to CWE Lookup

Extended Description

In a complex product, a single function call may lead to many different possible code paths, some of which may involve deeply nested calls. It may be difficult to foresee all possible code paths that could emanate from a given function call, even if that call is assumed to be reentrant. In some systems, an external actor can manipulate inputs to the system and thereby achieve a wide range of possible control flows. This is frequently a concern in products that execute scripts from untrusted sources. Examples of such products are web browsers and PDF readers. A weakness is present when one of the possible code paths resulting from a function call alters program state that the original caller assumes to be unchanged during the call.

Technical Details

Structure
Simple
Vulnerability Mapping
ALLOWED

Applicable To

Languages
Not Language-Specific
Platforms

Source-backed guidance

Additional facts reviewed against primary or authoritative security sources.

Verify controls for CWE-1265 with SSDF evidence

Use NIST SSDF verification and vulnerability-response practices to detect CWE-1265, Unintended Reentrant Invocation of Non-reentrant Code Via Nested Calls, throughout the product lifecycle. Derive review questions, static or dynamic checks, and negative tests from the CWE's causal behavior; define the components and lifecycle stages each check covers; and retain findings with enough evidence to distinguish the root cause from symptoms and impacts. Track escapes and false negatives, then improve the verification plan after every confirmed occurrence.

NIST SP 800-218 Secure Software Development FrameworkNational Institute of Standards and Technology

Address Unintended Reentrant Invocation of Non-reentrant Code Via Nested Calls during Architecture and Design

MITRE associates mitigation with Architecture and Design, and Implementation; recorded impacts include Unexpected State; the entry maps to CAPEC-74. Use these source-defined anchors to turn CWE-1265 into implementation, review, and verification checks for the affected component.

CWE-1265: Unintended Reentrant Invocation of Non-reentrant Code Via Nested CallsMITRE CWE

Triage CWE-1265 against known exploitation evidence

Use CISA's Known Exploited Vulnerabilities catalog to test whether a vulnerability mapped to CWE-1265, Unintended Reentrant Invocation of Non-reentrant Code Via Nested Calls, has evidence of exploitation in the wild. Confirm the CVE-to-CWE root-cause mapping independently before attaching the example, then capture the affected product, required action, and remediation deadline. A missing KEV match is not evidence that the weakness is unexploited, and a KEV entry must not be generalized to every occurrence of this CWE.

Known Exploited Vulnerabilities CatalogCybersecurity and Infrastructure Security Agency

Apply precise root-cause mapping to CWE-1265

Apply MITRE's full root-cause mapping guidance when using CWE-1265, Unintended Reentrant Invocation of Non-reentrant Code Via Nested Calls. Separate weakness language from attacker prerequisites and technical impact, check the entry's abstraction and vulnerability-mapping notes, and prefer the most specific Base or Variant supported by the evidence. Record the rejected alternatives and require an independent review before the mapping is used for remediation trends or program metrics.

CVE to CWE Root Cause Mapping GuidanceMITRE CWE

Validate CWE-1265 with root-cause mapping checks

Apply MITRE's root-cause mapping quick tips to CWE-1265, Unintended Reentrant Invocation of Non-reentrant Code Via Nested Calls. Confirm the finding describes the causal weakness rather than an impact or attack pattern, compare the abstraction and mapping notes with plausible alternatives, and have a second reviewer challenge the selection. Preserve the evidence and reasoning so recurring defects can be measured against one consistent identifier.

CVE to CWE Root Cause Mapping Quick TipsMITRE CWE

Frequently Asked Questions

What is CWE-1265: Unintended Reentrant Invocation of Non-reentrant Code Via Nested Calls?+

CWE-1265: Unintended Reentrant Invocation of Non-reentrant Code Via Nested Calls is a Common Weakness Enumeration (CWE) entry maintained by MITRE. The product invokes code that is believed to be reentrant, but the code performs a call that unintentionally produces a nested invocation of the non-reentrant code. In a complex product, a single function call may lead to many different possible code paths, some of which may involve deeply nested calls. It may be difficult to foresee all possible code paths that could emanate from a given function call, even if that call is assumed to be reentrant. In some systems, an external actor can manipulate inputs to the system and thereby achieve a wide range of possible control flows. This is frequently a concern in products that execute scripts from untrusted sources. Examples of such products are web browsers and PDF readers. A weakness is present when one of the possible code paths resulting from a function call alters program state that the original caller assumes to be unchanged during the call.

What are the security consequences of Unintended Reentrant Invocation of Non-reentrant Code Via Nested Calls?+

If exploited, CWE-1265 (Unintended Reentrant Invocation of Non-reentrant Code Via Nested Calls) it can compromise Integrity, leading to outcomes such as Unexpected State.

How do you prevent or mitigate Unintended Reentrant Invocation of Non-reentrant Code Via Nested Calls?+

Recommended mitigations for CWE-1265 include: When architecting a system that will execute untrusted code in response to events, consider executing the untrusted event handlers asynchronously (asynchronous message passing) as opposed to executing them synchronously at the time each event fires. The untrusted code should execute at the start of the next iteration of the thread's message loop. In this way, calls into non-reentrant code are strictly serialized, so that each operation completes fully before the next operation begins. Special attention must be paid to all places where type coercion may result in script execution. Performing all needed coercions at the very beginning of an operation can help reduce the chance of operations executing at unexpected junctures. Make sure the code (e.g., function or class) in question is reentrant by not leveraging non-local data, not modifying its own code, and not calling other non-reentrant code.

Which programming languages are affected by Unintended Reentrant Invocation of Non-reentrant Code Via Nested Calls?+

CWE-1265 commonly affects Not Language-Specific. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What are real-world examples of Unintended Reentrant Invocation of Non-reentrant Code Via Nested Calls?+

MITRE documents real CVEs mapped to CWE-1265, including CVE-2014-1772 and CVE-2018-8174. You can look up the full details of each CVE, including CVSS scores and remediation guidance, on our CVE Lookup tool.

What is the difference between a CWE and a CVE?+

A CWE (Common Weakness Enumeration) like CWE-1265 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.

Learn More

Advertisement