boot767 notes · 24 posts

Every Shell Leaves a Trace

I keep what I learn about offensive security here: my notes from CTFs, certifications and university, plus the walkthroughs I write when a box is worth sharing. It's organized the way I work a box. Recon first, then a foothold, then privilege escalation, then the rest of the network.

latest transmission · 2026-11-19Collection of OSINT Tools and Resources
boot767 notes · 24 posts

Every Shell Leaves a Trace

I keep what I learn about offensive security here: my notes from CTFs, certifications and university, plus the walkthroughs I write when a box is worth sharing. It's organized the way I work a box. Recon first, then a foothold, then privilege escalation, then the rest of the network.

latest transmission · 2026-11-19Collection of OSINT Tools and Resources

Command Injection

You can often tell whether command injection is possible from how an application behaves, as the practical part of this room shows.

Applications that use user input to build system commands can often be pushed into unintended behaviour. The shell operators ;, &, and && combine two (or more) system commands and execute them both. If you are unfamiliar with this, the Linux fundamentals module is worth a look.

Two Ways to Detect Command Injection

  1. Blind command injection
  2. Verbose command injection
MethodDescription
BlindThere is no direct output from the application when testing payloads. You have to investigate the behaviour of the application to determine whether your payload was successful.
VerboseThere is direct feedback from the application once you have tested a payload. For example, running whoami to see what user the application runs under, where the web application outputs the username on the page directly.

Detecting Blind Command Injection

Blind command injection is when the injection occurs but there is no visible output, so it is not immediately noticeable. For example, a command runs but the web application shows no message.

For this type, we need payloads that cause a time delay. The ping and sleep commands are good for this. Using ping as an example, the application hangs for x seconds in relation to how many pings you specify.

Another way to detect blind command injection is to force some output. This can be done with redirection operators such as >. (If you are unfamiliar with this, the Linux fundamentals module covers it.) For example, we can tell the web application to run a command such as whoami and redirect it to a file, then use a command such as cat to read that new file's contents.

Testing command injection this way is often fiddly and takes experimentation, especially since command syntax varies between Linux and Windows.

The curl command is a great way to test for command injection, since you can use it to deliver data to and from an application in your payload. The snippet below is a simple curl payload to an application that is vulnerable to command injection:

curl http://vulnerable.app/process.php%3Fsearch%3DThe%20Beatles%3B%20whoami

Detecting Verbose Command Injection

This is arguably the easier of the two to detect. Verbose command injection is when the application gives you feedback or output showing what is happening or being executed. For example, the output of commands such as ping or whoami is displayed directly on the web application.

Useful Payloads

Linux

PayloadDescription
whoamiSee what user the application is running under.
lsList the contents of the current directory. You may find files such as configuration files, environment files (tokens and application keys), and many more valuable things.
pingInvokes the application to hang. Useful for testing an application for blind command injection.
sleepAnother useful payload for testing blind command injection, where the machine does not have ping installed.
ncNetcat can spawn a reverse shell onto the vulnerable application. You can use this foothold to navigate the target machine for other services, files, or potential means of escalating privileges.

Windows

PayloadDescription
whoamiSee what user the application is running under.
dirList the contents of the current directory. You may find files such as configuration files, environment files (tokens and application keys), and many more valuable things.
pingInvokes the application to hang. Useful for testing an application for blind command injection.
timeoutAlso invokes the application to hang. Useful for testing blind command injection if the ping command is not installed.

To get the flag on this box, pass the following through the form:

127.0.0.1; less /home/tryhackme/flag.txt

The ping scan runs, followed by the less command, which shows the flag content.