CWE-190
AllowedInteger Overflow or Wraparound
Abstraction: Base · Status: Stable
The product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. This occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may become a very small or negative number.
3870 vulnerabilities reference this CWE, most recent first.
GHSA-3V9M-736C-4X7X
Vulnerability from github – Published: 2023-04-19 21:30 – Updated: 2024-04-04 03:35In PVRSRVBridgeRGXKickTA3D of the PowerVR kernel driver, a missing size check means there is a possible integer overflow that could allow out-of-bounds heap access. This could lead to local escalation of privilege with no additional execution privileges needed. User interaction is not needed for exploitation.Product: AndroidVersions: Android SoCAndroid ID: A-270396792
{
"affected": [],
"aliases": [
"CVE-2021-0880"
],
"database_specific": {
"cwe_ids": [
"CWE-190"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-04-19T20:15:10Z",
"severity": "HIGH"
},
"details": "In PVRSRVBridgeRGXKickTA3D of the PowerVR kernel driver, a missing size check means there is a possible integer overflow that could allow out-of-bounds heap access. This could lead to local escalation of privilege with no additional execution privileges needed. User interaction is not needed for exploitation.Product: AndroidVersions: Android SoCAndroid ID: A-270396792",
"id": "GHSA-3v9m-736c-4x7x",
"modified": "2024-04-04T03:35:33Z",
"published": "2023-04-19T21:30:26Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-0880"
},
{
"type": "WEB",
"url": "https://source.android.com/security/bulletin/2023-04-01"
}
],
"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-3VHP-J7W2-QXHV
Vulnerability from github – Published: 2022-05-14 00:55 – Updated: 2022-05-14 00:55procps-ng before version 3.3.15 is vulnerable to an incorrect integer size in proc/alloc.* leading to truncation/integer overflow issues. This flaw is related to CVE-2018-1124.
{
"affected": [],
"aliases": [
"CVE-2018-1126"
],
"database_specific": {
"cwe_ids": [
"CWE-190"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2018-05-23T13:29:00Z",
"severity": "CRITICAL"
},
"details": "procps-ng before version 3.3.15 is vulnerable to an incorrect integer size in proc/alloc.* leading to truncation/integer overflow issues. This flaw is related to CVE-2018-1124.",
"id": "GHSA-3vhp-j7w2-qxhv",
"modified": "2022-05-14T00:55:30Z",
"published": "2022-05-14T00:55:30Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2018-1126"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2018:1700"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2018:1777"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2018:1820"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2018:2267"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2018:2268"
},
{
"type": "WEB",
"url": "https://access.redhat.com/errata/RHSA-2019:1944"
},
{
"type": "WEB",
"url": "https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-1126"
},
{
"type": "WEB",
"url": "https://help.ecostruxureit.com/display/public/UADCE725/Security+fixes+in+StruxureWare+Data+Center+Expert+v7.6.0"
},
{
"type": "WEB",
"url": "https://lists.debian.org/debian-lts-announce/2018/05/msg00021.html"
},
{
"type": "WEB",
"url": "https://usn.ubuntu.com/3658-1"
},
{
"type": "WEB",
"url": "https://usn.ubuntu.com/3658-2"
},
{
"type": "WEB",
"url": "https://www.debian.org/security/2018/dsa-4208"
},
{
"type": "WEB",
"url": "https://www.qualys.com/2018/05/17/procps-ng-audit-report-advisory.txt"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-security-announce/2019-10/msg00058.html"
},
{
"type": "WEB",
"url": "http://lists.opensuse.org/opensuse-security-announce/2019-10/msg00059.html"
},
{
"type": "WEB",
"url": "http://seclists.org/oss-sec/2018/q2/122"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/104214"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id/1041057"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-3VXF-WG7J-JJ54
Vulnerability from github – Published: 2022-05-24 17:47 – Updated: 2022-05-24 17:47There is a integer overflow in media_tools/av_parsers.c in the hevc_parse_slice_segment function in GPAC 1.0.1 which results in a crash.
{
"affected": [],
"aliases": [
"CVE-2021-30014"
],
"database_specific": {
"cwe_ids": [
"CWE-190"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-04-19T20:15:00Z",
"severity": "MODERATE"
},
"details": "There is a integer overflow in media_tools/av_parsers.c in the hevc_parse_slice_segment function in GPAC 1.0.1 which results in a crash.",
"id": "GHSA-3vxf-wg7j-jj54",
"modified": "2022-05-24T17:47:50Z",
"published": "2022-05-24T17:47:50Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-30014"
},
{
"type": "WEB",
"url": "https://github.com/gpac/gpac/issues/1721"
},
{
"type": "WEB",
"url": "https://github.com/gpac/gpac/commit/51cdb67ff7c5f1242ac58c5aa603ceaf1793b788"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-3W5G-989P-35R8
Vulnerability from github – Published: 2022-08-10 00:00 – Updated: 2026-03-06 22:40It is possible to crash (panic) an application by providing a corrupted data to be read. This issue affects Rust applications using Apache Avro Rust SDK prior to 0.14.0 (previously known as avro-rs). Users should update to apache-avro version 0.14.0 which addresses this issue.
{
"affected": [
{
"package": {
"ecosystem": "crates.io",
"name": "apache-avro"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.14.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2022-36125"
],
"database_specific": {
"cwe_ids": [
"CWE-190",
"CWE-20"
],
"github_reviewed": true,
"github_reviewed_at": "2022-08-18T19:14:55Z",
"nvd_published_at": "2022-08-09T07:15:00Z",
"severity": "HIGH"
},
"details": "It is possible to crash (panic) an application by providing a corrupted data to be read. This issue affects Rust applications using Apache Avro Rust SDK prior to 0.14.0 (previously known as avro-rs). Users should update to apache-avro version 0.14.0 which addresses this issue.",
"id": "GHSA-3w5g-989p-35r8",
"modified": "2026-03-06T22:40:31Z",
"published": "2022-08-10T00:00:31Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-36125"
},
{
"type": "PACKAGE",
"url": "https://github.com/a0x8o/avro"
},
{
"type": "WEB",
"url": "https://lists.apache.org/thread/t1r5xz0pvhm4tosqopjpj6dz8zlsht07"
}
],
"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"
}
],
"summary": "Apache Avro Rust SDK corrupted data read can cause crash"
}
GHSA-3W5P-95MH-GQ75
Vulnerability from github – Published: 2026-06-18 13:05 – Updated: 2026-06-18 13:05Impact
A denial-of-service (DoS) vulnerability exists in the factorial operator implementation of NCalc. Specially crafted expressions containing extremely large factorial operands can trigger excessive CPU consumption or cause evaluation to enter a non-terminating loop due to integer overflow in the factorial calculation logic.
Applications that evaluate untrusted expressions using affected versions of NCalc may be vulnerable to resource exhaustion, potentially resulting in service disruption or application unresponsiveness.
This issue can be triggered with expressions such as:
99999999999999!
9223372036854775807!
1.5e16!
Patches
The vulnerability has been fixed by adding bounds validation for factorial operands and rejecting unsupported values before evaluation.
Users should upgrade to the first release containing the fix from pull request #575. (v6.1.1+)
Workarounds
If upgrading is not immediately possible:
- Do not evaluate expressions originating from untrusted users.
- Validate or sanitize expressions before evaluation and reject factorial operations on large values.
- Implement execution time limits, request timeouts, or cancellation mechanisms around expression evaluation.
These mitigations may reduce exposure but do not fully address the underlying vulnerability.
{
"affected": [
{
"package": {
"ecosystem": "NuGet",
"name": "NCalc.Core"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "6.1.1"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "NCalcSync"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "6.1.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-55254"
],
"database_specific": {
"cwe_ids": [
"CWE-190",
"CWE-770"
],
"github_reviewed": true,
"github_reviewed_at": "2026-06-18T13:05:37Z",
"nvd_published_at": null,
"severity": "MODERATE"
},
"details": "### Impact\n\nA denial-of-service (DoS) vulnerability exists in the factorial operator implementation of NCalc. Specially crafted expressions containing extremely large factorial operands can trigger excessive CPU consumption or cause evaluation to enter a non-terminating loop due to integer overflow in the factorial calculation logic.\n\nApplications that evaluate untrusted expressions using affected versions of NCalc may be vulnerable to resource exhaustion, potentially resulting in service disruption or application unresponsiveness.\n\nThis issue can be triggered with expressions such as:\n\n```text\n99999999999999!\n9223372036854775807!\n1.5e16!\n```\n\n### Patches\n\nThe vulnerability has been fixed by adding bounds validation for factorial operands and rejecting unsupported values before evaluation.\n\nUsers should upgrade to the first release containing the fix from pull request #575. (**v6.1.1+**)\n\n### Workarounds\n\nIf upgrading is not immediately possible:\n\n* Do not evaluate expressions originating from untrusted users.\n* Validate or sanitize expressions before evaluation and reject factorial operations on large values.\n* Implement execution time limits, request timeouts, or cancellation mechanisms around expression evaluation.\n\nThese mitigations may reduce exposure but do not fully address the underlying vulnerability.",
"id": "GHSA-3w5p-95mh-gq75",
"modified": "2026-06-18T13:05:37Z",
"published": "2026-06-18T13:05:37Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/ncalc/ncalc/security/advisories/GHSA-3w5p-95mh-gq75"
},
{
"type": "WEB",
"url": "https://github.com/ncalc/ncalc/pull/575"
},
{
"type": "PACKAGE",
"url": "https://github.com/ncalc/ncalc"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:A/AC:H/PR:N/UI:R/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
],
"summary": "NCalc: Denial of Service via Unbounded and Non-Terminating Factorial Evaluation"
}
GHSA-3W9R-2MQJ-CF5C
Vulnerability from github – Published: 2023-08-11 15:30 – Updated: 2024-04-04 06:53Integer Overflow vulnerability in qsvghandler.cpp in Qt qtsvg versions 5.15.1, 6.0.0, 6.0.2, and 6.2, allows local attackers to cause a denial of service (DoS).
{
"affected": [],
"aliases": [
"CVE-2021-28025"
],
"database_specific": {
"cwe_ids": [
"CWE-190"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-08-11T14:15:12Z",
"severity": "MODERATE"
},
"details": "Integer Overflow vulnerability in qsvghandler.cpp in Qt qtsvg versions 5.15.1, 6.0.0, 6.0.2, and 6.2, allows local attackers to cause a denial of service (DoS).",
"id": "GHSA-3w9r-2mqj-cf5c",
"modified": "2024-04-04T06:53:21Z",
"published": "2023-08-11T15:30:46Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-28025"
},
{
"type": "WEB",
"url": "https://bugreports.qt.io/browse/QTBUG-91507"
}
],
"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-3WHP-4394-49GC
Vulnerability from github – Published: 2024-02-27 21:31 – Updated: 2024-04-10 21:30In the Linux kernel, the following vulnerability has been resolved:
tools/power turbostat: Fix offset overflow issue in index converting
The idx_to_offset() function returns type int (32-bit signed), but MSR_PKG_ENERGY_STAT is u32 and would be interpreted as a negative number. The end result is that it hits the if (offset < 0) check in update_msr_sum() which prevents the timer callback from updating the stat in the background when long durations are used. The similar issue exists in offset_to_idx() and update_msr_sum(). Fix this issue by converting the 'int' to 'off_t' accordingly.
{
"affected": [],
"aliases": [
"CVE-2021-46940"
],
"database_specific": {
"cwe_ids": [
"CWE-190"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-02-27T19:04:05Z",
"severity": "MODERATE"
},
"details": "In the Linux kernel, the following vulnerability has been resolved:\n\ntools/power turbostat: Fix offset overflow issue in index converting\n\nThe idx_to_offset() function returns type int (32-bit signed), but\nMSR_PKG_ENERGY_STAT is u32 and would be interpreted as a negative number.\nThe end result is that it hits the if (offset \u003c 0) check in update_msr_sum()\nwhich prevents the timer callback from updating the stat in the background when\nlong durations are used. The similar issue exists in offset_to_idx() and\nupdate_msr_sum(). Fix this issue by converting the \u0027int\u0027 to \u0027off_t\u0027 accordingly.",
"id": "GHSA-3whp-4394-49gc",
"modified": "2024-04-10T21:30:28Z",
"published": "2024-02-27T21:31:26Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-46940"
},
{
"type": "WEB",
"url": "https://git.kernel.org/stable/c/13a779de4175df602366d129e41782ad7168cef0"
},
{
"type": "WEB",
"url": "https://git.kernel.org/stable/c/337b1546cde87fb8588ddaedf0201b769baa572a"
},
{
"type": "WEB",
"url": "https://git.kernel.org/stable/c/dbdf22fc825fdb1d97f23230064e0f9819471628"
},
{
"type": "WEB",
"url": "https://git.kernel.org/stable/c/ea6803ff2cd1a2d7d880256bf562172b708a76ff"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-3WMC-FG6P-FQ4V
Vulnerability from github – Published: 2022-05-24 17:20 – Updated: 2025-09-30 15:30The Treck TCP/IP stack before 6.0.1.66 has an Integer Overflow during Memory Allocation that causes an Out-of-Bounds Write.
{
"affected": [],
"aliases": [
"CVE-2020-11904"
],
"database_specific": {
"cwe_ids": [
"CWE-190"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2020-06-17T11:15:00Z",
"severity": "HIGH"
},
"details": "The Treck TCP/IP stack before 6.0.1.66 has an Integer Overflow during Memory Allocation that causes an Out-of-Bounds Write.",
"id": "GHSA-3wmc-fg6p-fq4v",
"modified": "2025-09-30T15:30:26Z",
"published": "2022-05-24T17:20:44Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2020-11904"
},
{
"type": "WEB",
"url": "https://jsof-tech.com/vulnerability-disclosure-policy"
},
{
"type": "WEB",
"url": "https://security.netapp.com/advisory/ntap-20200625-0006"
},
{
"type": "WEB",
"url": "https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-treck-ip-stack-JyBQ5GyC"
},
{
"type": "WEB",
"url": "https://www.dell.com/support/article/de-de/sln321836/dell-response-to-the-ripple20-vulnerabilities"
},
{
"type": "WEB",
"url": "https://www.jsof-tech.com/ripple20"
},
{
"type": "WEB",
"url": "https://www.kb.cert.org/vuls/id/257161"
},
{
"type": "WEB",
"url": "https://www.treck.com"
},
{
"type": "WEB",
"url": "http://www.arubanetworks.com/assets/alert/ARUBA-PSA-2020-006.txt"
}
],
"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"
}
]
}
GHSA-3WP5-CVP4-5H42
Vulnerability from github – Published: 2022-05-24 19:17 – Updated: 2022-05-24 19:17The gmp plugin in strongSwan before 5.9.4 has a remote integer overflow via a crafted certificate with an RSASSA-PSS signature. For example, this can be triggered by an unrelated self-signed CA certificate sent by an initiator. Remote code execution cannot occur.
{
"affected": [],
"aliases": [
"CVE-2021-41990"
],
"database_specific": {
"cwe_ids": [
"CWE-190"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-10-18T14:15:00Z",
"severity": "HIGH"
},
"details": "The gmp plugin in strongSwan before 5.9.4 has a remote integer overflow via a crafted certificate with an RSASSA-PSS signature. For example, this can be triggered by an unrelated self-signed CA certificate sent by an initiator. Remote code execution cannot occur.",
"id": "GHSA-3wp5-cvp4-5h42",
"modified": "2022-05-24T19:17:46Z",
"published": "2022-05-24T19:17:46Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-41990"
},
{
"type": "WEB",
"url": "https://cert-portal.siemens.com/productcert/pdf/ssa-539476.pdf"
},
{
"type": "WEB",
"url": "https://github.com/strongswan/strongswan/releases/tag/5.9.4"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/5FJSATD2R2XHTG4P63GCMQ2N7EWKMME5"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WQSQ3BEC22NF4NCDZVCT4P3Q2ZIAJXGJ"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/Y3TQ32JLJOBJDB2EJKSX2PBPB5NFG2D4"
},
{
"type": "WEB",
"url": "https://www.debian.org/security/2021/dsa-4989"
},
{
"type": "WEB",
"url": "https://www.strongswan.org/blog/2021/10/18/strongswan-vulnerability-(cve-2021-41990).html"
}
],
"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-3WRX-WQWJ-82VX
Vulnerability from github – Published: 2022-05-17 02:37 – Updated: 2025-04-12 13:07Multiple integer overflows in X.org libXrandr before 1.5.1 allow remote X servers to trigger out-of-bounds write operations via a crafted response.
{
"affected": [],
"aliases": [
"CVE-2016-7947"
],
"database_specific": {
"cwe_ids": [
"CWE-190",
"CWE-787"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2016-12-13T20:59:00Z",
"severity": "CRITICAL"
},
"details": "Multiple integer overflows in X.org libXrandr before 1.5.1 allow remote X servers to trigger out-of-bounds write operations via a crafted response.",
"id": "GHSA-3wrx-wqwj-82vx",
"modified": "2025-04-12T13:07:18Z",
"published": "2022-05-17T02:37:03Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2016-7947"
},
{
"type": "WEB",
"url": "https://cgit.freedesktop.org/xorg/lib/libXrandr/commit/?id=a0df3e1c7728205e5c7650b2e6dce684139254a6"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/74FFOHWYIKQZTJLRJWDMJ4W3WYBELUUG"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/Y7662OZWCSTLRPKS6R3E4Y4M26BSVAAM"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/74FFOHWYIKQZTJLRJWDMJ4W3WYBELUUG"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/Y7662OZWCSTLRPKS6R3E4Y4M26BSVAAM"
},
{
"type": "WEB",
"url": "https://lists.x.org/archives/xorg-announce/2016-October/002720.html"
},
{
"type": "WEB",
"url": "https://security.gentoo.org/glsa/201704-03"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2016/10/04/2"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2016/10/04/4"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/93365"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id/1036945"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
Mitigation
Ensure that all protocols are strictly defined, such that all out-of-bounds behavior can be identified simply, and require strict conformance to the protocol.
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.
- If possible, choose a language or compiler that performs automatic bounds checking.
Mitigation MIT-4
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 [REF-1482].
- Use libraries or frameworks that make it easier to handle numbers without unexpected consequences.
- Examples include safe integer handling packages such as SafeInt (C++) or IntegerLib (C or C++). [REF-106]
Mitigation MIT-8
Strategy: Input Validation
- Perform input validation on any numeric input by ensuring that it is within the expected range. Enforce that the input meets both the minimum and maximum requirements for the expected range.
- Use unsigned integers where possible. This makes it easier to perform validation for integer overflows. When signed integers are required, ensure that the range check includes minimum values as well as maximum values.
Mitigation MIT-36
- Understand the programming language's underlying representation and how it interacts with numeric calculation (CWE-681). Pay close attention to byte size discrepancies, precision, signed/unsigned distinctions, truncation, conversion and casting between types, "not-a-number" calculations, and how the language handles numbers that are too large or too small for its underlying representation. [REF-7]
- Also be careful to account for 32-bit, 64-bit, and other potential differences that may affect the numeric representation.
Mitigation MIT-15
For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
Mitigation MIT-26
Strategy: Compilation or Build Hardening
Examine compiler warnings closely and eliminate problems with potential security implications, such as signed / unsigned mismatch in memory operations, or use of uninitialized variables. Even if the weakness is rarely exploitable, a single failure may lead to the compromise of the entire system.
CAPEC-92: Forced Integer Overflow
This attack forces an integer variable to go out of range. The integer variable is often used as an offset such as size of memory allocation or similarly. The attacker would typically control the value of such variable and try to get it out of range. For instance the integer in question is incremented past the maximum possible value, it may wrap to become a very small, or negative number, therefore providing a very incorrect value which can lead to unexpected behavior. At worst the attacker can execute arbitrary code.