背景詳情
引入方式
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)
常見後果
| 範圍 |
影響 |
可能性 |
| Confidentiality | Read Application Data
注意:An attacker may use an unexpected numerical base to access private application resources. | Unknown |
| Integrity | Bypass Protection Mechanism, Alter Execution Logic
注意:An attacker may use an unexpected numerical base to bypass or manipulate access control mechanisms. | Unknown |
觀察到的案例
| 參考資料 |
描述 |
| Chain: Use of zero-prepended IP addresses in Perl-based IP validation module can lead to an access control bypass. |
| Chain: Use of zero-prepended IP addresses in a product that manages IP blocks can lead to an SSRF. |
| Chain: Use of zero-prepended IP addresses in a Python standard library package can lead to an SSRF. |
| Chain: Use of zero-prepended IP addresses in the net Golang library can lead to an access control bypass. |
| Chain: Use of zero-prepended IP addresses in Perl netmask module allows bypass of IP-based access control. |
| 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). |
| 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 |