Umbra Wiki attack-pattern attack-pattern/CAPEC-67
Back to wiki

CAPEC-67 — String Format Overflow in syslog()

provenance: imported · CWE: CWE-20 CWE-74 CWE-120 CWE-134 CWE-680 CWE-697

CAPEC-67: String Format Overflow in syslog()

MITRE CAPEC attack pattern

Status Draft
Typical severity Very High
Likelihood of attack High
Catalogue CAPEC 3.9 (2023-01-24)

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.

Where this sits in the chain

A finding maps to a weakness (CWE), a weakness is exploited by an attack pattern (CAPEC), and an attack pattern shows up in ATT&CK as observed adversary behaviour. This page is the middle hop.

Weaknesses exploited: CWE-20, CWE-74, CWE-120, CWE-134, CWE-680, CWE-697

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

  • Confidentiality, Integrity, Availability: Execute Unauthorized Commands
  • 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.

Source