| 名称 |
Embedding NULL Bytes |
|
|
| 摘要 |
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). |
| 前置条件 |
The program does not properly handle postfix NULL terminators |
| 执行流程 |
| 步骤 |
阶段 |
描述 |
技术手法 |
| 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.
|
|
| 解决方案 | Properly handle the NULL characters supplied as part of user input prior to doing anything with the data. |
| 关联弱点 |
|
CWE 编号
|
描述
|
| CWE-20 |
Improper Input Validation |
| CWE-74 |
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') |
| CWE-158 |
Improper Neutralization of Null Byte or NUL Character |
| CWE-172 |
Encoding Error |
| CWE-173 |
Improper Handling of Alternate Encoding |
| CWE-697 |
Incorrect Comparison |
| CWE-707 |
Improper Neutralization |
|
| 关联 CAPEC |
|
CAPEC 编号
|
描述
|
| CAPEC-267 |
An adversary leverages the possibility to encode potentially harmful input or content used by applications such that the applications are ineffective at validating this encoding standard. |
|
| 分类体系:WASC |
|
条目编号
|
条目名称
|
| 28 |
Null Byte Injection |
|
| 分类体系:OWASP Attacks |
|
条目编号
|
条目名称
|
| Link |
Embedding Null Code |
|