---
title: "2. Second-Order LFI"
date: 2024-10-17
draft: false
---


Common but a bit more advanced: Second order attacks

Webapp may allow us to DL a avatar img through url like `/profile/$username/avatar.png` 
Craft a malicious LFI username like `../../../etc/passwd`, then it could be possible to change the file being pulled to another local file on the server and grab it instead of our avatar 

Basically: Poisoning a database entry with an LFI payload in our username. Webapp functionality does the rest for us to perform the attack. This is why it's a `second-order` 
- Devs overlook this kind of stuff, may protect against direct user input but trust values pulled from their database (our username in this case) 
