CAPEC-52: Embedding NULL Bytes

Detailed Draft 严重程度: High 攻击可能性: High

CAPEC版本: 3.9

更新日期: 2023-01-24

攻击模式描述

An adversary embeds one or more null bytes in input to the target software. This attack relies on the usage of a null-valued byte as a string terminator in many environments. The goal is for certain components of the target software to stop processing the input when it encounters the null byte(s).

执行流程

步骤 1 Explore

[Survey the application for user-controllable inputs] Using a browser, an automated tool or by inspecting the application, an adversary records all entry points to the application.

技术:
  • Use a spidering tool to follow and record all links and analyze the web pages to find entry points. Make special note of any links that include parameters in the URL.
  • Use a proxy tool to record all user input entry points visited during a manual traversal of the web application.
  • Use a browser to manually explore the website and analyze how it is constructed. Many browsers' plugins are available to facilitate the analysis or automate the discovery.
  • Manually inspect the application to find entry points.
步骤 2 Experiment

[Probe entry points to locate vulnerabilities] The adversary uses the entry points gathered in the "Explore" phase as a target list and injects postfix null byte(s) to observe how the application handles them as input. The adversary is looking for areas where user input is placed in the middle of a string, and the null byte causes the application to stop processing the string at the end of the user input.

技术:
  • Try different encodings for null such as \0 or %00
步骤 3 Exploit

[Remove data after null byte(s)] After determined entry points that are vulnerable, the adversary places a null byte(s) such that they remove data after the null byte(s) in a way that is beneficial to them.

技术:
  • If the input is a directory as part of a longer file path, add a null byte(s) at the end of the input to try to traverse to the given directory.

前提条件

  • The program does not properly handle postfix NULL terminators

所需技能

Medium Directory traversal
High Execution of arbitrary code

后果影响

影响范围: Integrity

技术影响: Modify Data

影响范围: Confidentiality

技术影响: Read Data

影响范围: Confidentiality Access Control Authorization

技术影响: Gain Privileges

影响范围: Confidentiality Integrity Availability

技术影响: Execute Unauthorized Commands

说明: Run Arbitrary Code

缓解措施

Properly handle the NULL characters supplied as part of user input prior to doing anything with the data.

示例实例

See also: CVE-2004-0629

分类映射

分类名称 条目ID 条目名称
WASC 28 Null Byte Injection
OWASP Attacks - Embedding Null Code
关键信息

CAPEC ID: CAPEC-52

抽象级别: Detailed

状态: Draft

典型严重程度: High

攻击可能性: High

相关攻击模式