Local File Inclusion (LFI) is an attack that affects web applications and APIs alike. It allows an attacker to read internal files and sometimes execute code on the server via a series of ways, one being Apache Log Poisoning.
Suppose we are assessing such an API residing in http://<TARGET IP>:3000/api.
Let us first interact with it.
We don’t see anything helpful except the indication that the API is up and running. Let us perform API endpoint fuzzing using ffuf and the common-api-endpoints-mazen160.txt list, as follows.
It looks like /api/download is a valid API endpoint. Let us interact with it.
It seems like we need to specify a file but we don’t know what files are uploaded.
Let’s try LFI attack:
The API is indeed vulnerable to Local File Inclusion!