CAPEC-67: String Format Overflow in syslog()
CAPEC版本: 3.9
更新日期: 2023-01-24
攻击模式描述
This attack targets applications and software that uses the syslog() function insecurely. If an application does not explicitely use a format string parameter in a call to syslog(), user input can be placed in the format string parameter leading to a format string injection attack. Adversaries can then inject malicious format string commands into the function call leading to a buffer overflow. There are many reported software vulnerabilities with the root cause being a misuse of the syslog() function.
执行流程
步骤 1 Explore
[Identify target application] The adversary identifies a target application or program to perform the buffer overflow on. In this attack, adversaries look for applications that use syslog() incorrectly.
步骤 2 Experiment
[Find injection vector] The adversary identifies an injection vector to deliver the excessive content to the targeted application's buffer. For each user-controllable input that the adversary suspects is vulnerable to format string injection, attempt to inject formatting characters such as %n, %s, etc.. The goal is to manipulate the string creation using these formatting characters.
- Inject probe payload which contains formatting characters (%s, %d, %n, etc.) through input parameters.
步骤 3 Experiment
[Craft overflow content] The adversary crafts the content to be injected. If the intent is to simply cause the software to crash, the content need only consist of an excessive quantity of random data. If the intent is to leverage the overflow for execution of arbitrary code, the adversary will craft a set of content that not only overflows the targeted buffer but does so in such a way that the overwritten return address is replaced with one of the adversaries' choosing which points to code injected by the adversary.
- The formatting characters %s and %d are useful for observing memory and trying to print memory addresses. If an adversary has access to the log being written to they can observer this output and use it to help craft their attack.
- The formatting character %n is useful for adding extra data onto the buffer.
步骤 4 Exploit
[Overflow the buffer] Using the injection vector, the adversary supplies the program with the crafted format string injection, causing a buffer.
前提条件
- The Syslog function is used without specifying a format string argument, allowing user input to be placed direct into the function call as a format string.
后果影响
影响范围: Confidentiality Integrity Availability
技术影响: Execute Unauthorized Commands
说明: Run Arbitrary Code
影响范围: Availability
技术影响: Unreliable Execution
影响范围: Confidentiality Access Control Authorization
技术影响: Gain Privileges
影响范围: Integrity
技术影响: Modify Data
示例实例
Format string vulnerability in TraceEvent function for ntop before 2.1 allows remote adversaries to execute arbitrary code by causing format strings to be injected into calls to the syslog function, via (1) an HTTP GET request, (2) a user name in HTTP authentication, or (3) a password in HTTP authentication. See also: CVE-2002-0412
分类映射
| 分类名称 | 条目ID | 条目名称 |
|---|---|---|
| WASC | 06 | Format String |