CWE-839: Numeric Range Comparison Without Minimum Check

CWE-839 là gì?

CWE-839 là Numeric Range Comparison Without Minimum Check. Lỗi phát sinh khi the product checks a value to ensure that it is less than or equal to a maximum, but it does not also verify that the value is greater than or equal to the minimum. Hiện có 4 lỗ hổng trong kho dữ liệu liên quan đến CWE-839 và không có lỗ hổng nào nằm trong danh mục khai thác thực tế của CISA.

Thứ hạng OWASP Top 10-
Tổng số CVE liên quan (365 ngày)4
Mức trừu tượngCơ bản
Khả năng khai thác-

Số lượng lỗ hổng nằm trong CWE-839

4 lỗ hổng

Không có dữ liệu

Chưa có dữ liệu về lỗ hổng trong CISA KEV cho CWE-839

Định nghĩa chính thức

TheoMitre CWE

Đặc điểm

Dữ liệu MITRE CWE chính thức

Tên gọi khác

  • Signed comparison — The "signed comparison" term is often used to describe when the product uses a signed variable and checks it to ensure that it is less than a maximum value (typically a maximum buffer size), but does not verify that it is greater than 0.

Giai đoạn hình thành

  • Hiện thực hóa: Some products use signed integers or floats even when their values are only expected to be positive or 0. An input validation check might assume that the value is positive, and only check for the maximum value.

Hậu quả thường gặp

Dữ liệu MITRE CWE chính thức
Tác độngPhạm viDiễn giải
Thay đổi bộ nhớ, Đọc bộ nhớTính bí mật, Tính toàn vẹnIf a negative value is used to access memory, buffers, or other indexable structures, it could access memory outside the bounds of the buffer.
Từ chối dịch vụ: tiêu thụ bộ nhớ, Từ chối dịch vụ: tiêu thụ tài nguyên khácTính sẵn sàngIn some contexts, a negative value could lead to resource consumption, e.g., if the negative value is used for memory allocation.
Thay đổi dữ liệu ứng dụng, Thực thi mã hoặc lệnh trái phépTính toàn vẹn, Tính bí mật, Tính sẵn sàngAn attacker could modify the structure of the message or data being sent to the downstream component, possibly injecting commands.
Thay đổi tùy ngữ cảnh, Trạng thái ngoài dự kiếnTính toàn vẹnThe use of a negative number in a positive-only context could have security implications for other types of resources. For example, a shopping cart might check that the user is not requesting more than 10 items, but a request for -3 items could cause the application to calculate a negative price and credit the attacker's account.

Biện pháp giảm thiểu rủi ro

Dữ liệu MITRE CWE chính thức
  1. Áp đặt quy tắc bằng chuyển đổi · Hiện thực hóaIf the number to be used is always expected to be positive, change the variable type from signed to unsigned or size_t.
  2. Kiểm tra dữ liệu đầu vào · Hiện thực hóaIf the number to be used could have a negative value based on the specification (thus requiring a signed value), but the number should only be positive to preserve code correctness, then include a check to ensure that the value is positive.

Cách phát hiện trong hệ thống

Dữ liệu MITRE CWE chính thức
Phương phápCách làmHiệu quả
Phân tích tĩnh tự độngAutomated 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.)-

Lỗ hổng điển hình

Nguồn (2)

CWE™ Program, operated by The MITRE Corporation. Copyright © 2006–2026, The MITRE Corporation. The MITRE Corporation hereby grants you a non-exclusive, royalty-free license to use CWE for research, development, and commercial purposes. CWE Terms of Use.

Tìm hiểu thêm

Kiểm tra chuyên sâu cùng giải pháp quản lý rủi ro Web toàn diện

Giải pháp CyStack VulnScan liên tục phát hiện tài sản, xác minh lỗ hổng và giúp đội ngũ bảo mật ưu tiên khắc phục cho toàn bộ doanh nghiệp.