Chi tiết CWE-1389

CWE-1389

Incorrect Parsing of Numbers with Different Radices
2022-10-13
00h00 +00:00
Incomplete
2026-10-28
00h00 +00:00
Thông báo cho một CWE
Luôn được thông báo về mọi thay đổi đối với một CWE cụ thể.
Quản lý thông báo

Tên: 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).

Thông tin chung

Chi tiết nền tảng

Các cách xuất hiệ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.

Nền tảng áp dụng

Ngôn ngữ

Lớp: Not Language-Specific (Undetermined)
Tên: Python (Undetermined)

Công nghệ

Lớp: Not Technology-Specific (Undetermined)

Hậu quả phổ biến

Phạm vi Tác động Khả năng xảy ra
ConfidentialityRead Application Data

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

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

Ví dụ đã quan sát

Tài liệu tham khảo Mô tả

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.

Các biện pháp giảm thiểu tiềm năng

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.

Phương pháp phát hiệ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.)

Ghi chú ánh xạ lỗ hổng

Lý do : 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.
Bình luận : 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.

Tài liệu tham khảo

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/

Gửi

Tên Tổ chức Ngày Ngày phát hành Version
Anonymous External Contributor 2021-05-28 +00:00 2022-10-13 +00:00 4.9

Sửa đổi

Tên Tổ chức Ngày Bình luận
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
CWE Content Team MITRE 2026-10-28 +00:00 updated Applicable_Platforms, Background_Details, Demonstrative_Examples, Description