Dark Mode

Settings

Capec-93 Detail

Log Injection-Tampering-Forging

Detailed Software Likelihood: High Typical Severity: High

Parents: 268

Threats: T68 T276 T297 T395

Description

This attack targets the log files of the target host. The attacker injects, manipulates or forges malicious log entries in the log file, allowing them to mislead a log audit, cover traces of attack, or perform other malicious actions. The target host is not properly controlling log access. As a result tainted data is resulting in the log files leading to a failure in accountability, non-repudiation and incident forensics capability.

Not present

External ID Source Link Description
CAPEC-93 capec https://capec.mitre.org/data/definitions/93.html
CWE-117 cwe http://cwe.mitre.org/data/definitions/117.html
CWE-75 cwe http://cwe.mitre.org/data/definitions/75.html
CWE-150 cwe http://cwe.mitre.org/data/definitions/150.html
REF-131 reference_from_CAPEC J. Viega, G. McGraw, Building Secure Software, 2002, Addison-Wesley
REF-550 reference_from_CAPEC http://doc.novsu.ac.ru/oreilly/tcpip/puis/ch10_05.htm A. Muffet, The night the log was forged
REF-551 reference_from_CAPEC https://www.owasp.org/index.php/Log_Injection The OWASP Application Security Desk Reference, 2009, The Open Web Application Security Project (OWASP)
REF-552 reference_from_CAPEC https://samate.nist.gov/SRD/view_testcase.php?tID=1579 Fortify Software, SAMATE - Software Assurance Metrics And Tool Evaluation, 2006--06---22, National Institute of Standards and Technology (NIST)
Explore
  1. Determine Application's Log File Format: The first step is exploratory meaning the attacker observes the system. The attacker looks for action and data that are likely to be logged. The attacker may be familiar with the log format of the system.

  2. Techniques
    Determine logging utility being used by application (e.g. log4j)
    Gain access to application's source code to determine log file formats.
    Install or obtain access to instance of application and observe its log file format.
Exploit
  1. Manipulate Log Files: The attacker alters the log contents either directly through manipulation or forging or indirectly through injection of specially crafted input that the target software will write to the logs. This type of attack typically follows another attack and is used to try to cover the traces of the previous attack.

  2. Techniques
    Use carriage return and/or line feed characters to start a new line in the log file, and then, add a fake entry. For example: "%0D%0A[Thu%20Nov%2012%2011:22]:Info:%20User%20admin%20logged%20in" may add the following forged entry into a log file: "[Thu Nov 12 12:11:22]:Info: User admin logged in" Different applications may require different encodings of the carriage return and line feed characters.
    Insert a script into the log file such that if it is viewed using a web browser, the attacker will get a copy of the operator/administrator's cookie and will be able to gain access as that user. For example, a log file entry could contain The script itself will be invisible to anybody viewing the logs in a web browser (unless they view the source for the page).
  1. The target host is logging the action and data of the user.
  2. The target host insufficiently protects access to the logs or logging mechanisms.

Not present

Low Medium
This attack can be as simple as adding extra characters to the logged data (e.g. username). Adding entries is typically easier than removing entries.
A more sophisticated attack can try to defeat the input validation mechanism.
Integrity
Modify Data
  1. Dave Nielsen and Patrick Breitenbach PayPal Web Services (aka PHP Toolkit) 0.50, and possibly earlier versions, allows remote attackers to enter false payment entries into the log file via HTTP POST requests to ipn_success.php. See also: CVE-2006-0201
  2. If a user submits the string "twenty-one" for val, the following entry is logged: INFO: Failed to parse val=twenty-one However, if an attacker submits the string twenty-one%0a%0aINFO:+User+logged+out%3dbadguy the following entry is logged: INFO: Failed to parse val=twenty-oneINFO: User logged out=badguy Clearly, attackers can use this same mechanism to insert arbitrary log entries.