HIGH 7.5

CVE-2026-56018: JavaScript::Minifier::XS Memory Leak Denial of Service

JavaScript::Minifier::XS is a Perl module that compresses JavaScript code. Versions before 0.16 have a memory leak bug: every time the minify() function runs, it fails to properly free memory used for processing tokens. In server environments where minification happens repeatedly—like web asset pipelines or API endpoints that minify on demand—this leak causes the process to consume more memory with each request. Eventually the server runs out of memory and crashes, disrupting service. The vulnerability requires no authentication or user interaction; an attacker can trigger it by simply making repeated minification requests.

Source data · NVD / CISA · public domain

CVSS
3.1 · 7.5 HIGH · CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weaknesses (CWE)
CWE-400, CWE-401
Affected products
0 configuration(s)
Published / Modified
2026-06-29 / 2026-06-30

NVD description (verbatim)

JavaScript::Minifier::XS versions before 0.16 for Perl leak memory on every call to minify(), allowing unbounded memory growth. In JsMinify (XS.xs) the cleanup frees only the NodeSet structures and never the per-token contents buffers allocated in JsSetNodeContents; JsDiscardNode unlinks nodes without freeing their contents. Each token's contents buffer is therefore leaked on every call, and the two early returns taken when the node list is empty leak the whole NodeSet. A long-lived process that minifies repeatedly, such as an asset pipeline or a server-side minifier endpoint, grows in memory without bound until it exhausts available memory and is killed, causing denial of service.

3 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability is a double-layer memory management failure in XS.xs. First, the JsSetNodeContents function allocates per-token content buffers that are never freed during normal cleanup. Second, JsDiscardNode unlinks nodes from the parse tree without releasing their associated memory. Consequently, every call to minify() leaks at least one token's content buffer, plus additional leaks when edge cases occur (empty node lists trigger early returns that bypass the already-incomplete cleanup). This is a classic CWE-401 (missing release of memory after effective lifetime) compounded by CWE-400 (uncontrolled resource consumption). A process running for days or weeks will accumulate gigabytes of unreleased memory.

Business impact

Any organization using JavaScript::Minifier::XS in a production service faces availability risk. Web frameworks that use this module for on-the-fly minification, CI/CD pipelines that minify assets repeatedly, or SaaS platforms offering minification as a service are all vulnerable to memory exhaustion denial of service. The impact is silent degradation: the service doesn't crash immediately but becomes increasingly sluggish as memory pressure rises, eventually triggering OOM killer termination. This can cascade into service restarts, cache invalidation, and poor user experience. Organizations relying on this module for critical asset processing should prioritize patching.

Affected systems

The vulnerability affects JavaScript::Minifier::XS module versions prior to 0.16 running on Perl environments. Any system or service that imports and uses this module is at risk if not updated. This includes Perl-based web servers, asset pipelines, build systems, and API endpoints that call the minify() function repeatedly. Systems with a single or infrequent minification operation face lower risk; the severity scales with call frequency and uptime.

Exploitability

The vulnerability is trivial to exploit from a network perspective. No authentication is required; no special privileges are needed. An attacker simply sends repeated requests to any endpoint that triggers minification—for instance, requests to a public API or web application that minifies JavaScript on demand. Each request forces a memory leak. The attack is detectable only by monitoring memory consumption; there is no crash or error message that alerts operators to the attack in progress. This makes it a practical denial-of-service vector for any internet-facing service using the vulnerable module.

Remediation

Upgrade JavaScript::Minifier::XS to version 0.16 or later. The patch fixes the leak by ensuring that all token content buffers are properly freed during cleanup, and by eliminating the early returns that bypass cleanup entirely. Administrators should audit their Perl dependency manifests (Makefile.PL, cpanfile, etc.) to identify where this module is pinned or imported, then test and deploy the patched version. For organizations unable to update immediately, temporary mitigations include rate-limiting minification endpoints, implementing memory monitoring with alerting, and configuring aggressive process recycling policies to prevent unbounded memory growth.

Patch guidance

Verify the patched version number (0.16 or later) against the official CPAN repository or the vendor's release notes. Update Perl dependency files and run your test suite to confirm compatibility with your build or runtime environment. In a staging environment, validate that minification performance and output remain unchanged post-upgrade. Monitor memory usage of minifier processes during testing to confirm the leak is resolved. If this module is vendored or embedded in a larger application, ensure you are upgrading the correct component.

Detection guidance

Monitor memory growth in long-running Perl processes that use JavaScript::Minifier::XS. Tools like ps, top, or systemd resource accounting (systemd-cgtop) can track resident memory (RSS) over time. A linear or exponential increase in memory without corresponding input volume growth is a red flag. Implement application-level logging to correlate minify() call counts with memory consumption; a rising ratio indicates a leak. Network-based detection is difficult since the attack traffic looks normal; focus on resource monitoring and alerting on abnormal memory trends.

Why prioritize this

Although the CVSS score is 7.5 (HIGH) due to network accessibility and guaranteed denial of service impact, actual prioritization depends on deployment context. Services that minify frequently or serve untrusted input should treat this as critical. Services that minify rarely or in controlled batch operations face lower risk. The lack of KEV designation (not yet actively exploited) suggests a window to patch before public exploit tooling emerges. Prioritize based on your minification frequency and the criticality of the affected service.

Risk score, explained

The CVSS 3.1 score of 7.5 reflects a network-accessible, unauthenticated denial of service attack with no complexity barriers. The vector (AV:N/AC:L/PR:N/UI:N) confirms anyone can trigger the leak remotely. Confidentiality and integrity are unaffected; availability is severely impacted. This places the vulnerability in the HIGH severity band. However, real-world risk varies: a single-shot minifier used at deployment time faces near-zero risk, while an always-on minification API faces continuous risk.

Frequently asked questions

Can an attacker steal data or modify code via this vulnerability?

No. The memory leak causes denial of service only. There is no code execution, no memory disclosure, and no way to corrupt application logic. The attacker's only capability is to exhaust memory and force a restart.

If we only minify JavaScript once during our build process, are we at risk?

Minimal risk. The leak manifests over repeated calls. A single minify() invocation per build generates one small leak that is reclaimed when the process exits. Concern grows with frequency: hourly builds are low-risk; minification on every HTTP request is high-risk.

Are there workarounds if we cannot patch immediately?

Yes, but imperfect. Rate-limit or throttle minification endpoints to reduce call frequency. Implement process recycling (restart the minifier process every N minutes or M requests) to clear accumulated memory. Monitor RSS and alert on rapid growth so you can react before OOM. These buy time but do not eliminate the leak.

Does this affect other JavaScript minifiers or modules?

No, this is specific to JavaScript::Minifier::XS. Other Perl minifiers or non-Perl tools are unaffected unless they have independent memory management bugs. Check your dependency tree to confirm which modules you actually use.

This analysis is based on the CVE description and public information as of the publication date. Patch version numbers and affected software should be verified against official vendor advisories and the CPAN repository. Memory exhaustion behavior and timeline depend on call frequency, available memory, and system configuration. Organizations should test patches in staging environments before production deployment. No exploit code or weaponized proof-of-concept is provided or endorsed. Source: NVD (public-domain), retrieved 2026-08-08. Analysis generated by SEC.co (claude-haiku-4-5).