CWE-674
Weakness Allowed-with-ReviewUncontrolled Recursion
Abstraction: Class · Status: Draft
The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack.
Mapping guidance
This CWE entry is a Class and might have Base-level children that would be more appropriate
Examine children of this entry to see if there is a better fit
Modes of introduction
The uncontrolled recursion is often due to an improper or missing conditional
Detection methods
Automated Static Analysis
Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
Effectiveness: High
Content history
updated Potential_Mitigations, Time_of_Introduction
updated Common_Consequences, Relationships, Taxonomy_Mappings
updated Related_Attack_Patterns
updated Relationships
updated Common_Consequences
updated Relationships
updated Potential_Mitigations
updated Relationships
updated Related_Attack_Patterns
updated Relationships, Taxonomy_Mappings
updated Applicable_Platforms, Relationships
updated References, Related_Attack_Patterns, Relationships, Taxonomy_Mappings
updated Related_Attack_Patterns, Relationships, Type
updated Related_Attack_Patterns, Relationships
updated Demonstrative_Examples, Description, Modes_of_Introduction, Observed_Examples, Potential_Mitigations, Time_of_Introduction
updated Potential_Mitigations
updated Demonstrative_Examples
updated Description, Relationships
updated Detection_Factors, Relationships
updated Mapping_Notes
updated Demonstrative_Examples
updated Weakness_Ordinalities
updated Potential_Mitigations
updated Common_Consequences
1108 vulnerabilities reference this CWE, most recent first.
GHSA-X88W-XX7M-3M5F
Vulnerability from github – Published: 2026-09-02 00:31 – Updated: 2026-09-02 21:32Net::DNS versions before 1.57 for Perl allow memory exhaustion via unbounded recursion in sig_data when re-encoding a message with a misplaced TSIG record.
sig_data signs a message by re-encoding it, and removes TSIG records only from the additional section. A TSIG decoded into the answer or authority section survives that step and is signed again, so encoding re-enters sig_data with no termination condition. Decoding does not reject such a message: a TSIG that is not the last record on the wire raises "misplaced or corrupt TSIG", but the error is caught, reported as a warning, and the record is left in the packet. RFC 8945 section 5.2 requires the message to be dropped.
The recursion is reached only when the decoded TSIG carries an empty MAC, since a MAC recovered from the wire short-circuits the signing step. It is reached only from code that re-encodes a message it decoded, such as a forwarder or a proxy. A decoded message that is never re-encoded is unaffected. Message direction does not matter: a query reaches the same path as a response.
Each cycle re-encodes the whole message, so fewer than 100 bytes on the wire exhaust available memory and terminate the process.
{
"affected": [],
"aliases": [
"CVE-2026-81928"
],
"database_specific": {
"cwe_ids": [
"CWE-674"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-09-02T00:18:26Z",
"severity": "HIGH"
},
"details": "Net::DNS versions before 1.57 for Perl allow memory exhaustion via unbounded recursion in sig_data when re-encoding a message with a misplaced TSIG record.\n\nsig_data signs a message by re-encoding it, and removes TSIG records only from the additional section. A TSIG decoded into the answer or authority section survives that step and is signed again, so encoding re-enters sig_data with no termination condition. Decoding does not reject such a message: a TSIG that is not the last record on the wire raises \"misplaced or corrupt TSIG\", but the error is caught, reported as a warning, and the record is left in the packet. RFC 8945 section 5.2 requires the message to be dropped.\n\nThe recursion is reached only when the decoded TSIG carries an empty MAC, since a MAC recovered from the wire short-circuits the signing step. It is reached only from code that re-encodes a message it decoded, such as a forwarder or a proxy. A decoded message that is never re-encoded is unaffected. Message direction does not matter: a query reaches the same path as a response.\n\nEach cycle re-encodes the whole message, so fewer than 100 bytes on the wire exhaust available memory and terminate the process.",
"id": "GHSA-x88w-xx7m-3m5f",
"modified": "2026-09-02T21:32:02Z",
"published": "2026-09-02T00:31:31Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-81928"
},
{
"type": "WEB",
"url": "https://datatracker.ietf.org/doc/html/rfc8945#section-5.2"
},
{
"type": "WEB",
"url": "https://metacpan.org/release/NLNETLABS/Net-DNS-1.56/source/lib/Net/DNS/RR/TSIG.pm#L245-262"
},
{
"type": "WEB",
"url": "https://metacpan.org/release/NLNETLABS/Net-DNS-1.56/source/lib/Net/DNS/RR/TSIG.pm#L62-73"
},
{
"type": "WEB",
"url": "https://metacpan.org/release/NLNETLABS/Net-DNS-1.57/changes"
},
{
"type": "WEB",
"url": "https://rt.cpan.org/Ticket/Display.html?id=181125"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2026/09/02/1"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-X8HV-RF6J-VCR5
Vulnerability from github – Published: 2022-05-24 16:55 – Updated: 2023-02-28 15:30Oniguruma before 6.9.3 allows Stack Exhaustion in regcomp.c because of recursion in regparse.c.
{
"affected": [],
"aliases": [
"CVE-2019-16163"
],
"database_specific": {
"cwe_ids": [
"CWE-674"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2019-09-09T17:15:00Z",
"severity": "MODERATE"
},
"details": "Oniguruma before 6.9.3 allows Stack Exhaustion in regcomp.c because of recursion in regparse.c.",
"id": "GHSA-x8hv-rf6j-vcr5",
"modified": "2023-02-28T15:30:24Z",
"published": "2022-05-24T16:55:43Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2019-16163"
},
{
"type": "WEB",
"url": "https://github.com/kkos/oniguruma/issues/147"
},
{
"type": "WEB",
"url": "https://github.com/kkos/oniguruma/commit/4097828d7cc87589864fecf452f2cd46c5f37180"
},
{
"type": "WEB",
"url": "https://github.com/kkos/oniguruma/compare/v6.9.2...v6.9.3"
},
{
"type": "WEB",
"url": "https://lists.debian.org/debian-lts-announce/2019/09/msg00010.html"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NWOWZZNFSAWM3BUTQNAE3PD44A6JU4KE"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZW47MSFZ6WYOAOFXHBDGU4LYACFRKC2Y"
},
{
"type": "WEB",
"url": "https://usn.ubuntu.com/4460-1"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-X9C7-5H6G-HQ8Q
Vulnerability from github – Published: 2026-06-01 21:30 – Updated: 2026-07-09 13:38Under infinite recursion in the routing layer, request-handling can cause OOM error.
Affected Spring Products and Versions: Spring Cloud Function 3.2.x: versions prior to 3.2.16 Spring Cloud Function 4.1.x: versions prior to 4.1.10 Spring Cloud Function 4.2.x: versions prior to 4.2.6 Spring Cloud Function 4.3.x: versions prior to 4.3.3 Spring Cloud Function 5.0.x: versions prior to 5.0.2 Older, unsupported versions are also affected.
{
"affected": [
{
"package": {
"ecosystem": "Maven",
"name": "org.springframework.cloud:spring-cloud-function-context"
},
"ranges": [
{
"events": [
{
"introduced": "4.3.0"
},
{
"fixed": "4.3.3"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "org.springframework.cloud:spring-cloud-function-context"
},
"ranges": [
{
"events": [
{
"introduced": "5.0.0"
},
{
"fixed": "5.0.2"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "org.springframework.cloud:spring-cloud-function-context"
},
"ranges": [
{
"events": [
{
"introduced": "3.2.10"
},
{
"last_affected": "3.2.15"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "org.springframework.cloud:spring-cloud-function-context"
},
"ranges": [
{
"events": [
{
"introduced": "4.1.0"
},
{
"last_affected": "4.1.9"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "org.springframework.cloud:spring-cloud-function-context"
},
"ranges": [
{
"events": [
{
"introduced": "4.2.0"
},
{
"last_affected": "4.2.5"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-40989"
],
"database_specific": {
"cwe_ids": [
"CWE-674"
],
"github_reviewed": true,
"github_reviewed_at": "2026-07-09T13:38:38Z",
"nvd_published_at": "2026-06-01T19:16:39Z",
"severity": "MODERATE"
},
"details": "Under infinite recursion in the routing layer, request-handling can cause OOM error.\n\nAffected Spring Products and Versions:\nSpring Cloud Function 3.2.x: versions prior to 3.2.16\nSpring Cloud Function 4.1.x: versions prior to 4.1.10\nSpring Cloud Function 4.2.x: versions prior to 4.2.6\nSpring Cloud Function 4.3.x: versions prior to 4.3.3\nSpring Cloud Function 5.0.x: versions prior to 5.0.2\nOlder, unsupported versions are also affected.",
"id": "GHSA-x9c7-5h6g-hq8q",
"modified": "2026-07-09T13:38:38Z",
"published": "2026-06-01T21:30:42Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-40989"
},
{
"type": "WEB",
"url": "https://github.com/spring-cloud/spring-cloud-function/commit/6bcd55803c5a2ce0adec794fee1e03c2fac36cf9"
},
{
"type": "PACKAGE",
"url": "https://github.com/spring-cloud/spring-cloud-function"
},
{
"type": "WEB",
"url": "https://spring.io/security/cve-2026-40989"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:P/AC:L/PR:L/UI:R/S:C/C:N/I:L/A:H",
"type": "CVSS_V3"
}
],
"summary": "Spring Cloud Function Context has Uncontrolled Recursion"
}
GHSA-X9PV-H28P-55W8
Vulnerability from github – Published: 2022-05-19 00:00 – Updated: 2022-05-27 00:01compile in regexp.c in Artifex MuJS through 1.2.0 results in stack consumption because of unlimited recursion, a different issue than CVE-2019-11413.
{
"affected": [],
"aliases": [
"CVE-2022-30974"
],
"database_specific": {
"cwe_ids": [
"CWE-674"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2022-05-18T11:15:00Z",
"severity": "MODERATE"
},
"details": "compile in regexp.c in Artifex MuJS through 1.2.0 results in stack consumption because of unlimited recursion, a different issue than CVE-2019-11413.",
"id": "GHSA-x9pv-h28p-55w8",
"modified": "2022-05-27T00:01:29Z",
"published": "2022-05-19T00:00:41Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-30974"
},
{
"type": "WEB",
"url": "https://github.com/ccxvii/mujs/issues/162"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MC6PLHTXHZ7GW7QQGTLBHLXL47UHTHXO"
},
{
"type": "WEB",
"url": "https://www.debian.org/security/2022/dsa-5291"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-XCRQ-6RJW-5CHW
Vulnerability from github – Published: 2022-03-27 00:00 – Updated: 2026-10-14 18:31libiberty/rust-demangle.c in GNU GCC 11.2 allows stack consumption in demangle_const, as demonstrated by nm-new.
{
"affected": [],
"aliases": [
"CVE-2022-27943"
],
"database_specific": {
"cwe_ids": [
"CWE-400",
"CWE-674"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2022-03-26T13:15:00Z",
"severity": "MODERATE"
},
"details": "libiberty/rust-demangle.c in GNU GCC 11.2 allows stack consumption in demangle_const, as demonstrated by nm-new.",
"id": "GHSA-xcrq-6rjw-5chw",
"modified": "2026-10-14T18:31:26Z",
"published": "2022-03-27T00:00:37Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-27943"
},
{
"type": "WEB",
"url": "https://cert-portal.siemens.com/productcert/html/ssa-398330.html"
},
{
"type": "WEB",
"url": "https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105039"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/H424YXGW7OKXS2NCAP35OP6Y4P4AW6VG"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/H424YXGW7OKXS2NCAP35OP6Y4P4AW6VG"
},
{
"type": "WEB",
"url": "https://sourceware.org/bugzilla/show_bug.cgi?id=28995"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-XCX6-VP38-8HR5
Vulnerability from github – Published: 2026-03-24 22:15 – Updated: 2026-07-06 13:09Summary
The object.to_json builtin function in Scriban performs recursive JSON serialization via an internal WriteValue() static local function that has no depth limit, no circular reference detection, and no stack overflow guard. A Scriban template containing a self-referencing object passed to object.to_json triggers unbounded recursion, causing a StackOverflowException that terminates the hosting .NET process. This is a fatal, unrecoverable crash — StackOverflowException cannot be caught by user code in .NET.
Details
The vulnerable code is the WriteValue() static local function at src/Scriban/Functions/ObjectFunctions.cs:494:
static void WriteValue(TemplateContext context, Utf8JsonWriter writer, object value)
{
var type = value?.GetType() ?? typeof(object);
if (value is null || value is string || value is bool ||
type.IsPrimitiveOrDecimal() || value is IFormattable)
{
JsonSerializer.Serialize(writer, value, type);
}
else if (value is IList || type.IsArray) {
writer.WriteStartArray();
foreach (var x in context.ToList(context.CurrentSpan, value))
{
WriteValue(context, writer, x); // recursive, no depth check
}
writer.WriteEndArray();
}
else {
writer.WriteStartObject();
var accessor = context.GetMemberAccessor(value);
foreach (var member in accessor.GetMembers(context, context.CurrentSpan, value))
{
if (accessor.TryGetValue(context, context.CurrentSpan, value, member, out var memberValue))
{
writer.WritePropertyName(member);
WriteValue(context, writer, memberValue); // recursive, no depth check
}
}
writer.WriteEndObject();
}
}
This function has none of the safety mechanisms present in other recursive paths:
ObjectToString()atTemplateContext.Helpers.cs:98checksObjectRecursionLimit(default 20)EnterRecursive()atTemplateContext.cs:957callsRuntimeHelpers.EnsureSufficientExecutionStack()CheckAbort()atTemplateContext.cs:464also callsEnsureSufficientExecutionStack()
The WriteValue() function bypasses all of these because it is a static local function that only takes the TemplateContext for member access — it never calls EnterRecursive(), never checks ObjectRecursionLimit, and never calls EnsureSufficientExecutionStack().
Execution flow:
- Template creates a ScriptObject:
{{ x = {} }} - Sets a self-reference:
x.self = x— stores a reference inScriptObject.Storedictionary - Pipes to
object.to_json:x | object.to_json→ callsToJson()at line 477 ToJson()callsWriteValue(context, writer, value)at line 488WriteValueenters theelsebranch (line 515), gets members via accessor, finds "self"TryGetValuereturnsxitself,WriteValuerecurses with the same object — infinite loopStackOverflowExceptionis thrown — fatal, cannot be caught, process terminates
PoC
{{ x = {}; x.self = x; x | object.to_json }}
In a hosting application:
using Scriban;
// This will crash the entire process with StackOverflowException
var template = Template.Parse("{{ x = {}; x.self = x; x | object.to_json }}");
var result = template.Render(); // FATAL: process terminates here
Even without circular references, deeply nested objects can exhaust the stack since no depth limit is enforced:
{{ a = {}
b = {inner: a}
c = {inner: b}
d = {inner: c}
# ... continue nesting ...
result = deepest | object.to_json }}
Impact
- Process crash DoS: Any application embedding Scriban for user-provided templates (CMS platforms, email template engines, report generators, static site generators) can be crashed by a single malicious template. The crash is unrecoverable —
StackOverflowExceptionterminates the .NET process. - No try/catch protection possible: Unlike most exceptions,
StackOverflowExceptioncannot be caught by application code. The hosting application cannot wraptemplate.Render()in a try/catch to survive this. - No authentication required:
object.to_jsonis a default builtin function (registered inBuiltinFunctions.cs), available in all Scriban templates unless explicitly removed. - Trivial to exploit: The PoC is a single line of template code.
Recommended Fix
Add a depth counter parameter to WriteValue() and check it against ObjectRecursionLimit, consistent with how ObjectToString is protected. Also add EnsureSufficientExecutionStack() as a safety net:
static void WriteValue(TemplateContext context, Utf8JsonWriter writer, object value, int depth = 0)
{
if (context.ObjectRecursionLimit != 0 && depth > context.ObjectRecursionLimit)
{
throw new ScriptRuntimeException(context.CurrentSpan,
$"Exceeding object recursion limit `{context.ObjectRecursionLimit}` in object.to_json");
}
try
{
RuntimeHelpers.EnsureSufficientExecutionStack();
}
catch (InsufficientExecutionStackException)
{
throw new ScriptRuntimeException(context.CurrentSpan,
"Exceeding recursive depth limit in object.to_json, near to stack overflow");
}
var type = value?.GetType() ?? typeof(object);
if (value is null || value is string || value is bool ||
type.IsPrimitiveOrDecimal() || value is IFormattable)
{
JsonSerializer.Serialize(writer, value, type);
}
else if (value is IList || type.IsArray) {
writer.WriteStartArray();
foreach (var x in context.ToList(context.CurrentSpan, value))
{
WriteValue(context, writer, x, depth + 1);
}
writer.WriteEndArray();
}
else {
writer.WriteStartObject();
var accessor = context.GetMemberAccessor(value);
foreach (var member in accessor.GetMembers(context, context.CurrentSpan, value))
{
if (accessor.TryGetValue(context, context.CurrentSpan, value, member, out var memberValue))
{
writer.WritePropertyName(member);
WriteValue(context, writer, memberValue, depth + 1);
}
}
writer.WriteEndObject();
}
}
{
"affected": [
{
"package": {
"ecosystem": "NuGet",
"name": "Scriban"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "7.0.0"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Scriban.Signed"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "7.0.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [],
"database_specific": {
"cwe_ids": [
"CWE-674"
],
"github_reviewed": true,
"github_reviewed_at": "2026-03-24T22:15:13Z",
"nvd_published_at": null,
"severity": "HIGH"
},
"details": "## Summary\n\nThe `object.to_json` builtin function in Scriban performs recursive JSON serialization via an internal `WriteValue()` static local function that has no depth limit, no circular reference detection, and no stack overflow guard. A Scriban template containing a self-referencing object passed to `object.to_json` triggers unbounded recursion, causing a `StackOverflowException` that terminates the hosting .NET process. This is a fatal, unrecoverable crash \u2014 `StackOverflowException` cannot be caught by user code in .NET.\n\n## Details\n\nThe vulnerable code is the `WriteValue()` static local function at `src/Scriban/Functions/ObjectFunctions.cs:494`:\n\n```csharp\nstatic void WriteValue(TemplateContext context, Utf8JsonWriter writer, object value)\n{\n var type = value?.GetType() ?? typeof(object);\n if (value is null || value is string || value is bool ||\n type.IsPrimitiveOrDecimal() || value is IFormattable)\n {\n JsonSerializer.Serialize(writer, value, type);\n }\n else if (value is IList || type.IsArray) {\n writer.WriteStartArray();\n foreach (var x in context.ToList(context.CurrentSpan, value))\n {\n WriteValue(context, writer, x); // recursive, no depth check\n }\n writer.WriteEndArray();\n }\n else {\n writer.WriteStartObject();\n var accessor = context.GetMemberAccessor(value);\n foreach (var member in accessor.GetMembers(context, context.CurrentSpan, value))\n {\n if (accessor.TryGetValue(context, context.CurrentSpan, value, member, out var memberValue))\n {\n writer.WritePropertyName(member);\n WriteValue(context, writer, memberValue); // recursive, no depth check\n }\n }\n writer.WriteEndObject();\n }\n}\n```\n\nThis function has **none** of the safety mechanisms present in other recursive paths:\n\n- `ObjectToString()` at `TemplateContext.Helpers.cs:98` checks `ObjectRecursionLimit` (default 20)\n- `EnterRecursive()` at `TemplateContext.cs:957` calls `RuntimeHelpers.EnsureSufficientExecutionStack()`\n- `CheckAbort()` at `TemplateContext.cs:464` also calls `EnsureSufficientExecutionStack()`\n\nThe `WriteValue()` function bypasses all of these because it is a static local function that only takes the `TemplateContext` for member access \u2014 it never calls `EnterRecursive()`, never checks `ObjectRecursionLimit`, and never calls `EnsureSufficientExecutionStack()`.\n\n**Execution flow:**\n\n1. Template creates a ScriptObject: `{{ x = {} }}`\n2. Sets a self-reference: `x.self = x` \u2014 stores a reference in `ScriptObject.Store` dictionary\n3. Pipes to `object.to_json`: `x | object.to_json` \u2192 calls `ToJson()` at line 477\n4. `ToJson()` calls `WriteValue(context, writer, value)` at line 488\n5. `WriteValue` enters the `else` branch (line 515), gets members via accessor, finds \"self\"\n6. `TryGetValue` returns `x` itself, `WriteValue` recurses with the same object \u2014 infinite loop\n7. `StackOverflowException` is thrown \u2014 **fatal, cannot be caught, process terminates**\n\n## PoC\n\n```scriban\n{{ x = {}; x.self = x; x | object.to_json }}\n```\n\nIn a hosting application:\n\n```csharp\nusing Scriban;\n\n// This will crash the entire process with StackOverflowException\nvar template = Template.Parse(\"{{ x = {}; x.self = x; x | object.to_json }}\");\nvar result = template.Render(); // FATAL: process terminates here\n```\n\nEven without circular references, deeply nested objects can exhaust the stack since no depth limit is enforced:\n\n```scriban\n{{ a = {}\n b = {inner: a}\n c = {inner: b}\n d = {inner: c}\n # ... continue nesting ...\n result = deepest | object.to_json }}\n```\n\n## Impact\n\n- **Process crash DoS**: Any application embedding Scriban for user-provided templates (CMS platforms, email template engines, report generators, static site generators) can be crashed by a single malicious template. The crash is unrecoverable \u2014 `StackOverflowException` terminates the .NET process.\n- **No try/catch protection possible**: Unlike most exceptions, `StackOverflowException` cannot be caught by application code. The hosting application cannot wrap `template.Render()` in a try/catch to survive this.\n- **No authentication required**: `object.to_json` is a default builtin function (registered in `BuiltinFunctions.cs`), available in all Scriban templates unless explicitly removed.\n- **Trivial to exploit**: The PoC is a single line of template code.\n\n## Recommended Fix\n\nAdd a depth counter parameter to `WriteValue()` and check it against `ObjectRecursionLimit`, consistent with how `ObjectToString` is protected. Also add `EnsureSufficientExecutionStack()` as a safety net:\n\n```csharp\nstatic void WriteValue(TemplateContext context, Utf8JsonWriter writer, object value, int depth = 0)\n{\n if (context.ObjectRecursionLimit != 0 \u0026\u0026 depth \u003e context.ObjectRecursionLimit)\n {\n throw new ScriptRuntimeException(context.CurrentSpan,\n $\"Exceeding object recursion limit `{context.ObjectRecursionLimit}` in object.to_json\");\n }\n\n try\n {\n RuntimeHelpers.EnsureSufficientExecutionStack();\n }\n catch (InsufficientExecutionStackException)\n {\n throw new ScriptRuntimeException(context.CurrentSpan,\n \"Exceeding recursive depth limit in object.to_json, near to stack overflow\");\n }\n\n var type = value?.GetType() ?? typeof(object);\n if (value is null || value is string || value is bool ||\n type.IsPrimitiveOrDecimal() || value is IFormattable)\n {\n JsonSerializer.Serialize(writer, value, type);\n }\n else if (value is IList || type.IsArray) {\n writer.WriteStartArray();\n foreach (var x in context.ToList(context.CurrentSpan, value))\n {\n WriteValue(context, writer, x, depth + 1);\n }\n writer.WriteEndArray();\n }\n else {\n writer.WriteStartObject();\n var accessor = context.GetMemberAccessor(value);\n foreach (var member in accessor.GetMembers(context, context.CurrentSpan, value))\n {\n if (accessor.TryGetValue(context, context.CurrentSpan, value, member, out var memberValue))\n {\n writer.WritePropertyName(member);\n WriteValue(context, writer, memberValue, depth + 1);\n }\n }\n writer.WriteEndObject();\n }\n}\n```",
"id": "GHSA-xcx6-vp38-8hr5",
"modified": "2026-07-06T13:09:17Z",
"published": "2026-03-24T22:15:13Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/scriban/scriban/security/advisories/GHSA-xcx6-vp38-8hr5"
},
{
"type": "PACKAGE",
"url": "https://github.com/scriban/scriban"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
],
"summary": "Scriban has Uncontrolled Recursion in `object.to_json` Causing Unrecoverable Process Crash via StackOverflowException"
}
GHSA-XF55-65PG-X58P
Vulnerability from github – Published: 2024-01-03 09:30 – Updated: 2025-11-04 00:30DOCSIS dissector crash in Wireshark 4.2.0 allows denial of service via packet injection or crafted capture file
{
"affected": [],
"aliases": [
"CVE-2024-0211"
],
"database_specific": {
"cwe_ids": [
"CWE-674",
"CWE-835"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-01-03T08:15:11Z",
"severity": "HIGH"
},
"details": "DOCSIS dissector crash in Wireshark 4.2.0 allows denial of service via packet injection or crafted capture file",
"id": "GHSA-xf55-65pg-x58p",
"modified": "2025-11-04T00:30:42Z",
"published": "2024-01-03T09:30:30Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-0211"
},
{
"type": "WEB",
"url": "https://gitlab.com/wireshark/wireshark/-/issues/19557"
},
{
"type": "WEB",
"url": "https://lists.debian.org/debian-lts-announce/2024/09/msg00049.html"
},
{
"type": "WEB",
"url": "https://www.wireshark.org/security/wnpa-sec-2024-05.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-XFCV-M889-FMQG
Vulnerability from github – Published: 2026-11-19 23:52 – Updated: 2026-11-19 23:52Root Cause
The dependency-graph traversal helpers recurse over dependency links without any depth
bound or visited set. DependencyGraph._tree (nltk/parse/dependencygraph.py:404)
recurses once per dependency link, triples (nltk/parse/dependencygraph.py:432) is a
recursive generator, and get_cycle_path (nltk/parse/dependencygraph.py:520) recurses
over dependencies. The neighbouring contains_cycle method was deliberately rewritten as
an iterative depth-first search, but these sibling helpers on the public traversal path
were left recursive with no depth counter.
Impact
An application that parses an untrusted CoNLL/Malt-TAB dependency structure and then walks
it via tree() or triples() aborts with an unhandled RecursionError, terminating the
affected operation or request worker (denial of service, CWE-674). The recursion is pure
Python, so the result is a catchable RecursionError, not memory corruption or code
execution. Confidentiality and integrity are unaffected. get_cycle_path additionally
lacks a visited set and will not terminate on a genuine cycle.
Attack Chain
- The application constructs
DependencyGraph(conll_str)from attacker-supplied text where token k's head is token k+1, forming a linear dependency chain of length N. Graph construction (_parse) is iterative and completes without error. - The application calls the public
DependencyGraph.tree()(nltk/parse/dependencygraph.py:408), which invokes_tree(root). _treerecurses once per chain link with no depth guard and no visited set, consuming one stack frame per link (the list comprehension costs roughly two frames per level).- Once the chain length exceeds the interpreter recursion limit, an unhandled
RecursionErrorpropagates out of the public API.triples()fails the same way.
Bypass Evidence
Against the shipped source at the default recursion limit, a chain of length 5 walks
cleanly through tree(), while a chain of length 5000 raises an unhandled
RecursionError; triples() fails identically. The minimal trigger is roughly N=500
tokens at the default recursion limit — a modest, realistic parse. Because the graph
builds iteratively in both cases, the fault is isolated to the recursive traversal rather
than to parsing. A repository-wide search confirms no depth guard exists in this file; the
iterative rewrite was applied only to contains_cycle.
Suggested Fix
Convert _tree, triples, and get_cycle_path to iterative traversals, or add a
recursion-depth bound (and, for get_cycle_path, a visited set) analogous to the
iterative rewrite already applied to contains_cycle.
Reported by pi (GitHub: @manus-pi).
Fix status (2026-09-28)
Status: MERGED on develop (unreleased; v3.10.3 of 2026-08-12 predates the fix).
PR: #3885 "Bound recursion depth in parsers and traversal helpers" (ekaf), merged 2026-09-11, merge commit e521ecafc on develop.
Fix commit: a74682757 (nltk/parse/dependencygraph.py: _tree, tree and triples stop at MAX_DEPTH=200 with ValueError).
Probe: nltk/test/unit/security_probes/ghsa_xfcv_m889_fmqg.py (added in 2a6704952 on that PR); verdict on develop 2fa3f48fe: FIXED (bounded in tree() (ValueError)).
Release: none yet; no release tag contains e521ecafc.
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 3.10.3"
},
"package": {
"ecosystem": "PyPI",
"name": "nltk"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "3.10.4"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-129225"
],
"database_specific": {
"cwe_ids": [
"CWE-674"
],
"github_reviewed": true,
"github_reviewed_at": "2026-11-19T23:52:20Z",
"nvd_published_at": "2026-11-19T18:18:07Z",
"severity": "MODERATE"
},
"details": "## Root Cause\nThe dependency-graph traversal helpers recurse over dependency links without any depth\nbound or visited set. `DependencyGraph._tree` (`nltk/parse/dependencygraph.py:404`)\nrecurses once per dependency link, `triples` (`nltk/parse/dependencygraph.py:432`) is a\nrecursive generator, and `get_cycle_path` (`nltk/parse/dependencygraph.py:520`) recurses\nover dependencies. The neighbouring `contains_cycle` method was deliberately rewritten as\nan iterative depth-first search, but these sibling helpers on the public traversal path\nwere left recursive with no depth counter.\n\n## Impact\nAn application that parses an untrusted CoNLL/Malt-TAB dependency structure and then walks\nit via `tree()` or `triples()` aborts with an unhandled `RecursionError`, terminating the\naffected operation or request worker (denial of service, CWE-674). The recursion is pure\nPython, so the result is a catchable `RecursionError`, not memory corruption or code\nexecution. Confidentiality and integrity are unaffected. `get_cycle_path` additionally\nlacks a visited set and will not terminate on a genuine cycle.\n\n## Attack Chain\n1. The application constructs `DependencyGraph(conll_str)` from attacker-supplied text\n where token *k*\u0027s head is token *k+1*, forming a linear dependency chain of length *N*.\n Graph construction (`_parse`) is iterative and completes without error.\n2. The application calls the public `DependencyGraph.tree()`\n (`nltk/parse/dependencygraph.py:408`), which invokes `_tree(root)`.\n3. `_tree` recurses once per chain link with no depth guard and no visited set, consuming\n one stack frame per link (the list comprehension costs roughly two frames per level).\n4. Once the chain length exceeds the interpreter recursion limit, an unhandled\n `RecursionError` propagates out of the public API. `triples()` fails the same way.\n\n## Bypass Evidence\nAgainst the shipped source at the default recursion limit, a chain of length 5 walks\ncleanly through `tree()`, while a chain of length 5000 raises an unhandled\n`RecursionError`; `triples()` fails identically. The minimal trigger is roughly *N*=500\ntokens at the default recursion limit \u2014 a modest, realistic parse. Because the graph\nbuilds iteratively in both cases, the fault is isolated to the recursive traversal rather\nthan to parsing. A repository-wide search confirms no depth guard exists in this file; the\niterative rewrite was applied only to `contains_cycle`.\n\n## Suggested Fix\nConvert `_tree`, `triples`, and `get_cycle_path` to iterative traversals, or add a\nrecursion-depth bound (and, for `get_cycle_path`, a visited set) analogous to the\niterative rewrite already applied to `contains_cycle`.\n\nReported by pi (GitHub: @manus-pi).\n\n## Fix status (2026-09-28)\n\nStatus: MERGED on develop (unreleased; v3.10.3 of 2026-08-12 predates the fix).\n\nPR: #3885 \"Bound recursion depth in parsers and traversal helpers\" (ekaf), merged 2026-09-11, merge commit e521ecafc on develop.\n\nFix commit: a74682757 (nltk/parse/dependencygraph.py: _tree, tree and triples stop at MAX_DEPTH=200 with ValueError).\n\nProbe: nltk/test/unit/security_probes/ghsa_xfcv_m889_fmqg.py (added in 2a6704952 on that PR); verdict on develop 2fa3f48fe: FIXED (bounded in tree() (ValueError)).\n\nRelease: none yet; no release tag contains e521ecafc.",
"id": "GHSA-xfcv-m889-fmqg",
"modified": "2026-11-19T23:52:20Z",
"published": "2026-11-19T23:52:20Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/nltk/nltk/security/advisories/GHSA-xfcv-m889-fmqg"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-129225"
},
{
"type": "WEB",
"url": "https://github.com/nltk/nltk/pull/3885"
},
{
"type": "WEB",
"url": "https://github.com/nltk/nltk/commit/a74682757cee8c11128ad277d2f2bd0b8e1884ff"
},
{
"type": "PACKAGE",
"url": "https://github.com/nltk/nltk"
},
{
"type": "WEB",
"url": "https://github.com/nltk/nltk/releases/tag/v3.10.4"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L",
"type": "CVSS_V3"
}
],
"summary": "NLTK: Uncontrolled recursion in DependencyGraph traversal causes denial of service via deep dependency chains"
}
GHSA-XFH7-F6H8-2F72
Vulnerability from github – Published: 2026-08-31 12:30 – Updated: 2026-08-31 12:30Uncontrolled Recursion vulnerability in Samsung Open Source rlottie allows Serialized Data with Nested Payloads.
This issue affects rlottie: before 8de0d9e6ca80ffef654965505981727b9fa06a51.
{
"affected": [],
"aliases": [
"CVE-2026-82797"
],
"database_specific": {
"cwe_ids": [
"CWE-674"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-08-31T12:17:58Z",
"severity": "MODERATE"
},
"details": "Uncontrolled Recursion vulnerability in Samsung Open Source rlottie allows Serialized Data with Nested Payloads.\n\nThis issue affects rlottie: before 8de0d9e6ca80ffef654965505981727b9fa06a51.",
"id": "GHSA-xfh7-f6h8-2f72",
"modified": "2026-08-31T12:30:26Z",
"published": "2026-08-31T12:30:26Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-82797"
},
{
"type": "WEB",
"url": "https://github.com/Samsung/rlottie/pull/603"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-XFXQ-W327-FMF9
Vulnerability from github – Published: 2026-08-21 00:31 – Updated: 2026-08-21 00:31IBM AIX 7.2, and 7.3 and IBM PowerVM VIOS 4.1 could allow a remote attacker to cause a denial of service due to uncontrolled recursion.
{
"affected": [],
"aliases": [
"CVE-2026-17121"
],
"database_specific": {
"cwe_ids": [
"CWE-400",
"CWE-674"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-08-20T22:17:12Z",
"severity": "HIGH"
},
"details": "IBM AIX 7.2, and 7.3 and IBM PowerVM VIOS 4.1 could allow a remote attacker to cause a denial of service due to uncontrolled recursion.",
"id": "GHSA-xfxq-w327-fmf9",
"modified": "2026-08-21T00:31:20Z",
"published": "2026-08-21T00:31:20Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-17121"
},
{
"type": "WEB",
"url": "https://www.ibm.com/support/pages/node/7283858"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
Mitigation
Ensure that an end condition will be reached under all logic conditions. The end condition may include checking against the depth of recursion and exiting with an error if the recursion goes too deep. The complexity of the end condition contributes to the effectiveness of this action.
Mitigation
Increase the stack size.
CAPEC-230: Serialized Data with Nested Payloads
Applications often need to transform data in and out of a data format (e.g., XML and YAML) by using a parser. It may be possible for an adversary to inject data that may have an adverse effect on the parser when it is being processed. Many data format languages allow the definition of macro-like structures that can be used to simplify the creation of complex structures. By nesting these structures, causing the data to be repeatedly substituted, an adversary can cause the parser to consume more resources while processing, causing excessive memory consumption and CPU utilization.
CAPEC-231: Oversized Serialized Data Payloads
An adversary injects oversized serialized data payloads into a parser during data processing to produce adverse effects upon the parser such as exhausting system resources and arbitrary code execution.