Skip to content
RCE Write-up Intermediate

From LFI to RCE via /var/log/vsftpd.log

The article describes how a Local File Inclusion (LFI) vulnerability can be escalated to Remote Code Execution (RCE) by injecting PHP code into a log file (e.g., /var/log/vsftpd.log) and then including that log file via the LFI. An attacker could execute arbitrary commands on the server.

medium.com

Published on medium.com

Disclaimer: This content is foreducational purposes only. The author isnot responsible for any use or misuseof the information provided.

Zoningxtr, on medium.com

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 proper validation, and log files contain user-controlled input that is not sanitised, allowing PHP code injection and execution.

Impact

An attacker could execute arbitrary commands on the server, leading to full system compromise.

What the attacker needed

LFI vulnerability in the web application; vsftpd installed and logging enabled; log file readable via LFI; ability to connect to FTP service

The fix

The application should never pass raw user input to include() or require(); use strict whitelisting, move logs outside the web root, disable PHP execution in log files, and harden the FTP 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.

This article explains a technique where a website flaw that lets you read files on the server (called Local File Inclusion) is combined with a way to write malicious code into a log file. By tricking the server into running that log file as code, an attacker can take control of the server. It's like leaving a note with instructions in a place the server later reads and follows.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.