Summery
Log poisoning - also coloqualy called “Log Injection” - is a vulnerability where an attacker inserts malicious or misleading input into application logs, potentially forging log entries or exploiting the software that processes them.
There are not really the same thing, Log injection is more inserting bad data into logs; where log poisoning is manipulating logs for a malicious purpose. However terms are often used interchangeably
Example:
- An application logs failed login attempts using user-supplied usernames
- An attacker submits a username containing a web shell
- If the application logs this input without sanitizing it and that data would get executed because of a vulnerable web server, scheduled task or a cron job, RCE would be achived.
Example
Here’s an exmaple of using Log poisoning with Local file inclusion (LFI). LFI, allows us to execute target host’s files.
In Apache, there is a /var/log/apache2/access.log which logs data, Windows stores that file at C:\xampp\apache\logs\access.log.
Let’s say that an Apache webserver is vulnerable to log poisoning, as it takes data from the user provided User Agent request parameter and stores it in the access.log file.
You could then provide a simple web shell into that argument - User-Agent: <?php system($_GET['cmd']); ?> and execute the access.log file with the LFI vulnerability, for example running http://target/index.php?page=/var/log/apache2/access.log&cmd=id.
References
Similar concepts: Local file inclusion (LFI)