CWE-787
Allowed-with-ReviewOut-of-bounds Write
Abstraction: Base · Status: Draft
The product writes data past the end, or before the beginning, of the intended buffer.
17105 vulnerabilities reference this CWE, most recent first.
GHSA-XHG3-P7WR-4HRX
Vulnerability from github – Published: 2022-05-24 16:50 – Updated: 2025-11-25 18:32Mozilla developers and community members reported memory safety bugs present in Firefox 67 and Firefox ESR 60.7. Some of these bugs showed evidence of memory corruption and we presume that with enough effort that some of these could be exploited to run arbitrary code. This vulnerability affects Firefox ESR < 60.8, Firefox < 68, and Thunderbird < 60.8.
{
"affected": [],
"aliases": [
"CVE-2019-11709"
],
"database_specific": {
"cwe_ids": [
"CWE-119",
"CWE-787"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2019-07-23T14:15:00Z",
"severity": "CRITICAL"
},
"details": "Mozilla developers and community members reported memory safety bugs present in Firefox 67 and Firefox ESR 60.7. Some of these bugs showed evidence of memory corruption and we presume that with enough effort that some of these could be exploited to run arbitrary code. This vulnerability affects Firefox ESR \u003c 60.8, Firefox \u003c 68, and Thunderbird \u003c 60.8.",
"id": "GHSA-xhg3-p7wr-4hrx",
"modified": "2025-11-25T18:32:16Z",
"published": "2022-05-24T16:50:58Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2019-11709"
},
{
"type": "WEB",
"url": "https://bugzilla.mozilla.org/buglist.cgi?bug_id=1547266%2C1540759%2C1548822%2C1550498%2C1515052%2C1539219%2C1547757%2C1550498%2C1533522"
},
{
"type": "WEB",
"url": "https://lists.debian.org/debian-lts-announce/2019/08/msg00001.html"
},
{
"type": "WEB",
"url": "https://lists.debian.org/debian-lts-announce/2019/08/msg00002.html"
},
{
"type": "WEB",
"url": "https://security.gentoo.org/glsa/201908-12"
},
{
"type": "WEB",
"url": "https://security.gentoo.org/glsa/201908-20"
},
{
"type": "WEB",
"url": "https://www.mozilla.org/security/advisories/mfsa2019-21"
},
{
"type": "WEB",
"url": "https://www.mozilla.org/security/advisories/mfsa2019-22"
},
{
"type": "WEB",
"url": "https://www.mozilla.org/security/advisories/mfsa2019-23"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-security-announce/2019-07/msg00055.html"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-security-announce/2019-07/msg00058.html"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00073.html"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-security-announce/2019-10/msg00009.html"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-security-announce/2019-10/msg00010.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-XHG5-M3MP-PF34
Vulnerability from github – Published: 2024-04-23 21:30 – Updated: 2024-04-23 21:30A vulnerability classified as critical has been found in Tenda AC8 16.03.34.09. Affected is the function fromAdvSetMacMtuWan of the file /goform/AdvSetMacMtuWan. The manipulation of the argument wanMTU/wanSpeed/cloneType/mac/serviceName/serverName leads to stack-based buffer overflow. It is possible to launch the attack remotely. The exploit has been disclosed to the public and may be used. The identifier of this vulnerability is VDB-261792. NOTE: The vendor was contacted early about this disclosure but did not respond in any way.
{
"affected": [],
"aliases": [
"CVE-2024-4066"
],
"database_specific": {
"cwe_ids": [
"CWE-121",
"CWE-787"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-04-23T21:15:49Z",
"severity": "HIGH"
},
"details": "A vulnerability classified as critical has been found in Tenda AC8 16.03.34.09. Affected is the function fromAdvSetMacMtuWan of the file /goform/AdvSetMacMtuWan. The manipulation of the argument wanMTU/wanSpeed/cloneType/mac/serviceName/serverName leads to stack-based buffer overflow. It is possible to launch the attack remotely. The exploit has been disclosed to the public and may be used. The identifier of this vulnerability is VDB-261792. NOTE: The vendor was contacted early about this disclosure but did not respond in any way.",
"id": "GHSA-xhg5-m3mp-pf34",
"modified": "2024-04-23T21:30:34Z",
"published": "2024-04-23T21:30:34Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-4066"
},
{
"type": "WEB",
"url": "https://github.com/abcdefg-png/IoT-vulnerable/blob/main/Tenda/AC8/fromAdvSetMacMtuWan.md"
},
{
"type": "WEB",
"url": "https://vuldb.com/?ctiid.261792"
},
{
"type": "WEB",
"url": "https://vuldb.com/?id.261792"
},
{
"type": "WEB",
"url": "https://vuldb.com/?submit.316495"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-XHGJ-P5P6-X24H
Vulnerability from github – Published: 2022-04-28 00:00 – Updated: 2022-05-06 00:01A flaw was found in htmldoc commit 31f7804. A heap buffer overflow in the function pdf_write_names in ps-pdf.cxx may lead to arbitrary code execution and Denial of Service (DoS).
{
"affected": [],
"aliases": [
"CVE-2022-28085"
],
"database_specific": {
"cwe_ids": [
"CWE-787"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2022-04-27T03:15:00Z",
"severity": "HIGH"
},
"details": "A flaw was found in htmldoc commit 31f7804. A heap buffer overflow in the function pdf_write_names in ps-pdf.cxx may lead to arbitrary code execution and Denial of Service (DoS).",
"id": "GHSA-xhgj-p5p6-x24h",
"modified": "2022-05-06T00:01:08Z",
"published": "2022-04-28T00:00:35Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-28085"
},
{
"type": "WEB",
"url": "https://github.com/michaelrsweet/htmldoc/issues/480"
},
{
"type": "WEB",
"url": "https://github.com/michaelrsweet/htmldoc/commit/46c8ec2b9bccb8ccabff52d998c5eee77a228348"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-XHGX-7974-C8V6
Vulnerability from github – Published: 2023-12-27 21:31 – Updated: 2024-01-04 22:18hyavijava v6.0.07.1 was discovered to contain a stack overflow via the ResultConverter.convert2Xml method.
{
"affected": [
{
"package": {
"ecosystem": "Maven",
"name": "com.github:hyavijava"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"last_affected": "6.0.07.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2023-51084"
],
"database_specific": {
"cwe_ids": [
"CWE-787"
],
"github_reviewed": true,
"github_reviewed_at": "2024-01-04T22:18:15Z",
"nvd_published_at": "2023-12-27T21:15:08Z",
"severity": "CRITICAL"
},
"details": "hyavijava v6.0.07.1 was discovered to contain a stack overflow via the `ResultConverter.convert2Xml` method.",
"id": "GHSA-xhgx-7974-c8v6",
"modified": "2024-01-04T22:18:15Z",
"published": "2023-12-27T21:31:01Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-51084"
},
{
"type": "WEB",
"url": "https://github.com/PoppingSnack/VulReport/issues/12"
},
{
"type": "PACKAGE",
"url": "https://github.com/hyavijava/hyavijava"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "hyavijava stack overflow vulnerability"
}
GHSA-XHMV-MW7V-7GV2
Vulnerability from github – Published: 2024-05-06 15:30 – Updated: 2024-05-06 15:30Memory corruption when the channel ID passed by user is not validated and further used.
{
"affected": [],
"aliases": [
"CVE-2024-21476"
],
"database_specific": {
"cwe_ids": [
"CWE-20",
"CWE-787"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-05-06T15:15:22Z",
"severity": "HIGH"
},
"details": "Memory corruption when the channel ID passed by user is not validated and further used.",
"id": "GHSA-xhmv-mw7v-7gv2",
"modified": "2024-05-06T15:30:39Z",
"published": "2024-05-06T15:30:39Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-21476"
},
{
"type": "WEB",
"url": "https://docs.qualcomm.com/product/publicresources/securitybulletin/may-2024-bulletin.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-XHMW-J639-PH2M
Vulnerability from github – Published: 2022-05-24 19:13 – Updated: 2023-01-11 09:30A crafted NTFS image can cause an out-of-bounds access in ntfs_decompress in NTFS-3G < 2021.8.22.
{
"affected": [],
"aliases": [
"CVE-2021-39262"
],
"database_specific": {
"cwe_ids": [
"CWE-119",
"CWE-20",
"CWE-787"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-09-07T15:15:00Z",
"severity": "HIGH"
},
"details": "A crafted NTFS image can cause an out-of-bounds access in ntfs_decompress in NTFS-3G \u003c 2021.8.22.",
"id": "GHSA-xhmw-j639-ph2m",
"modified": "2023-01-11T09:30:31Z",
"published": "2022-05-24T19:13:08Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/tuxera/ntfs-3g/security/advisories/GHSA-q759-8j5v-q5jp"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-39262"
},
{
"type": "WEB",
"url": "https://github.com/tuxera/ntfs-3g/releases"
},
{
"type": "WEB",
"url": "https://lists.debian.org/debian-lts-announce/2021/11/msg00013.html"
},
{
"type": "WEB",
"url": "https://security.gentoo.org/glsa/202301-01"
},
{
"type": "WEB",
"url": "https://www.debian.org/security/2021/dsa-4971"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-XHQ7-WG93-R5F3
Vulnerability from github – Published: 2023-08-22 21:30 – Updated: 2024-04-04 07:05Heap buffer overflow vulnerability in FilePOSIX::read in File.cpp in audiofile 0.3.6 may cause denial-of-service via a crafted wav file, this bug can be triggered by the executable sfconvert.
{
"affected": [],
"aliases": [
"CVE-2020-18781"
],
"database_specific": {
"cwe_ids": [
"CWE-787"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-08-22T19:15:56Z",
"severity": "MODERATE"
},
"details": "Heap buffer overflow vulnerability in FilePOSIX::read in File.cpp in audiofile 0.3.6 may cause denial-of-service via a crafted wav file, this bug can be triggered by the executable sfconvert.",
"id": "GHSA-xhq7-wg93-r5f3",
"modified": "2024-04-04T07:05:37Z",
"published": "2023-08-22T21:30:24Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2020-18781"
},
{
"type": "WEB",
"url": "https://github.com/mpruett/audiofile/issues/56"
}
],
"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"
}
]
}
GHSA-XHR4-FJFQ-6R46
Vulnerability from github – Published: 2023-10-02 21:30 – Updated: 2025-11-03 21:30Heap-based Buffer Overflow in GitHub repository vim/vim prior to 9.0.1969.
{
"affected": [],
"aliases": [
"CVE-2023-5344"
],
"database_specific": {
"cwe_ids": [
"CWE-122",
"CWE-787"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-10-02T20:15:10Z",
"severity": "MODERATE"
},
"details": "Heap-based Buffer Overflow in GitHub repository vim/vim prior to 9.0.1969.",
"id": "GHSA-xhr4-fjfq-6r46",
"modified": "2025-11-03T21:30:55Z",
"published": "2023-10-02T21:30:17Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-5344"
},
{
"type": "WEB",
"url": "https://github.com/vim/vim/commit/3bd7fa12e146c6051490d048a4acbfba974eeb04"
},
{
"type": "WEB",
"url": "https://huntr.dev/bounties/530cb762-899e-48d7-b50e-dad09eb775bf"
},
{
"type": "WEB",
"url": "https://lists.debian.org/debian-lts-announce/2025/03/msg00023.html"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4W665GQBN6S6ZDMYWVF4X7KMFI7AQKJL"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XPT7NMYJRLBPIALGSE24UWTY6F774GZW"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZOXBUJLJ5VSPN3YXWN7XZA4JDYKNE7GZ"
},
{
"type": "WEB",
"url": "https://support.apple.com/kb/HT214036"
},
{
"type": "WEB",
"url": "https://support.apple.com/kb/HT214037"
},
{
"type": "WEB",
"url": "https://support.apple.com/kb/HT214038"
},
{
"type": "WEB",
"url": "http://seclists.org/fulldisclosure/2023/Dec/10"
},
{
"type": "WEB",
"url": "http://seclists.org/fulldisclosure/2023/Dec/11"
},
{
"type": "WEB",
"url": "http://seclists.org/fulldisclosure/2023/Dec/9"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L",
"type": "CVSS_V3"
}
]
}
GHSA-XHR7-HGF3-H7PR
Vulnerability from github – Published: 2022-05-24 17:10 – Updated: 2023-04-26 21:30fmwlan.c on D-Link DIR-615Jx10 devices has a stack-based buffer overflow via the formWlanSetup_Wizard webpage parameter when f_radius_ip1 is malformed.
{
"affected": [],
"aliases": [
"CVE-2020-9535"
],
"database_specific": {
"cwe_ids": [
"CWE-787"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2020-03-02T00:15:00Z",
"severity": "MODERATE"
},
"details": "fmwlan.c on D-Link DIR-615Jx10 devices has a stack-based buffer overflow via the formWlanSetup_Wizard webpage parameter when f_radius_ip1 is malformed.",
"id": "GHSA-xhr7-hgf3-h7pr",
"modified": "2023-04-26T21:30:30Z",
"published": "2022-05-24T17:10:03Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2020-9535"
},
{
"type": "WEB",
"url": "https://github.com/ladinas/Vulns_of_Embedded_Systems/blob/master/Two%20stack%20overflows%20were%20found%20in%20DIR-615Jx10.0%20Devices.pdf"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-XHR8-9MW2-3MF4
Vulnerability from github – Published: 2026-04-28 15:30 – Updated: 2026-06-30 03:36Memory safety bugs present in Firefox ESR 115.35.0, Firefox ESR 140.10.0, Thunderbird ESR 140.10.0, Firefox 150.0.0 and Thunderbird 150.0.0. Some of these bugs showed evidence of memory corruption and we presume that with enough effort some of these could have been exploited to run arbitrary code. This vulnerability was fixed in Firefox 150.0.1, Firefox ESR 140.10.1, and Firefox ESR 115.35.1.
{
"affected": [],
"aliases": [
"CVE-2026-7322"
],
"database_specific": {
"cwe_ids": [
"CWE-119",
"CWE-787"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-04-28T15:16:37Z",
"severity": "HIGH"
},
"details": "Memory safety bugs present in Firefox ESR 115.35.0, Firefox ESR 140.10.0, Thunderbird ESR 140.10.0, Firefox 150.0.0 and Thunderbird 150.0.0. Some of these bugs showed evidence of memory corruption and we presume that with enough effort some of these could have been exploited to run arbitrary code. This vulnerability was fixed in Firefox 150.0.1, Firefox ESR 140.10.1, and Firefox ESR 115.35.1.",
"id": "GHSA-xhr8-9mw2-3mf4",
"modified": "2026-06-30T03:36:27Z",
"published": "2026-04-28T15:30:52Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-7322"
},
{
"type": "WEB",
"url": "https://www.mozilla.org/security/advisories/mfsa2026-39"
},
{
"type": "WEB",
"url": "https://www.mozilla.org/security/advisories/mfsa2026-38"
},
{
"type": "WEB",
"url": "https://www.mozilla.org/security/advisories/mfsa2026-37"
},
{
"type": "WEB",
"url": "https://www.mozilla.org/security/advisories/mfsa2026-36"
},
{
"type": "WEB",
"url": "https://www.mozilla.org/security/advisories/mfsa2026-35"
},
{
"type": "WEB",
"url": "https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-7322.json"
},
{
"type": "WEB",
"url": "https://bugzilla.redhat.com/show_bug.cgi?id=2463484"
},
{
"type": "WEB",
"url": "https://bugzilla.mozilla.org/buglist.cgi?bug_id=2021904%2C2022731%2C2027158%2C2027733%2C2027973%2C2027976%2C2028231%2C2028731%2C2028886%2C2029067%2C2029700%2C2029724%2C2029806%2C2029814%2C2030108%2C2030111%2C2031524%2C2031921%2C2032040"
},
{
"type": "WEB",
"url": "https://access.redhat.com/security/cve/CVE-2026-7322"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:25014"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:24846"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:24844"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:24721"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:24719"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:24718"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:24717"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:24345"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:22847"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:22712"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:22708"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:22410"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:22409"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:22408"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:22324"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:21743"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:20586"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:19588"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:19370"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:19348"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:19157"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2026:19153"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L",
"type": "CVSS_V3"
}
]
}
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.
No CAPEC attack patterns related to this CWE.