BaseIncomplete

CWE-1389Incorrect Parsing of Numbers with Different Radices

Category: other

Description

The product parses numeric input assuming base 10 (decimal) values, but it does not account for inputs that use a different base number (radix).

Common consequences· 2

  • Confidentiality — Read Application Data
    An attacker may use an unexpected numerical base to access private application resources.
  • Integrity — Bypass Protection Mechanism, Alter Execution Logic
    An attacker may use an unexpected numerical base to bypass or manipulate access control mechanisms.

Potential mitigations· 3

  • [Implementation]If only decimal-based values are expected in the application, conditional checks should be created in a way that prevent octal or hexadecimal strings from being checked. This can be achieved by converting any numerical string to an explicit base-10 integer prior to the conditional check, to prevent octal or hex values from ever being checked against the condition.
  • [Implementation]If various numerical bases do need to be supported, check for leading values indicating the non-decimal base you wish to support (such as 0x for hex) and convert the numeric strings to integers of the respective base. Reject any other alternative-base string that is not intentionally supported by the application.
  • [Implementation]If regular expressions are used to validate IP addresses, ensure that they are bounded using ^ and $ to prevent base-prepended IP addresses from being matched.

References

  1. https://cwe.mitre.org/data/definitions/1389.html

Related by meaning· 6

Nearest entities by semantic similarity across the cs-graph corpus.

CWE
Improper Validation of Specified Type of Input
CWE
Improper Handling of Unexpected Data Type
CWE
Improper Validation of Syntactic Correctness of Input
CWE
Improper Handling of Unicode Encoding
CWE
Improper Input Validation
CWE
Improper Handling of Extra Values
Sourced from MITRE CWE 4.20. Curated for EU compliance use cases by Adam Lundqvist, Founder at SQUR.