>_ IzzyLab

Hands-on task

This task is step 2 of the course “Investigating a server”

What arguments the agent was started with

medium~5 min

There's a sshd-agent in the process list — stock OpenSSH has nothing like it. Find out what arguments it was started with: read its command line from /proc/PID/cmdline and write it to /root/agent-cmdline.txt as a single line, arguments separated by spaces. It will show where it's calling home to.

What you'll practise:
  • /proc
  • cmdline
  • pgrep
  • tr
  • investigation

Topic breakdown

Every process has a directory /proc/PID/, and in it a file cmdline — the arguments exactly as the process received them: an array of C strings separated by a null byte. That's why cat prints them run together, while ps shows an already processed string (which the process itself can spoof). For a script with a shebang, the first argument is the interpreter, then the script path and its arguments — that's how you see what's really running. A readable line is obtained by replacing the null bytes with spaces using the character-by-character tr.

What's checked

  1. command line read
  2. null bytes replaced

What it looks like