Dev.to Security 🔐 Cybersecurity 👁 0 📖 3 min read

The Defaults Are the Attack Surface: What I Learned Auditing Open-Source Middleware

The Defaults Are the Attack Surface: What I Learned Auditing Open-Source Middleware Every few weeks another CVE drops for an open-source admin console, report engine, or job scheduler, and every few weeks the write-up

The Defaults Are the Attack Surface: What I Learned Auditing Open-Source Middleware

Every few weeks another CVE drops for an open-source admin console, report engine, or job scheduler, and every few weeks the write-up traces back to the same place: not a clever memory-corruption bug, but a default. A default account that ships in the config file. A JWT signing key committed three years ago. A "temporary" token that outlived the developer who wrote it.

I spend my time auditing exactly these components — Java middleware, the boring stuff every company deploys and nobody reads — working only from source code and public advisories. After a while the pattern stops being surprising and starts being a checklist. This post is that checklist, with the reasoning behind each item.

1. First-boot credentials, and where they hide

The obvious case is the admin/admin pair in application.yml. The interesting cases are the non-obvious ones:

  • Generated once, cached forever. The component generates a random secret on first boot, writes it to a data directory, and reuses it across restarts. If that directory is inside the container image or a mounted volume that gets backed up, your "random" secret is now in three places you didn't plan for.
  • The fallback path. Code reads a secret from the environment; if the variable is unset, it falls back to a hardcoded string "for development." Production never sets the variable because the docs don't mention it. I find these by grepping for the fallback constant and checking whether any validation blocks it in production mode. Usually nothing does.

When you evaluate a component, don't ask "does it have default credentials?" Ask "what is the full path the secret takes from first boot to first request, and which steps have a fallback?"

2. Tokens that don't know how to die

JWT libraries make expiry easy, which is exactly why its absence is a smell. The components I audit fail in a consistent way: the session token has an expiry, the "API token" does not. The API token was added in a later version for integrations, the developer needed it to work overnight, and now it's immortal.

The audit move: find every token type the component issues, and for each one, find where expiry is set and where it's checked. Two lines of grep. When the answer is "expiry is a config key with no default," that's your finding — not because it's a CVE today, but because every deployment after the first one will inherit a stranger's decision.

3. Admin endpoints and the firewall illusion

"This endpoint is only for internal use." Every web component I've audited has one of these, and the mechanism ranges from a config flag (fine, if it defaults to off and docs say so) to nothing but a URL nobody linked in the UI (not fine, because port scanners don't read the UI).

The pattern behind several published CVEs in database-facing tools: an endpoint that executes queries, meant for the monitoring dashboard, reachable unauthenticated because the dashboard embeds a token that's also a default. The fix in each case was the same shape — but the next tool ships with the same shape again.

4. The dependency tail

The component itself might be clean. The ORM it pins from 2021 is not. When I audit, the last thing I do is read the dependency list and check each pinned version against known advisories. It's the least glamorous step and it regularly turns up the most exploitable issue in the whole evaluation — deserialization gadgets and old parsing libraries being the usual suspects.

The checklist

Stripped of the stories, here's what I run through before any of these tools touch production credentials:

  1. Trace every secret's full path, first boot to first request. Find the fallbacks.
  2. List every token type. Find where each expires. Flag the immortals.
  3. Find every "internal" endpoint. Check what actually enforces "internal."
  4. Check what happens to authorization checks on the error paths (404 handlers, health endpoints, CORS preflight).
  5. Read the pinned dependencies. One afternoon, most CVEs you'll ever care about.
  6. Do all of this from source and public advisories. No lab needed.

None of this requires exploit development, and that's the point. Defaults are the attack surface because nobody reads them — and reading is free.

I'm collecting these patterns, with the real CVEs that anchor each one, into a book — Auditing Open-Components: A Practitioner's Field Guide. It's in early access, ~90% complete, and every chapter works the same way this post does: source code and public advisories, nothing else.

📰 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.