CWE-196 - Unsigned to Signed Conversion Error

  • 摘要:Variant
  • 结构:Simple
  • 状态:Draft
  • 发布日期:2006-07-19
  • 更新日期:2025-12-11

名称

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.

Although less frequent an issue than signed-to-unsigned conversion, unsigned-to-signed conversion can be the perfect precursor to dangerous buffer underwrite conditions that allow attackers to move down the stack where they otherwise might not have access in a normal buffer overflow condition. Buffer underwrites occur frequently when large unsigned values are cast to signed values, and then used as indexes into a buffer or for pointer arithmetic.

常见后果

范围:Availability

影响:DoS: Crash, Exit, or Restart

注释:Incorrect sign conversions generally lead to undefined behavior, and therefore crashes.

范围:Integrity

影响:Modify Memory

注释:If a poor cast lead to a buffer overflow or similar condition, data integrity may be affected.

范围:Integrity, Confidentiality, Availability, Access Control

影响:Execute Unauthorized Code or Commands, Bypass Protection Mechanism

注释:Improper signed-to-unsigned conversions without proper checking can sometimes trigger buffer overflows which can be used to execute arbitrary code. This is usually outside the scope of a program's implicit security policy.

相关 CWE