Dev.to Security 🔐 Cybersecurity 👁 0

www-data to root via vim: writing facts apart from hypotheses

The scenario is fictional (RFC 5737 IPs). No exploit steps. Reading logs is half the job. The other half is handing others something they can act on. Rule one: facts and hypotheses go in different columns. Wh

The scenario is fictional (RFC 5737 IPs). No exploit steps.

Reading logs is half the job. The other half is handing others something they can act on. Rule one: facts and hypotheses go in different columns.

What you'll learn

  • Merging auth.log and auditd into one timeline
  • Facts vs hypotheses
  • Priority and the order of containment
  • Chasing what happened after root

Timeline (web03, UTC)

Time Event
01:07:35 www-data SSH password login from 203.0.113.77
01:12:03 sudo vim.basic as root, shell escape
same window uid=33 euid=0 shell (auditd)
next id, then cat /etc/shadow

Facts: the above. Hypotheses (verify): a sudoers entry allowed vim (check the config); offline cracking or lateral movement may follow; the initial access path is unknown.

Containment, in order

  1. Kill the root session; block 203.0.113.77.
  2. Remove shell-capable commands from sudoers; assume /etc/shadow leaked and reset credentials.
  3. Hunt for persistence and lateral movement; isolate and preserve web03.

Severity is Critical because root plus credential-file access. Use UTC everywhere.

Next: preventing this with SUID and sudoers hardening.

Adapted from chapters 25 and 36 of my Japanese book on server defense.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.