Lfi To Rce Via Log Poisioning
The text explains that if a web application has a local file inclusion (LFI) vulnerability and log files are readable, an attacker can inject a payload into a log file (e.g., via the User-Agent header) and then include that log file through the LFI to execute commands, achieving remote code execution (RCE).
Published on systemweakness.com
If there is no upload functionality on the target application, than we will fing logs. We can poision log files by inserting our payload in a log file and including the log file via LFI.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application includes user-supplied file paths without validation, and log files are readable and writable by the web server user, allowing injected content to be executed.
Impact
An attacker could execute arbitrary commands on the server, leading to full compromise, if the LFI and log file permissions are misconfigured.
What the attacker needed
LFI vulnerability in the application; Log file readable by web server user; Ability to inject content into a log file
How it was found
- Find a service running on the target and locate its log file (e.g., Apache access log).
- Check that the log file is readable by the web server user (misconfigured permissions).
- Send a request with a payload in a controllable field such as the User-Agent header so it gets written to the log.
- Include the log file via the LFI parameter to execute the injected payload.
- Use the executed payload (e.g., a command shell or reverse shell) to run commands on the server.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Local file inclusion (LFI) lets an attacker make a web server show files it should not, like system logs. If the attacker can also write to a log (for example, by sending a special request that gets recorded), they can put harmful code in the log and then ask the server to run that log file as a program. This turns a file-reading bug into full command execution on the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.