CWE-252: Unchecked Return Value

CWE-252 là gì?

CWE-252 là Unchecked Return Value. Lỗi phát sinh khi the product does not check the return value from a method or function.

THỨ HẠNG OWASP TOP 10:202510 — A10:2025 — Mishandling of Exceptional Conditions
Tổng số CVE liên quan (365 ngày)-
Mức trừu tượngCơ bản
Khả năng khai thácThấp

Không có dữ liệu

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

Không có dữ liệu

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

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

TheoMitre CWE

Đặc điểm

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

Giai đoạn hình thành

  • Hiện thực hóa: Two common programmer assumptions are "this function call can never fail" and "it doesn't matter if this function call fails". If an attacker can force the function to fail or otherwise return a value that is not expected, then the subsequent program logic could lead to a vulnerability.

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

Dữ liệu MITRE CWE chính thức
Tác độngPhạm viDiễn giải
Trạng thái ngoài dự kiến, Thay đổi tùy ngữ cảnh, Từ chối dịch vụ: sập, thoát hoặc khởi động lạiTính sẵn sàng, Tính toàn vẹnThe product could be prevented from detecting unexpected states and conditions, placing the product into a state that could lead to a crash or other unintended behaviors.
Vượt qua cơ chế bảo vệKiểm soát truy cậpIf the method/function is used for a protection mechanism, then an unchecked return value could prevent the code from being able to see if the protection mechanism fails. For example, if the program calls a function to drop privileges but does not check the return code to ensure that privileges were successfully dropped, then the program will continue to operate with the higher privileges.

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

Dữ liệu MITRE CWE chính thức
  1. Hiện thực hóa · Hiệu quả: CaoCheck the results of all functions that return a value and verify that the value is expected.Checking the return value of the function will typically be sufficient, however beware of race conditions (CWE-362) in a concurrent environment.
  2. Hiện thực hóaFor any pointers that could have been modified or provided from a function that can return NULL, check the pointer for NULL before use. When working with a multithreaded or otherwise asynchronous environment, ensure that proper locking APIs are used to lock before the check, and unlock when it has finished [REF-1484].
  3. Hiện thực hóaEnsure that you account for all possible return values from the function.
  4. Hiện thực hóaWhen designing a function, make sure you return a value or throw an exception in case of an error.

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.)Cao

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

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

Dưới đây là các lỗ hổng tiêu biểu liên quan đến CWE-252, dựa theo mức độ ưu tiên

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.