CAPEC-92

Forced Integer Overflow
2014-06-23
00h00 +00:00
Cao
Cao
Draft
2022-09-29
00h00 +00:00
Cảnh báo cho một CAPEC
Luôn được thông báo về mọi thay đổi đối với một CAPEC cụ thể.
Quản lý thông báo

Mô tả CAPEC

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.

Thông tin CAPEC

Luồng thực thi

1) Explore

The first step is exploratory meaning the attacker looks for an integer variable that they can control.

2) Experiment

The attacker finds an integer variable that they can write into or manipulate and try to get the value of the integer out of the possible range.

3) Exploit

The integer variable is forced to have a value out of range which set its final value to an unexpected value.

4) Exploit

The target host acts on the data and unexpected behavior may happen.

Điều kiện tiên quyết

The attacker can manipulate the value of an integer variable utilized by the target host.
The target host does not do proper range checking on the variable before utilizing it.
When the integer variable is incremented or decremented to an out of range value, it gets a very different value (e.g. very small or negative number)

Kỹ năng cần thiết

An attacker can simply overflow an integer by inserting an out of range value.
Exploiting a buffer overflow by injecting malicious code into the stack of a software system or even the heap can require a higher skill level.

Các biện pháp giảm thiểu

Use a language or compiler that performs automatic bounds checking.
Carefully review the service's implementation before making it available to user. For instance you can use manual or automated code review to uncover vulnerabilities such as integer overflow.
Use an abstraction library to abstract away risky APIs. Not a complete solution.
Always do bound checking before consuming user input data.

Điểm yếu liên quan

CWE-ID Tên điểm yếu

CWE-190

Integer Overflow or Wraparound
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.

CWE-128

Wrap-around Error
Wrap around errors occur whenever a value is incremented past the maximum value for its type and therefore "wraps around" to a very small, negative, or undefined value.

CWE-120

Buffer Copy without Checking Size of Input
The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer.

CWE-122

Heap-based Buffer Overflow
The product writes past the end of a buffer that was allocated on the heap.

CWE-196

Unsigned to Signed Conversion Error
The product uses an unsigned primitive and performs a cast to a signed primitive, which can produce an unexpected value if the value of the unsigned primitive can not be represented using a signed primitive.

CWE-680

Integer Overflow to Buffer Overflow
The product performs a calculation to determine how much memory to allocate, but an integer overflow can occur that causes less memory to be allocated than expected, leading to a buffer overflow.

CWE-697

Incorrect Comparison
The product compares two entities in a security-relevant context, but the comparison is incorrect.

Tài liệu tham khảo

REF-131

Building Secure Software
J. Viega, G. McGraw.

REF-547

SAMATE - Software Assurance Metrics And Tool Evaluation
Robert C. Seacord.
http://samate.nist.gov/SRD/view_testcase.php?tID=1511

REF-548

Secure Coding in C and C++
Robert C. Seacord.

Gửi

Tên Tổ chức Ngày Ngày phát hành
CAPEC Content Team The MITRE Corporation 2014-06-23 +00:00

Sửa đổi

Tên Tổ chức Ngày Bình luận
CAPEC Content Team The MITRE Corporation 2018-07-31 +00:00 Updated References
CAPEC Content Team The MITRE Corporation 2020-07-30 +00:00 Updated Example_Instances, Execution_Flow
CAPEC Content Team The MITRE Corporation 2020-12-17 +00:00 Updated Mitigations, References, Taxonomy_Mappings
CAPEC Content Team The MITRE Corporation 2022-09-29 +00:00 Updated Example_Instances