CWE-1389 詳細

CWE-1389

Incorrect Parsing of Numbers with Different Radices
2022-10-13
00h00 +00:00
Incomplete
2026-10-28
00h00 +00:00
特定のCWEの通知
特定のCWEの変更情報をいち早くお届けします。
通知を管理する

名前: 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).

一般情報

背景の詳細

導入モード

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.

適用可能なプラットフォーム

言語

クラス: Not Language-Specific (Undetermined)
名前: Python (Undetermined)

テクノロジー

クラス: Not Technology-Specific (Undetermined)

一般的な結果

スコープ 影響 可能性
ConfidentialityRead Application Data

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

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

観察された例

参考文献 説明

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.

潜在的な緩和策

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.

検出方法

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

脆弱性マッピングノート

理由 : 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.
コメント : 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.

参考文献

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/

登録情報

名前 組織 日付 リリース日 Version
Anonymous External Contributor 2021-05-28 +00:00 2022-10-13 +00:00 4.9

変更履歴

名前 組織 日付 コメント
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