CWE-119
DiscouragedImproper Restriction of Operations within the Bounds of a Memory Buffer
Abstraction: Class · Status: Stable
The product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. This may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data.
17547 vulnerabilities reference this CWE, most recent first.
GHSA-GMPC-HJPX-Q93P
Vulnerability from github – Published: 2022-05-17 02:31 – Updated: 2022-05-17 02:31IrfanView version 4.44 (32bit) with FPX Plugin 4.46 allows attackers to execute arbitrary code or cause a denial of service via a crafted .fpx file, related to "Data from Faulting Address controls Code Flow starting at FPX!FPX_GetScanDevicePropertyGroup+0x000000000000c998."
{
"affected": [],
"aliases": [
"CVE-2017-9877"
],
"database_specific": {
"cwe_ids": [
"CWE-119"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2017-07-05T20:29:00Z",
"severity": "HIGH"
},
"details": "IrfanView version 4.44 (32bit) with FPX Plugin 4.46 allows attackers to execute arbitrary code or cause a denial of service via a crafted .fpx file, related to \"Data from Faulting Address controls Code Flow starting at FPX!FPX_GetScanDevicePropertyGroup+0x000000000000c998.\"",
"id": "GHSA-gmpc-hjpx-q93p",
"modified": "2022-05-17T02:31:31Z",
"published": "2022-05-17T02:31:31Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2017-9877"
},
{
"type": "WEB",
"url": "https://github.com/wlinzi/security_advisories/tree/master/CVE-2017-9877"
},
{
"type": "WEB",
"url": "http://www.irfanview.com/plugins.htm"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-GMQM-M77F-5PF9
Vulnerability from github – Published: 2022-05-14 02:31 – Updated: 2022-05-14 02:31Microsoft Internet Explorer 11 allows remote attackers to execute arbitrary code or cause a denial of service (memory corruption) via a crafted web site, aka "Internet Explorer Memory Corruption Vulnerability," a different vulnerability than CVE-2014-2787, CVE-2014-2802, and CVE-2014-2806.
{
"affected": [],
"aliases": [
"CVE-2014-2790"
],
"database_specific": {
"cwe_ids": [
"CWE-119"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2014-07-08T22:55:00Z",
"severity": "HIGH"
},
"details": "Microsoft Internet Explorer 11 allows remote attackers to execute arbitrary code or cause a denial of service (memory corruption) via a crafted web site, aka \"Internet Explorer Memory Corruption Vulnerability,\" a different vulnerability than CVE-2014-2787, CVE-2014-2802, and CVE-2014-2806.",
"id": "GHSA-gmqm-m77f-5pf9",
"modified": "2022-05-14T02:31:42Z",
"published": "2022-05-14T02:31:42Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2014-2790"
},
{
"type": "WEB",
"url": "https://docs.microsoft.com/en-us/security-updates/securitybulletins/2014/ms14-037"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/59775"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/68375"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id/1030532"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-GMV4-CXX4-RRCJ
Vulnerability from github – Published: 2022-05-14 02:17 – Updated: 2022-05-14 02:17Adobe Flash Player before 9.0.277.0 and 10.x before 10.1.53.64, and Adobe AIR before 2.0.2.12610, allows attackers to cause a denial of service (memory corruption) or possibly execute arbitrary code via unspecified vectors, a different vulnerability than CVE-2010-2160, CVE-2010-2165, CVE-2010-2166, CVE-2010-2171, CVE-2010-2175, CVE-2010-2176, CVE-2010-2177, CVE-2010-2178, CVE-2010-2180, CVE-2010-2182, CVE-2010-2187, and CVE-2010-2188.
{
"affected": [],
"aliases": [
"CVE-2010-2184"
],
"database_specific": {
"cwe_ids": [
"CWE-119"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2010-06-15T18:00:00Z",
"severity": "HIGH"
},
"details": "Adobe Flash Player before 9.0.277.0 and 10.x before 10.1.53.64, and Adobe AIR before 2.0.2.12610, allows attackers to cause a denial of service (memory corruption) or possibly execute arbitrary code via unspecified vectors, a different vulnerability than CVE-2010-2160, CVE-2010-2165, CVE-2010-2166, CVE-2010-2171, CVE-2010-2175, CVE-2010-2176, CVE-2010-2177, CVE-2010-2178, CVE-2010-2180, CVE-2010-2182, CVE-2010-2187, and CVE-2010-2188.",
"id": "GHSA-gmv4-cxx4-rrcj",
"modified": "2022-05-14T02:17:05Z",
"published": "2022-05-14T02:17:05Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2010-2184"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/59333"
},
{
"type": "WEB",
"url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A16029"
},
{
"type": "WEB",
"url": "https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A7334"
},
{
"type": "WEB",
"url": "http://itrc.hp.com/service/cki/docDisplay.do?docId=emr_na-c02273751"
},
{
"type": "WEB",
"url": "http://lists.apple.com/archives/security-announce/2010//Nov/msg00000.html"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-security-announce/2010-06/msg00000.html"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-security-announce/2010-06/msg00001.html"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/40144"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/40545"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/43026"
},
{
"type": "WEB",
"url": "http://security.gentoo.org/glsa/glsa-201101-09.xml"
},
{
"type": "WEB",
"url": "http://securitytracker.com/id?1024085"
},
{
"type": "WEB",
"url": "http://securitytracker.com/id?1024086"
},
{
"type": "WEB",
"url": "http://support.apple.com/kb/HT4435"
},
{
"type": "WEB",
"url": "http://www.adobe.com/support/security/bulletins/apsb10-14.html"
},
{
"type": "WEB",
"url": "http://www.redhat.com/support/errata/RHSA-2010-0464.html"
},
{
"type": "WEB",
"url": "http://www.redhat.com/support/errata/RHSA-2010-0470.html"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/40759"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/40796"
},
{
"type": "WEB",
"url": "http://www.turbolinux.co.jp/security/2010/TLSA-2010-19j.txt"
},
{
"type": "WEB",
"url": "http://www.us-cert.gov/cas/techalerts/TA10-162A.html"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2010/1421"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2010/1432"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2010/1434"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2010/1453"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2010/1482"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2010/1522"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2010/1793"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2011/0192"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-GMV4-H63M-HQGG
Vulnerability from github – Published: 2022-05-17 01:43 – Updated: 2022-05-17 01:43Heap-based buffer overflow in the read function in filters/words/msword-odf/wv2/src/styles.cpp in the Microsoft import filter in Calligra 2.4.3 and earlier allows remote attackers to cause a denial of service (application crash) and possibly execute arbitrary code via a crafted ODF style in an ODF document. NOTE: this is the same vulnerability as CVE-2012-3455, but it was SPLIT by the CNA even though Calligra and KOffice share the same codebase.
{
"affected": [],
"aliases": [
"CVE-2012-3456"
],
"database_specific": {
"cwe_ids": [
"CWE-119"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2012-08-20T18:55:00Z",
"severity": "HIGH"
},
"details": "Heap-based buffer overflow in the read function in filters/words/msword-odf/wv2/src/styles.cpp in the Microsoft import filter in Calligra 2.4.3 and earlier allows remote attackers to cause a denial of service (application crash) and possibly execute arbitrary code via a crafted ODF style in an ODF document. NOTE: this is the same vulnerability as CVE-2012-3455, but it was SPLIT by the CNA even though Calligra and KOffice share the same codebase.",
"id": "GHSA-gmv4-h63m-hqgg",
"modified": "2022-05-17T01:43:59Z",
"published": "2022-05-17T01:43:59Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2012-3456"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/77482"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-security-announce/2012-08/msg00026.html"
},
{
"type": "WEB",
"url": "http://marc.info/?l=bugtraq\u0026m=136733075705494\u0026w=2"
},
{
"type": "WEB",
"url": "http://media.blackhat.com/bh-us-12/Briefings/C_Miller/BH_US_12_Miller_NFC_attack_surface_WP.pdf"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/50050"
},
{
"type": "WEB",
"url": "http://www.kde.org/info/security/advisory-20120810-1.txt"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2012/08/04/1"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2012/08/04/5"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2012/08/06/1"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2012/08/06/6"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2012/08/10/1"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/54816"
},
{
"type": "WEB",
"url": "http://www.ubuntu.com/usn/USN-1525-1"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-GMVW-H9HF-3RXV
Vulnerability from github – Published: 2023-06-21 21:30 – Updated: 2024-04-04 04:59A vulnerability in SiLabs Z/IP Gateway 7.18.01 and earlier allows an authenticated attacker within Z-Wave range to manipulate an array pointer to disclose the contents of global memory.
{
"affected": [],
"aliases": [
"CVE-2023-0969"
],
"database_specific": {
"cwe_ids": [
"CWE-119",
"CWE-125"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-06-21T20:15:09Z",
"severity": "LOW"
},
"details": "A vulnerability in SiLabs Z/IP Gateway 7.18.01 and earlier allows an authenticated attacker within Z-Wave range to manipulate an array pointer to disclose the contents of global memory.",
"id": "GHSA-gmvw-h9hf-3rxv",
"modified": "2024-04-04T04:59:29Z",
"published": "2023-06-21T21:30:24Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-0969"
},
{
"type": "WEB",
"url": "https://siliconlabs.lightning.force.com/sfc/servlet.shepherd/document/download/0698Y00000V6HZzQAN?operationContext=S1"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-GMWG-2C9P-97X5
Vulnerability from github – Published: 2022-05-14 02:20 – Updated: 2022-05-14 02:20Multiple memory corruption flaws are present in ArubaOS which could allow an unauthenticated user to crash ArubaOS processes. With sufficient time and effort, it is possible these vulnerabilities could lead to the ability to execute arbitrary code - remote code execution has not yet been confirmed.
{
"affected": [],
"aliases": [
"CVE-2017-9003"
],
"database_specific": {
"cwe_ids": [
"CWE-119"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2018-08-06T20:29:00Z",
"severity": "HIGH"
},
"details": "Multiple memory corruption flaws are present in ArubaOS which could allow an unauthenticated user to crash ArubaOS processes. With sufficient time and effort, it is possible these vulnerabilities could lead to the ability to execute arbitrary code - remote code execution has not yet been confirmed.",
"id": "GHSA-gmwg-2c9p-97x5",
"modified": "2022-05-14T02:20:32Z",
"published": "2022-05-14T02:20:32Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2017-9003"
},
{
"type": "WEB",
"url": "http://www.arubanetworks.com/assets/alert/ARUBA-PSA-2017-006.txt"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id/1039580"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-GP2J-HGG9-C57V
Vulnerability from github – Published: 2022-05-13 01:54 – Updated: 2025-04-12 12:57Multiple integer signedness errors in the opj_j2k_update_image_data function in j2k.c in OpenJPEG, as used in PDFium in Google Chrome before 49.0.2623.87, allow remote attackers to cause a denial of service (incorrect cast and out-of-bounds write) or possibly have unspecified other impact via crafted JPEG 2000 data.
{
"affected": [],
"aliases": [
"CVE-2016-1645"
],
"database_specific": {
"cwe_ids": [
"CWE-119"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2016-03-13T22:59:00Z",
"severity": "HIGH"
},
"details": "Multiple integer signedness errors in the opj_j2k_update_image_data function in j2k.c in OpenJPEG, as used in PDFium in Google Chrome before 49.0.2623.87, allow remote attackers to cause a denial of service (incorrect cast and out-of-bounds write) or possibly have unspecified other impact via crafted JPEG 2000 data.",
"id": "GHSA-gp2j-hgg9-c57v",
"modified": "2025-04-12T12:57:48Z",
"published": "2022-05-13T01:54:05Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2016-1645"
},
{
"type": "WEB",
"url": "https://code.google.com/p/chromium/issues/detail?id=587227"
},
{
"type": "WEB",
"url": "https://pdfium.googlesource.com/pdfium/+/c145aeb2bf13ac408fc3e8233acca43d4251bbdc"
},
{
"type": "WEB",
"url": "http://googlechromereleases.blogspot.com/2016/03/stable-channel-update_8.html"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-security-announce/2016-03/msg00066.html"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-security-announce/2016-03/msg00067.html"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-security-announce/2016-03/msg00073.html"
},
{
"type": "WEB",
"url": "http://www.debian.org/security/2016/dsa-3513"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/84224"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id/1035259"
},
{
"type": "WEB",
"url": "http://www.zerodayinitiative.com/advisories/ZDI-16-197"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-GP3W-2V2M-P686
Vulnerability from github – Published: 2024-02-02 18:10 – Updated: 2024-11-22 20:45Summary
When calls to external contracts are made, we write the input buffer starting at byte 28, and allocate the return buffer to start at byte 0 (overlapping with the input buffer). When checking RETURNDATASIZE for dynamic types, the size is compared only to the minimum allowed size for that type, and not to the returned value's length. As a result, malformed return data can cause the contract to mistake data from the input buffer for returndata.
This advisory is given a severity of "Low" because when the called contract returns invalid ABIv2 encoded data, the calling contract can read different invalid data (from the dirty buffer) than the called contract returned.
Details
When arguments are packed for an external call, we create a buffer of size max(args, return_data) + 32. The input buffer is placed in this buffer (starting at byte 28), and the return buffer is allocated to start at byte 0. The assumption is that we can reuse the memory becase we will not be able to read past RETURNDATASIZE.
if fn_type.return_type is not None:
return_abi_t = calculate_type_for_external_return(fn_type.return_type).abi_type
# we use the same buffer for args and returndata,
# so allocate enough space here for the returndata too.
buflen = max(args_abi_t.size_bound(), return_abi_t.size_bound())
else:
buflen = args_abi_t.size_bound()
buflen += 32 # padding for the method id
When data is returned, we unpack the return data by starting at byte 0. We check that RETURNDATASIZE is greater than the minimum allowed for the returned type:
if not call_kwargs.skip_contract_check:
assertion = IRnode.from_list(
["assert", ["ge", "returndatasize", min_return_size]],
error_msg="returndatasize too small",
)
unpacker.append(assertion)
This check ensures that any dynamic types returned will have a size of at least 64. However, it does not verify that RETURNDATASIZE is as large as the length word of the dynamic type.
As a result, if a contract expects a dynamic type to be returned, and the part of the return data that is read as length includes a size that is larger than the actual RETURNDATASIZE, the return data read from the buffer will overrun the actual return data size and read from the input buffer.
Proof of Concept
This contract calls an external contract with two arguments. As the call is made, the buffer includes: - byte 28: method_id - byte 32: first argument (0) - byte 64: second argument (hash)
The return data buffer begins at byte 0, and will return the returned bytestring, up to a maximum length of 96 bytes.
interface Zero:
def sneaky(a: uint256, b: bytes32) -> Bytes[96]: view
@external
def test_sneaky(z: address) -> Bytes[96]:
return Zero(z).sneaky(0, keccak256("oops"))
On the other side, imagine a simple contract that does not, in fact, return a bytestring, but instead returns two uint256s. I've implemented it in Solidity for ease of use with Foundry:
function sneaky(uint a, bytes32 b) external pure returns (uint, uint) {
return (32, 32);
}
The return data will be parsed as a bytestring. The first 32 will point us to byte 32 to read the length. The second 32 will be perceived as the length. It will then read the next 32 bytes from the return data buffer, even though those weren't a part of the return data.
Since these bytes will come from byte 64, we can see above that the hash was placed there in the input buffer.
If we run the following Foundry test, we can see that this does in fact happen:
function test__sneakyZeroReturn() public {
ZeroReturn z = new ZeroReturn();
c = SuperContract(deployer.deploy("src/loose/", "ret_overflow", ""));
console.logBytes(c.test_sneaky(address(z)));
}
Logs:
0xd54c03ccbc84dd6002c98c6df5a828e42272fc54b512ca20694392ca89c4d2c6
Patches
Patched in https://github.com/vyperlang/vyper/pull/3925, https://github.com/vyperlang/vyper/pull/4091, https://github.com/vyperlang/vyper/pull/4144, https://github.com/vyperlang/vyper/pull/4060.
Impact
Malicious or mistaken contracts returning the malformed data can result in overrunning the returned data and reading return data from the input buffer.
{
"affected": [
{
"package": {
"ecosystem": "PyPI",
"name": "vyper"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.4.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2024-24560"
],
"database_specific": {
"cwe_ids": [
"CWE-119"
],
"github_reviewed": true,
"github_reviewed_at": "2024-02-02T18:10:10Z",
"nvd_published_at": "2024-02-02T17:15:11Z",
"severity": "LOW"
},
"details": "## Summary\n\nWhen calls to external contracts are made, we write the input buffer starting at byte 28, and allocate the return buffer to start at byte 0 (overlapping with the input buffer). When checking `RETURNDATASIZE` for dynamic types, the size is compared only to the minimum allowed size for that type, and not to the returned value\u0027s `length`. As a result, malformed return data can cause the contract to mistake data from the input buffer for returndata.\n\nThis advisory is given a severity of \"Low\" because when the called contract returns invalid ABIv2 encoded data, the calling contract can read different invalid data (from the dirty buffer) than the called contract returned.\n\n## Details\n\nWhen arguments are packed for an external call, we create a buffer of size `max(args, return_data) + 32`. The input buffer is placed in this buffer (starting at byte 28), and the return buffer is allocated to start at byte 0. The assumption is that we can reuse the memory becase we will not be able to read past `RETURNDATASIZE`.\n\n```python\nif fn_type.return_type is not None:\n return_abi_t = calculate_type_for_external_return(fn_type.return_type).abi_type\n\n # we use the same buffer for args and returndata,\n # so allocate enough space here for the returndata too.\n buflen = max(args_abi_t.size_bound(), return_abi_t.size_bound())\nelse:\n buflen = args_abi_t.size_bound()\n\nbuflen += 32 # padding for the method id\n```\n\nWhen data is returned, we unpack the return data by starting at byte 0. We check that `RETURNDATASIZE` is greater than the minimum allowed for the returned type:\n```python\nif not call_kwargs.skip_contract_check:\n assertion = IRnode.from_list(\n [\"assert\", [\"ge\", \"returndatasize\", min_return_size]],\n error_msg=\"returndatasize too small\",\n )\n unpacker.append(assertion)\n```\n\nThis check ensures that any dynamic types returned will have a size of at least 64. However, it does not verify that `RETURNDATASIZE` is as large as the `length` word of the dynamic type. \n\nAs a result, if a contract expects a dynamic type to be returned, and the part of the return data that is read as `length` includes a size that is larger than the actual `RETURNDATASIZE`, the return data read from the buffer will overrun the actual return data size and read from the input buffer.\n\n## Proof of Concept\n\nThis contract calls an external contract with two arguments. As the call is made, the buffer includes:\n- byte 28: method_id\n- byte 32: first argument (0)\n- byte 64: second argument (hash)\n\nThe return data buffer begins at byte 0, and will return the returned bytestring, up to a maximum length of 96 bytes.\n\n```python\ninterface Zero:\n def sneaky(a: uint256, b: bytes32) -\u003e Bytes[96]: view\n\n@external\ndef test_sneaky(z: address) -\u003e Bytes[96]:\n return Zero(z).sneaky(0, keccak256(\"oops\"))\n```\nOn the other side, imagine a simple contract that does not, in fact, return a bytestring, but instead returns two uint256s. I\u0027ve implemented it in Solidity for ease of use with Foundry:\n```solidity\nfunction sneaky(uint a, bytes32 b) external pure returns (uint, uint) {\n return (32, 32);\n}\n```\n\nThe return data will be parsed as a bytestring. The first 32 will point us to byte 32 to read the length. The second 32 will be perceived as the length. It will then read the next 32 bytes from the return data buffer, even though those weren\u0027t a part of the return data.\n\nSince these bytes will come from byte 64, we can see above that the hash was placed there in the input buffer.\n\nIf we run the following Foundry test, we can see that this does in fact happen:\n```solidity\nfunction test__sneakyZeroReturn() public {\n ZeroReturn z = new ZeroReturn();\n c = SuperContract(deployer.deploy(\"src/loose/\", \"ret_overflow\", \"\"));\n console.logBytes(c.test_sneaky(address(z)));\n}\n```\n\n```md\nLogs:\n 0xd54c03ccbc84dd6002c98c6df5a828e42272fc54b512ca20694392ca89c4d2c6\n```\n\n### Patches\nPatched in https://github.com/vyperlang/vyper/pull/3925, https://github.com/vyperlang/vyper/pull/4091, https://github.com/vyperlang/vyper/pull/4144, https://github.com/vyperlang/vyper/pull/4060.\n\n## Impact\n\nMalicious or mistaken contracts returning the malformed data can result in overrunning the returned data and reading return data from the input buffer.",
"id": "GHSA-gp3w-2v2m-p686",
"modified": "2024-11-22T20:45:44Z",
"published": "2024-02-02T18:10:10Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/vyperlang/vyper/security/advisories/GHSA-gp3w-2v2m-p686"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-24560"
},
{
"type": "WEB",
"url": "https://github.com/pypa/advisory-database/tree/main/vulns/vyper/PYSEC-2024-148.yaml"
},
{
"type": "PACKAGE",
"url": "https://github.com/vyperlang/vyper"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N",
"type": "CVSS_V3"
}
],
"summary": "Vyper\u0027s external calls can overflow return data to return input buffer"
}
GHSA-GP4C-C4G6-6CQF
Vulnerability from github – Published: 2022-05-01 23:50 – Updated: 2025-04-09 03:55Multiple stack-based buffer overflows in the HTTP Gateway Service (icihttp.exe) in CA eTrust Secure Content Manager 8.0 allow remote attackers to execute arbitrary code or cause a denial of service via long FTP responses, related to (1) the file month field in a LIST command; (2) the PASV command; and (3) directories, files, and links in a LIST command.
{
"affected": [],
"aliases": [
"CVE-2008-2541"
],
"database_specific": {
"cwe_ids": [
"CWE-119"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2008-06-04T20:32:00Z",
"severity": "HIGH"
},
"details": "Multiple stack-based buffer overflows in the HTTP Gateway Service (icihttp.exe) in CA eTrust Secure Content Manager 8.0 allow remote attackers to execute arbitrary code or cause a denial of service via long FTP responses, related to (1) the file month field in a LIST command; (2) the PASV command; and (3) directories, files, and links in a LIST command.",
"id": "GHSA-gp4c-c4g6-6cqf",
"modified": "2025-04-09T03:55:12Z",
"published": "2022-05-01T23:50:53Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2008-2541"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/42821"
},
{
"type": "WEB",
"url": "https://support.ca.com/irj/portal/anonymous/SolutionResults?aparNo=QO99987\u0026os=NT\u0026actionID=3"
},
{
"type": "WEB",
"url": "http://dvlabs.tippingpoint.com/advisory/TPTI-08-05"
},
{
"type": "WEB",
"url": "http://secunia.com/advisories/30518"
},
{
"type": "WEB",
"url": "http://www.ca.com/us/securityadvisor/vulninfo/vuln.aspx?id=36408"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/493082/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/493084/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/493087/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/archive/1/493124/100/0/threaded"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/29528"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id?1020167"
},
{
"type": "WEB",
"url": "http://www.vupen.com/english/advisories/2008/1741/references"
},
{
"type": "WEB",
"url": "http://www.zerodayinitiative.com/advisories/ZDI-08-035"
},
{
"type": "WEB",
"url": "http://www.zerodayinitiative.com/advisories/ZDI-08-036"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-GP57-H4HF-V8GP
Vulnerability from github – Published: 2025-03-17 15:31 – Updated: 2025-03-17 15:31Buffer overflow vulnerability in Immunity Debugger affecting version 1.85, its exploitation could allow a local attacker to execute arbitrary code, due to the lack of proper boundary checking.
{
"affected": [],
"aliases": [
"CVE-2025-2401"
],
"database_specific": {
"cwe_ids": [
"CWE-119"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-03-17T13:15:39Z",
"severity": "MODERATE"
},
"details": "Buffer overflow vulnerability in Immunity Debugger affecting version 1.85, its exploitation could allow a local attacker to execute arbitrary code, due to the lack of proper boundary checking.",
"id": "GHSA-gp57-h4hf-v8gp",
"modified": "2025-03-17T15:31:48Z",
"published": "2025-03-17T15:31:47Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-2401"
},
{
"type": "WEB",
"url": "https://www.incibe.es/en/incibe-cert/notices/aviso/buffer-overflow-immunity-debugger"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:L/AC:H/AT:N/PR:L/UI:A/VC:H/VI:H/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 MIT-3
Strategy: Language Selection
- Use a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.
- For example, many languages that perform their own memory management, such as Java and Perl, are not subject to buffer overflows. Other languages, such as Ada and C#, typically provide overflow protection, but the protection can be disabled by the programmer.
- Be wary that a language's interface to native code may still be subject to overflows, even if the language itself is theoretically safe.
Mitigation MIT-4.1
Strategy: Libraries or Frameworks
- Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.
- Examples include the Safe C String Library (SafeStr) by Messier and Viega [REF-57], and the Strsafe.h library from Microsoft [REF-56]. These libraries provide safer versions of overflow-prone string-handling functions.
Mitigation MIT-10
Strategy: Environment Hardening
- Use automatic buffer overflow detection mechanisms that are offered by certain compilers or compiler extensions. Examples include: the Microsoft Visual Studio /GS flag, Fedora/Red Hat FORTIFY_SOURCE GCC flag, StackGuard, and ProPolice, which provide various mechanisms including canary-based detection and range/index checking.
- D3-SFCV (Stack Frame Canary Validation) from D3FEND [REF-1334] discusses canary-based detection in detail.
Mitigation MIT-9
- Consider adhering to the following rules when allocating and managing an application's memory:
- Double check that the buffer is as large as specified.
- When using functions that accept a number of bytes to copy, such as strncpy(), be aware that if the destination buffer size is equal to the source buffer size, it may not NULL-terminate the string.
- Check buffer boundaries if accessing the buffer in a loop and make sure there is no danger of writing past the allocated space.
- If necessary, truncate all input strings to a reasonable length before passing them to the copy and concatenation functions.
Mitigation MIT-11
Strategy: Environment Hardening
- Run or compile the software using features or extensions that randomly arrange the positions of a program's executable and libraries in memory. Because this makes the addresses unpredictable, it can prevent an attacker from reliably jumping to exploitable code.
- Examples include Address Space Layout Randomization (ASLR) [REF-58] [REF-60] and Position-Independent Executables (PIE) [REF-64]. Imported modules may be similarly realigned if their default memory addresses conflict with other modules, in a process known as "rebasing" (for Windows) and "prelinking" (for Linux) [REF-1332] using randomly generated addresses. ASLR for libraries cannot be used in conjunction with prelink since it would require relocating the libraries at run-time, defeating the whole purpose of prelinking.
- For more information on these techniques see D3-SAOR (Segment Address Offset Randomization) from D3FEND [REF-1335].
Mitigation MIT-12
Strategy: Environment Hardening
- Use a CPU and operating system that offers Data Execution Protection (using hardware NX or XD bits) or the equivalent techniques that simulate this feature in software, such as PaX [REF-60] [REF-61]. These techniques ensure that any instruction executed is exclusively at a memory address that is part of the code segment.
- For more information on these techniques see D3-PSEP (Process Segment Execution Prevention) from D3FEND [REF-1336].
Mitigation MIT-13
Replace unbounded copy functions with analogous functions that support length arguments, such as strcpy with strncpy. Create these if they are not available.
CAPEC-10: Buffer Overflow via Environment Variables
This attack pattern involves causing a buffer overflow through manipulation of environment variables. Once the adversary finds that they can modify an environment variable, they may try to overflow associated buffers. This attack leverages implicit trust often placed in environment variables.
CAPEC-100: Overflow Buffers
Buffer Overflow attacks target improper or missing bounds checking on buffer operations, typically triggered by input injected by an adversary. As a consequence, an adversary is able to write past the boundaries of allocated buffer regions in memory, causing a program crash or potentially redirection of execution as per the adversaries' choice.
CAPEC-123: Buffer Manipulation
An adversary manipulates an application's interaction with a buffer in an attempt to read or modify data they shouldn't have access to. Buffer attacks are distinguished in that it is the buffer space itself that is the target of the attack rather than any code responsible for interpreting the content of the buffer. In virtually all buffer attacks the content that is placed in the buffer is immaterial. Instead, most buffer attacks involve retrieving or providing more input than can be stored in the allocated buffer, resulting in the reading or overwriting of other unintended program memory.
CAPEC-14: Client-side Injection-induced Buffer Overflow
This type of attack exploits a buffer overflow vulnerability in targeted client software through injection of malicious content from a custom-built hostile service. This hostile service is created to deliver the correct content to the client software. For example, if the client-side application is a browser, the service will host a webpage that the browser loads.
CAPEC-24: Filter Failure through Buffer Overflow
In this attack, the idea is to cause an active filter to fail by causing an oversized transaction. An attacker may try to feed overly long input strings to the program in an attempt to overwhelm the filter (by causing a buffer overflow) and hoping that the filter does not fail securely (i.e. the user input is let into the system unfiltered).
CAPEC-42: MIME Conversion
An attacker exploits a weakness in the MIME conversion routine to cause a buffer overflow and gain control over the mail server machine. The MIME system is designed to allow various different information formats to be interpreted and sent via e-mail. Attack points exist when data are converted to MIME compatible format and back.
CAPEC-44: Overflow Binary Resource File
An attack of this type exploits a buffer overflow vulnerability in the handling of binary resources. Binary resources may include music files like MP3, image files like JPEG files, and any other binary file. These attacks may pass unnoticed to the client machine through normal usage of files, such as a browser loading a seemingly innocent JPEG file. This can allow the adversary access to the execution stack and execute arbitrary code in the target process.
CAPEC-45: Buffer Overflow via Symbolic Links
This type of attack leverages the use of symbolic links to cause buffer overflows. An adversary can try to create or manipulate a symbolic link file such that its contents result in out of bounds data. When the target software processes the symbolic link file, it could potentially overflow internal buffers with insufficient bounds checking.
CAPEC-46: Overflow Variables and Tags
This type of attack leverages the use of tags or variables from a formatted configuration data to cause buffer overflow. The adversary crafts a malicious HTML page or configuration file that includes oversized strings, thus causing an overflow.
CAPEC-47: Buffer Overflow via Parameter Expansion
In this attack, the target software is given input that the adversary knows will be modified and expanded in size during processing. This attack relies on the target software failing to anticipate that the expanded data may exceed some internal limit, thereby creating a buffer overflow.
CAPEC-8: Buffer Overflow in an API Call
This attack targets libraries or shared code modules which are vulnerable to buffer overflow attacks. An adversary who has knowledge of known vulnerable libraries or shared code can easily target software that makes use of these libraries. All clients that make use of the code library thus become vulnerable by association. This has a very broad effect on security across a system, usually affecting more than one software process.
CAPEC-9: Buffer Overflow in Local Command-Line Utilities
This attack targets command-line utilities available in a number of shells. An adversary can leverage a vulnerability found in a command-line utility to escalate privilege to root.