https://tryhackme.com/room/oscommandinjection
Task 1 Introduction (What is Command Injection?)
Keine Fragen in diesem Task.
Task 2 Discovering Command Injection
Frage 1:
What variable stores the user’s input in the PHP code snippet in this task?
Antwort 1:
$title
Frage 2:
What HTTP method is used to retrieve data submitted by a user in the PHP code snippet?
Antwort 2:
GET
Frage 3:
If I wanted to execute the id
command in the Python code snippet, what route would I need to visit?
Antwort 3:
/id
Task 3 Exploiting Command Injection
Frage 1:
What payload would I use if I wanted to determine what user the application is running as?
Antwort 1:
whoami
Frage 2:
What popular network tool would I use to test for blind command injection on a Linux machine?
Antwort 2:
ping
Frage 3:
What payload would I use to test a Windows machine for blind command injection?
Antwort 3:
timeout
Task 4 Remediating Command Injection
Frage 1:
What is the term for the process of „cleaning“ user input that is provided to an application?
Antwort 1:
sanitisation
Task 5 Practical: Command Injection (Deploy)
Frage 1:
What user is this application running as?
Zuerst müssen wir sehen, wie das Formular funktioniert. Dazu geben wir das Beispiel mit der IP Adresse ein:

Hier sehen wir, dass der „versteckte“ Befehl für den Output wahrscheinlich „PING 127.0.0.1“ ist und ganz normal über die Kommandozeile ausgeführt wird. Wir müssen also den PING Befehl unterbrechen und einen neuen Befehl einfügen. Das erreichen wir mit einem Semicolon „;“.
Geben wir nun also folgendes is das Eingabefeld ein:
; whoami
Es hat geklappt:

Antwort 1:
www-data
Frage 2:
What are the contents of the flag located in /home/tryhackme/flag.txt?
Das sollte nun ebenso klappen, wie in Frage 1. Hier benutzen wir diesen Befehl:
; cat /home/tryhackme/flag.txt
Auch das hat wunderbar funktioniert:

Antwort 2:
THM{COMMAND_INJECTION_COMPLETE}
Task 6 Conclusion
Hier werden wir nur gebeten die Machine zu beenden, keine Fragen.