---
title: "CAPEC-67: String Format Overflow in syslog()"
url: https://radicalnotion.ai/capec/capec-67
type: capec
description: "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."
updated: 2026-06-01
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CAPEC-67: String Format Overflow in syslog()

- **Abstraction:** Detailed
- **Status:** Draft
- **Typical severity:** Very High
- **Likelihood of attack:** High
- **CAPEC catalog version:** 3.9

## Description

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.

## Execution flow

### Step 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.

### Step 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.

### Step 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.

### Step 4: Exploit

\[Overflow the buffer\] Using the injection vector, the adversary supplies the program with the crafted format string injection, causing a buffer.

## Prerequisites

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

## Consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality, Integrity, Availability | Execute Unauthorized Commands | Run Arbitrary Code |
| Availability | Unreliable Execution | - |
| Confidentiality, Access Control, Authorization | Gain Privileges | - |
| Integrity | Modify Data | - |

## Mitigations

- The code should be reviewed for misuse of the Syslog function call. Manual or automated code review can be used. The reviewer needs to ensure that all format string functions are passed a static string which cannot be controlled by the user and that the proper number of arguments are always sent to that function as well. If at all possible, do not use the %n operator in format strings. The following code shows a correct usage of Syslog(): syslog(LOG\_ERR, "%s", cmdBuf); The following code shows a vulnerable usage of Syslog(): syslog(LOG\_ERR, cmdBuf); // the buffer cmdBuff is taking user supplied data.

## Example instances

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

## Related weaknesses (CWE)

- [CWE-20](https://radicalnotion.ai/cwe/cwe-20): Improper Input Validation
- [CWE-74](https://radicalnotion.ai/cwe/cwe-74): Improper Neutralization of Special Elements in Output Used by a Downstream Component
- [CWE-120](https://radicalnotion.ai/cwe/cwe-120): Buffer Copy without Checking Size of Input
- [CWE-134](https://radicalnotion.ai/cwe/cwe-134): Use of Externally-Controlled Format String
- [CWE-680](https://radicalnotion.ai/cwe/cwe-680): Integer Overflow to Buffer Overflow
- [CWE-697](https://radicalnotion.ai/cwe/cwe-697): Incorrect Comparison

## Related attack patterns

| Relationship | CAPEC | Name |
| --- | --- | --- |
| Parent | [CAPEC-100](https://radicalnotion.ai/capec/capec-100) | Overflow Buffers |
| Parent | [CAPEC-135](https://radicalnotion.ai/capec/capec-135) | Format String Injection |
| Related | [CAPEC-69](https://radicalnotion.ai/capec/capec-69) | Target Programs with Elevated Privileges |

## Taxonomy mappings

| Taxonomy | Entry | Id |
| --- | --- | --- |
| WASC | Format String | 06 |

## Frequently asked questions

### What is CAPEC-67?

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.

### How does a String Format Overflow in syslog() attack work?

It typically unfolds over 4 phases. It begins with: \[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.

### How do you prevent CAPEC-67?

The code should be reviewed for misuse of the Syslog function call. Manual or automated code review can be used. The reviewer needs to ensure that all format string functions are passed a static string which cannot be controlled by the user and that the proper number of arguments are always sent to that function as well. If at all possible, do not use the %n operator in format strings. The following code shows a correct usage of Syslog(): syslog(LOG\_ERR, "%s", cmdBuf); The following code shows a vulnerable usage of Syslog(): syslog(LOG\_ERR, cmdBuf); // the buffer cmdBuff is taking user supplied data.

### What weaknesses does CAPEC-67 target?

CAPEC-67 exploits 6 CWE weaknesses, including CWE-20 (Improper Input Validation), CWE-74 (Improper Neutralization of Special Elements in Output Used by a Downstream Component), CWE-120 (Buffer Copy without Checking Size of Input) and CWE-134 (Use of Externally-Controlled Format String).

### How severe is CAPEC-67?

MITRE rates CAPEC-67 as Very High severity with high likelihood of attack.

Primary source: [MITRE CAPEC](https://capec.mitre.org/data/definitions/67.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/capec/capec-67). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
