Project 5: Forensics

  • This project is due at 11:59pm on Friday, Nov 13, 2026.

Description and Deliverables

In this project, you will play the role of a digital security expert using the topics we discussed in lecture. You will be given access to a server that may have been hacked and infected with malware. Your job is to trace the attacker’s footsteps from the origin of the breach, all the way to their ultimate payload.

To receive full credit for this project, you will need to:

  • commit a file named project5/forensics.json in a signed commit
  • submit your assignment via GitHub to Gradescope.

Brief Introduction to Digital Forensics

Digital forensics is the practice of investigating computer systems to identify and isolate evidence. The goal of triage is typically to determine how an attacker broke into a system, what they did while they had access, determining whether the attacker still has access (e.g. did they plant a backdoor or rootkit?), and ultimately disinfecting the system so that the attacker no longer poses a threat.

Getting Started

In this project, you will play the role of a digital security expert who has been asked to forensically analyze a server that was owned and maintained by an employee of Happy Funtime Plastic Co. This server hosted a simple website that allowed people to upload and view images. However, the owner of the server began to notice strange behavior on the server, so they shut it down and created an account on the server for you to analyze. To get access to your server, run:

$ ssh <github-username>@p5.neucrypt.org

Note that access has been granted using your Github username and the SSH keys that you registered in GitHub. You should therefore run this command from the same machine or VM on which you have your GitHub SSH keys. The login should be automatic, so if you are asked for a password, it means that you might not have a GitHub key, you uploaded a key after we set up this machine, or you are working from a machine that does not have your same GitHub key.

You will land in a shell inside your own private container. Your account is a member of the adm and systemd-journal groups, so you can read the logs directly. You do not need sudo to inspect logs, and you should not use sudo less or any other interactive program through sudo. If a file is readable by your account, ordinary less, cat, grep, jq, and journalctl will work.

Your case ID. After you log in, run:

$ cat ~/case-id
p5-<github-username>-<case-id>

Use this value for incident_id in your submission.

You can test the web application with curl:

$ curl http://localhost/

The application is intentionally vulnerable. The incident is over, and the web application is part of the evidence. Do not attack other students’ containers, the host, or the network. Do not modify system logs, configuration files, or evidence. If you accidentally change something, report it.

This assignment uses the logs that a normal Ubuntu server provides. In addition, your container has a read-only credential that can query the company’s central log vault in Google Cloud Logging. The p5-logs helper uses this credential. Do not print, copy, or reuse the credential.

Local logs

The important local sources are:

Source What it records
/var/log/auth.log SSH logins, failed logins, sudo, useradd, and other authentication events
/var/log/syslog General system messages, service activity, cron execution, and many forwarded kernel messages
/var/log/kern.log Kernel messages, including security-control denials when they are delivered to the host
journalctl The systemd journal, which may contain the same events in structured form
/var/log/apache2/access.log Every HTTP request, including uploads, downloads, status codes, and user agents
/var/log/apache2/error.log Apache and PHP errors, including denied requests
/var/log/dpkg.log Package installation and upgrade activity
/var/log/wtmp, /var/log/btmp, /var/log/lastlog Login records; use last, lastb, and utmpdump
~/.bash_history Commands typed by a user, if history was not disabled or cleared
/etc/passwd, /etc/shadow, /etc/crontab Account and scheduled-task configuration; these are evidence, not logs

journalctl

The systemd journal is a default Ubuntu logging mechanism. It stores structured records and is often more useful than plain text logs for filtering by service, process, priority, or time. Useful commands include:

$ journalctl --since "2026-11-02 13:00:00"
$ journalctl --until "2026-11-02 15:00:00"
$ journalctl -u apache2 --no-pager
$ journalctl -p warning --no-pager
$ journalctl _COMM=sshd --no-pager
$ journalctl -o json-pretty --since "2026-11-02 13:00:00"

Not every event is guaranteed to appear in every local log. When an event is missing locally, compare auth.log, syslog, journalctl, and the central vault.

Timestamps

Different logs use different timestamp formats. For example:

  • Apache access log: 02/Nov/2026:13:49:53 -0500
  • auth.log: Nov 2 13:49:53
  • journalctl: 2026-11-02 13:49:53.280277
  • Google Cloud Logging: 2026-11-02T18:49:53.280277Z

Use the timestamps as they appear and make sure your answer format matches the question.

Log integrity and the central vault

A local log can be changed by an attacker. In this incident, the attacker attempted to remove a line from the local authentication log, but the cleanup was botched. The local file may be missing an event, contain a malformed or duplicated line, or show an impossible sequence of sessions.

The company forwards authentication and system events to a central vault in Google Cloud Logging. The vault is append-only from the server: the attacker inside the server cannot modify it. When you suspect that local evidence has been removed, query the vault for the incident window.

The vault uses Google Cloud Logging’s LogEntry format. Important fields include:

  • logName — your log, written here as project5-<github-username>
  • timestamp and receiveTimestamp
  • severity
  • resource — the resource that produced the event
  • labels — the incident and host
  • jsonPayload — the structured event body
  • insertId — a unique identifier for the entry

In Cloud Logging, the full log name is projects/<p5-project>/logs/project5-<github-username>. In this writeup and in forensics.json, use the short form project5-<github-username>.

The vault stores events chronologically and does not label them as first or second. Use the timestamps and the event contents to determine the order yourself.

The p5-logs helper queries your log view and prints the results as JSON. For example:

$ p5-logs --since "2026-11-02T13:00:00-05:00"
$ p5-logs --until "2026-11-02T15:00:00-05:00"
$ p5-logs --filter 'jsonPayload.user="deploy"'
$ p5-logs --insert-id p5-<github-username>-000041

You can also pipe the output to jq, which pretty-prints JSON objects:

$ p5-logs --since "2026-11-02T13:00:00-05:00" | jq '.[] | {timestamp, severity, jsonPayload}'

The p5-logs helper is the supported interface in the container. It queries the Google Cloud Logging API through your scoped log view and prints the short log name, project5-<github-username>, in its output.

Guards and denial messages

The blocked attack was stopped by a real security control. Depending on your system, the guard may be:

  • an AppArmor profile that denies reading or executing files in the upload directory
  • an Apache or PHP configuration rule that prevents uploaded code from executing
  • an sshd rule such as DenyUsers or an AllowUsers restriction
  • a PAM or sudoers rule

The denial should appear in a real log. AppArmor denial messages are kernel audit records and may appear in the central vault rather than in the container’s local logs. They often contain fields such as:

apparmor="DENIED" operation="open" profile="p5-upload-guard" name="/var/www/html/uploads/..."

An SSH denial may appear in auth.log, journalctl, and the vault, for example:

User deploy from 172.18.0.9 not allowed because listed in DenyUsers

Do not simply name a configuration file. Cite the event that shows the guard fired.

The Incident

The Happy Funtime Plastic Co. server was the target of two attempts:

  • The attacker tried to upload a PHP file to the photo-sharing site and execute it.
  • The attacker tried to download an exposed backup or repository file, recover a credential or SSH key, and log in with it.

Both attempts left evidence. The first attempt was blocked. The second attempt succeeded. Determine what kind of attempt each one was.

Questions

The first attempt was blocked. The second attempt succeeded. Determine what happened, starting with the timeline.

  1. What kind of first attempt was made? Give its type (upload or backup), artifact path, and timestamp.

  2. What real security control blocked the first attempt? Name the guard or rule.

  3. What kind of second attempt was made? Give its type, artifact path, and timestamp. Include the artifact SHA-256 if you reconstructed it.

  4. When did the attacker first log in, as which account, and from where? Give the timestamp, account, and source address.

  5. What sensitive file or data did the attacker access? Give the full path or a precise description.

  6. What persistence mechanism did the attacker install? Give the full path and the command or configuration entry.

  7. What file was modified or back-doored? Give the full path.

  8. The attacker attempted to remove a line from the local authentication log, but the cleanup was botched. Use the central vault to recover the missing or altered event. Give its insertId, the original event, and explain what the attacker was trying to hide.

  9. Construct the attack timeline. Give at least 10 events in chronological order, covering both attempts, the guard denial, the login, sensitive-file access, persistence, file modification, log cleanup, and the recovered vault event.

Answer Format

Submit one JSON file:

project5/forensics.json

Use this compact structure:

{
  "incident_id": "p5-<github-username>-<case-id>",
  "first": {
    "type": "backup",
    "artifact": "/var/www/html/backups/example.zip",
    "time": "2026-11-02T13:17:11-05:00",
    "guard": "sshd DenyUsers",
    "evidence": "gcp:p5-<github-username>-000006"
  },
  "second": {
    "type": "upload",
    "artifact": "/var/www/html/uploads/example-11.php",
    "time": "2026-11-02T13:40:18-05:00",
    "hash": "<sha256>",
    "evidence": "/var/log/apache2/access.log:1841"
  },
  "success": {
    "login_time": "2026-11-02T13:40:53-05:00",
    "account": "svc_example",
    "source": "203.0.113.100",
    "stolen": "/etc/shadow",
    "persistence": "/usr/local/bin/example-1.sh",
    "persistence_command": "17 3 * * * root /usr/local/bin/example-1.sh",
    "modified": "/usr/bin/ldd",
    "evidence": "/var/log/auth.log:37"
  },
  "deleted": {
    "insert_id": "p5-<github-username>-000009",
    "event": "sudo useradd ...",
    "why": "hide the account creation; auth.log has a gap and a duplicated adjacent line"
  },
  "timeline": [
    "2026-11-02T13:17:11-05:00 | first | backup download | /var/log/apache2/access.log:1904",
    "2026-11-02T13:40:18-05:00 | second | malicious upload | /var/log/apache2/access.log:1841"
  ]
}

The first attempt is always the blocked one. The second attempt is always the successful one. first.type and second.type must be upload and backup in some order.

Evidence format

Use one short evidence string per answer:

  • Local log: "/var/log/auth.log:37"
  • Central vault: "gcp:p5-<github-username>-000041"

Timeline format

Each timeline entry is one string:

<timestamp> | first|second | <event> | <evidence>

The evidence part is optional, but every event should cite a source. The list must contain at least 10 entries, be sorted by timestamp, and include events from both attempts.

Checking your file

The p5-checker program is installed in your container. It verifies the JSON format of your answer file and reports missing or malformed fields before you submit. Run the local checker before submitting:

p5-checker project5/forensics.json

It verifies JSON syntax, required fields, types, timestamps, evidence formats, and timeline ordering. It does not reveal the correct answers. You can print your case ID with:

p5-checker --case-id

Submitting Your Project

  1. Create a new directory named project5.
  2. Add your forensics.json file to it.
  3. Run p5-checker project5/forensics.json and fix any format errors it reports.
  4. Sign your commit and push it to GitHub.
  5. Submit the repository to Gradescope.

You can update your file as many times as you like before the deadline. Depending on your setup, you may need to copy your forensics.json file from the project machine back to your own machine. You can use the scp program for this, use your resources to learn how this program works.

Signing Commits

You can use SSH commit signing for this project. This is often easier than GPG because you already have an SSH key registered with GitHub.

  1. In GitHub, open Settings → SSH and GPG keys → New SSH key.
  2. Give the key a title, choose Signing Key, and paste your public key. You may upload the same public key as both an authentication key and a signing key.
  3. Configure Git to use your SSH key for signing. Replace the path if your key is not ~/.ssh/id_ed25519.pub:
$ git config --global gpg.format ssh
$ git config --global user.signingkey ~/.ssh/id_ed25519.pub
$ git config --global commit.gpgsign true
  1. Sign your commit:
$ git add project5/forensics.json
$ git commit -S -m "your commit message"
$ git push

You can verify the signature locally with:

$ git log --show-signature -1

GitHub will show the commit as Verified when the public key is registered as a signing key.

Grading

This project is worth 10% of your final grade, broken down as follows (out of 100):

  • 10 points — first attempt type, artifact, and time
  • 10 points — real control that blocked the first attempt
  • 15 points — second attempt type, artifact, time, and optional hash
  • 10 points — first login, account, and source
  • 10 points — sensitive file or data
  • 10 points — persistence path and command
  • 10 points — modified or back-doored file
  • 15 points — recovered deleted event from the central vault
  • 10 points — complete timeline with at least 10 entries for both attempts

Partial credit is available for correct values with slightly different formatting. Copied answers will not match your incident, artifacts, accounts, vault insert IDs, or timeline.

Appendix: Useful Commands

Authentication and system logs:

$ less /var/log/auth.log
$ grep -n "Accepted\|Failed\|sudo\|useradd" /var/log/auth.log
$ journalctl --since "2026-11-02 13:00:00" --until "2026-11-02 15:00:00"
$ journalctl _COMM=sshd --no-pager
$ last -f /var/log/wtmp
$ lastb -f /var/log/btmp

Apache logs:

$ less /var/log/apache2/access.log
$ less /var/log/apache2/error.log
$ grep -n "upload\|backup\|403\|500" /var/log/apache2/access.log

Accounts and persistence:

$ less /etc/passwd
$ less /etc/crontab
$ ls -la /etc/cron.d /var/spool/cron/crontabs
$ ps aux

File integrity:

$ sha256sum /path/to/file
$ debsums -c
$ dpkg -V
$ stat /path/to/file

Cloud Logging:

$ cat ~/case-id
$ p5-checker --case-id
$ p5-logs --since "2026-11-02T13:00:00-05:00"
$ p5-logs --filter 'jsonPayload.user="deploy"'
$ p5-logs --insert-id p5-<github-username>-000041
$ p5-logs --since "2026-11-02T13:00:00-05:00" | jq '.[] | {timestamp, severity, jsonPayload}'
$ p5-checker project5/forensics.json

Do not use sudo to inspect logs. If a log is not readable with the permissions you have, use the central vault.