Detalle CWE-1389

CWE-1389

Incorrect Parsing of Numbers with Different Radices
Incomplete
2022-10-13
00h00 +00:00
2025-12-11
00h00 +00:00
Notificaciones para un CWE
Manténgase informado sobre cualquier cambio en un CWE específico.
Gestionar notificaciones

Nombre: Incorrect Parsing of Numbers with Different Radices

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

Informaciones generales

Modos de introducción

Implementation : Input validation used may assume decimal bases during conditional checks, when it may not always be the case.
Implementation : The application may rely on a service that supports different numerical bases.

Plataformas aplicables

Lenguaje

Class: Not Language-Specific (Undetermined)

Tecnologías

Class: Not Technology-Specific (Undetermined)

Consecuencias comunes

Alcance Impacto Probabilidad
ConfidentialityRead Application Data

Note: An attacker may use an unexpected numerical base to access private application resources.
Unknown
IntegrityBypass Protection Mechanism, Alter Execution Logic

Note: An attacker may use an unexpected numerical base to bypass or manipulate access control mechanisms.
Unknown

Ejemplos observados

Referencias Descripción

CVE-2021-29662

Chain: Use of zero-prepended IP addresses in Perl-based IP validation module can lead to an access control bypass.

CVE-2021-28918

Chain: Use of zero-prepended IP addresses in a product that manages IP blocks can lead to an SSRF.

CVE-2021-29921

Chain: Use of zero-prepended IP addresses in a Python standard library package can lead to an SSRF.

CVE-2021-29923

Chain: Use of zero-prepended IP addresses in the net Golang library can lead to an access control bypass.

CVE-2021-29424

Chain: Use of zero-prepended IP addresses in Perl netmask module allows bypass of IP-based access control.

CVE-2016-4029

Chain: incorrect validation of intended decimal-based IP address format (CWE-1286) enables parsing of octal or hexadecimal formats (CWE-1389), allowing bypass of an SSRF protection mechanism (CWE-918).

CVE-2020-13776

Mishandling of hex-valued usernames leads to unexpected decimal conversion and privilege escalation in the systemd Linux suite.

Mitigaciones potenciales

Phases : 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.
Phases : 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.
Phases : 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.

Métodos de detección

Automated Static Analysis

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

Notas de mapeo de vulnerabilidades

Justificación : This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.
Comentario : Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.

Referencias

REF-1284

Universal "netmask" npm package, used by 270,000+ projects, vulnerable to octal input data
Sick Codes.
https://sick.codes/universal-netmask-npm-package-used-by-270000-projects-vulnerable-to-octal-input-data-server-side-request-forgery-remote-file-inclusion-local-file-inclusion-and-more-cve-2021-28918/

Envío

Nombre Organización Fecha Fecha de lanzamiento Version
Anonymous External Contributor 2021-05-28 +00:00 2022-10-13 +00:00 4.9

Modificaciones

Nombre Organización Fecha Comentario
CWE Content Team MITRE 2023-04-27 +00:00 updated Relationships, Time_of_Introduction
CWE Content Team MITRE 2023-06-29 +00:00 updated Mapping_Notes
CWE Content Team MITRE 2025-12-11 +00:00 updated Detection_Factors, Weakness_Ordinalities