DEV Community

sunah kim
sunah kim

Posted on Originally published at zenn.dev

I Audited Our Site Inventory Against Reality — It Was Wrong in 7 Places

What happened

I was asked to "document the details of our production sites from a security perspective." The starting point was an existing inventory spreadsheet: nine columns per site — name, URL, category, service, hosting, tech stack, language version, management type, and owner.

My first thought was "I'll just clean up the spreadsheet." That lasted exactly one site. The inventory said "WordPress / AWS" — but the response headers showed it was a static site on S3. If I had trusted the ledger and transcribed it, we'd have kept managing WordPress vulnerabilities for a WordPress that didn't exist.

So I changed the approach: treat the inventory as a claim, measure every site for real, and report the diff. The ledger turned out to disagree with reality in seven places.

Why — an inventory starts rotting the day it's written

I split the measurements into three layers, matching the access I had.

1. External observation (no privileges needed). DNS, certificates, and HTTP headers are visible to anyone:

dig +short example-site.jp A
echo | openssl s_client -connect example-site.jp:443 2>/dev/null \
  | openssl x509 -noout -issuer -enddate
curl -sI https://example-site.jp | head -20
Enter fullscreen mode Exit fullscreen mode

For "is this WordPress?", I checked both the /feed/ response and the meta name="generator" tag. Either one alone can be stripped by a theme or plugin, so my rule was: only record a value when two independent pieces of evidence agree.

2. Cloud APIs (read-only credentials). AWS Lightsail can enumerate assets from the CLI:

aws lightsail get-instances --query 'instances[].{name:name,ip:publicIpAddress,state:state.name}'
aws lightsail get-instance-port-states --instance-name <name>
aws lightsail get-relational-databases \
  --query 'relationalDatabases[].{name:name,public:publiclyAccessible}'
Enter fullscreen mode Exit fullscreen mode

3. SSH (only where I had access). php -v, httpd -v, SELECT VERSION(); on the DB. Change history filled in from yum history info output — not from anyone's memory.

Cross-checking the three layers against the ledger surfaced discrepancies one after another. The highlights:

  • Ledger: "WordPress / AWS" → reality: static S3 site (a completely different attack surface)
  • A site whose hosting had been migrated to an external provider (GoDaddy) — but the old instance was still running: an orphan server nobody patches
  • A domain that no longer resolves (NXDOMAIN) while the server behind it is still up — nothing left but billing and attack surface
  • An instance not in the ledger at all, running a 2023 build of WordPress
  • The management database with publiclyAccessible: true

And one of the seven was my own measurement error. Trying to check the PHP version of a migrated site's old server, I ran curl -L against the IP with a Host header — and the -L followed a redirect to the new hosting, whose response I then recorded as the old server's value. It only came to light later, when I was asked to "double-check the language versions" and re-measured. Dropping -L, or looking at the redirect target, would have prevented it. The person doing the measuring is part of the error budget too.

The fix — make "how to verify" and "where to verify" into columns

The final spreadsheet ended up designed like this:

  • Keep the original nine columns untouched. The diff between the ledger's claim and the measured value is the report — don't overwrite the claim
  • Add measured columns to the right: real IP / TLS expiry / issuer / HSTS / running state / last-verified date / notes, with a different background color so "this was measured" is visible at a glance
  • Add a "where to verify unconfirmed items" column. Anything I couldn't see with my own access gets not a blank cell, but a pointer: the GoDaddy console, Lightsail's browser SSH and php -v, the console of another account
  • Closed sites stay as grayed-out rows marked "closed" — deleting them makes it impossible to tell "removed from the ledger" from "never existed"
  • Sheets: internal / external / change history (only entries verified via yum history) / cloud assets / diffs-from-ledger / legend

The "where to verify" column is the important one. Any real inventory includes servers you may look at but must not touch — managed by another team, read-only investigation allowed. Leave them out and your asset picture has holes; include them with empty measurement cells and it looks like negligence. Write "verifiable in console X (admin access required)" and the blank turns into the next person's TODO.

Takeaways

  • An inventory starts going stale the day it's written. Keep its values as claims, put measured values beside them, and report the diff
  • Measure in three layers matched to your access: external observation / cloud API / SSH. Accept a version only when two independent pieces of evidence agree
  • The measurer makes mistakes too. If you use curl -L, ask yourself whose response you're actually reading
  • Scarier than any single mismatch were the assets nobody was looking at: a dead domain with a live server, and a running server that wasn't in the ledger at all

I've come to think the value of an inventory isn't that its values are correct — it's that it can be re-measured. If "how to verify" and "where to verify" survive as columns, the next person can redo it when the values rot. And figuring out how to document the assets you're only allowed to read — that's half of what a security inventory is.

Top comments (1)

Collapse
 
honeykiran profile image
Honey Kiran •

Seven wrong rows out of one spreadsheet is not a documentation failure — it is the normal state of any inventory that is written once and trusted forever. The ledger said WordPress on AWS; the response headers said a static site on S3. The headers were the record. The spreadsheet was a claim.

I hit the same shape from the other direction: work stamped FAILED in the tracking system that had actually succeeded in the world. Since then every record I keep carries a "last verified against reality" date, and any row past its date is treated as a rumour, not a fact.

An inventory should decay on paper the way trust decays in fact. Yours just got caught decaying — which makes it more honest than most, because now it has been checked.