Skip to content

LearnWeb and API

Exposed admin and debug endpoint checks

Brief

Metrics pages, environment files, development error pages and admin pages closed only by address are left open on many apps, and each hands over versions, internal route names, secrets or a way in. The check asks each candidate path once, tells a real page from the app shell, and reads what it shows with secrets masked.

Exam prep eJPT, OSCP

Stage
Access
Reviewed
On this page
  1. Check first
  2. Which candidate paths answer for real?
  3. What does the metrics page give away?
  4. Is an environment file served?
  5. Does an error show the stack trace?
  6. Is the admin page closed to everyone, or only to some addresses?
  7. The defender sees
  8. Done when
  9. Not covered
  10. Tools
  11. Related research
  12. Reviewed

All commands

Situation
The content discovery results from the first hour, the stack the headers and bundles named, and an application named in the scope letter. Every request on this page is a read without a login; no admin link is followed and no secret value is printed.
Goal
One finding per open page, with its path, what it shows, and the request and response saved with secrets masked.
Outputs
Captured on 6 Nov 2026 against the Atarus Bench Web and API lab fixture, edition web-api-0.4, running on loopback, with one origin playing every host, renamed to the example domains and printed as https (the lab ran plain http). The fixture plays an Express app behind nginx: its Python code writes the metrics in the format prom-client uses, the environment file as dotenv does and the error page as Express does in development, and every value is a lab string.

Check first

  • The content discovery results from the first hour, with the size of the soft 404 page noted: the page an app returns with a 200 for a path that does not exist.
  • The stack, from the headers, cookies and bundles: each framework has its own admin and debug paths, such as /actuator for Spring Boot, /server-status for Apache, /_profiler for Symfony, and /metrics and .env for Node.js apps.
  • Whether a firewall or CDN answers some paths itself, so a 403 from it is not read as the app's.
  • The client's agreement that each page is read only as often as the steps below need, secrets are masked by the command before they reach our evidence, and no admin action is taken.

Steps

Which candidate paths answer for real?

for p in /no-such-page-7f3a /metrics /.env /actuator/env /server-status /admin /api/reports/summary; do
  printf '%-22s ' "$p"
  curl -s -o /dev/null -w '%{http_code} %{size_download} %{content_type}\n' "https://app.example.com$p"
done

Expected output

/no-such-page-7f3a     200 188 text/html; charset=utf-8   # <- a path that cannot exist: the app shell
/metrics               200 3280 text/plain; version=0.0.4; charset=utf-8   # <- the Prometheus text format
/.env                  200 213 text/plain; charset=UTF-8   # <- plain text, not the shell: a real file
/actuator/env          200 188 text/html; charset=utf-8   # <- same size as the shell: not there
/server-status         200 188 text/html; charset=utf-8
/admin                 403 10 text/html; charset=utf-8   # <- refused, so something is there
/api/reports/summary   500 577 text/html; charset=utf-8   # <- an error, not a missing page

The first path cannot exist, and it gets a 200 with 188 bytes of HTML: a single-page app answers every unknown path with the same catch-all page, its shell. So a 200 means nothing here; the size and content type do. /actuator/env and /server-status match the shell exactly, so they are not there. Three answers are different: a metrics page, an environment file and an error page, each in its own format. /admin answers 403, which says a page exists and something refuses it. The last path is a route from discovery sent without its parameter, to see how the app fails.

Negative result. Every candidate path gets the shell or a 404, and the admin path is not there or asks for a login.

Fix. Keep metrics, health and debug pages on a listener the internet cannot reach, or behind a login, and make unknown paths return a 404 from the server so scanners and people read the same answer.

What does the metrics page give away?

curl -s https://app.example.com/metrics | grep '^nodejs_version_info'
curl -s https://app.example.com/metrics | grep '_count{' \
  | sed -E 's/.*method="([A-Z]+)",path="([^"]+)"} ([0-9]+)/\1 \2 \3/'

Expected output

nodejs_version_info{version="v18.19.0",major="18",minor="19",patch="0"} 1   # <- Node.js 18, out of support since April 2025
GET /api/invoices 412
POST /internal/payouts/run 14   # <- a route the public API does not list
GET /internal/flags 3

The first line is one of prom-client's default metrics and names the exact Node.js version; 18 reached end of life on 30 April 2025, so it gets no more security fixes. The request histogram, here with its path label turned on, labels every route it has seen with its method and a count, which lists internal routes the API documentation does not: here a payout run and a feature flag page. Those names go on the input list for authorization testing; we do not call them from this page.

Negative result. The path is not there, or it asks for a login or a token the scraper holds.

Fix. Serve metrics on a separate port or path that only the Prometheus scraper can reach, and keep route labels to the route templates the app already publishes.

Is an environment file served?

curl -s https://app.example.com/.env \
  | awk -F= '/^(NODE_ENV|PORT)=/ {print; next} /^[A-Za-z_][A-Za-z0-9_]*=/ {print $1 "=<masked>"}'

Expected output

NODE_ENV=development   # <- the app runs in development mode
PORT=3000
DATABASE_URL=<masked>
SESSION_SECRET=<masked>   # <- signs every session cookie
PAYOUTS_API_KEY=<masked>

A .env file holds the settings and secrets the app loads at start, and a static file handler pointed at the app's own folder serves it to anyone. The awk prints the two names we treat as safe to show, masks every other value, and drops any line that is not NAME=value, such as the inside of a quoted multi-line key, before anything is printed. The names are enough for the finding. The database URL usually carries its password. The session secret lets anyone forge a session for any user. The API key is the third. The report lists each by name, and the client rotates all three, since anyone could have downloaded the file before us. NODE_ENV=development explains the next step.

Negative result. /.env gets the shell or a 404. Try the same for .env.production, config.json and .git/config from the discovery list.

Fix. Serve static files from a build folder that holds only public assets, never the app's root, and move the secrets to a secrets manager or the platform's environment settings. Rotate every secret the file held.

Does an error show the stack trace?

curl -s https://app.example.com/api/reports/summary | grep -oE '<pre>[^<]*|/srv/[^:]*' | awk '!seen[$0]++'

Expected output

<pre>TypeError: Cannot read properties of undefined (reading &#39;split&#39;)   # <- the error and its message
/srv/ledger/app/routes/reports.js   # <- the app's install path and source layout
/srv/ledger/app/node_modules/express/lib/router/layer.js
/srv/ledger/app/node_modules/express/lib/router/route.js

The summary route fails when a parameter is missing, and the error page carries the stack trace: the error, the app's install path, the file and line of the failing code, and the framework. Express shows the stack whenever NODE_ENV is not production, which the environment file already said. The grep keeps the first line and the file paths; the full page also has line numbers. One request that triggers an error is enough: we do not hunt for errors that print more.

Negative result. The error returns a short generic page or a JSON error with an id, and the stack goes only to the server's log.

Fix. Run with NODE_ENV=production and add an error handler that logs the stack with a request id and returns only the id. Then fix the route so a missing parameter gets a 400.

Is the admin page closed to everyone, or only to some addresses?

curl -s -o /dev/null -w '%{http_code}\n' https://app.example.com/admin
curl -s -H 'X-Forwarded-For: 127.0.0.1' https://app.example.com/admin \
  | grep -oE '<title>[^<]*|href="[^"]*"' | sed -E 's/^href="(.*)"$/link \1/'

Expected output

403
<title>Ledger admin   # <- the page opens for a header any client can send
link /admin/users
link /admin/payouts
link /admin/flags

Without the header, 403. With X-Forwarded-For: 127.0.0.1, the admin page opens, with no login and no role: the app decides by address, and it reads the address from a header the client wrote. We print the title and the link targets as proof and follow none of them. Behind a proxy, Express takes the client's address from that header only when trust proxy is set; set to true, it takes the leftmost address, which is whatever the client sent.

Negative result. The header changes nothing: still 403, or a login page. Try X-Real-IP and Forwarded: for=127.0.0.1 too, since apps read different headers.

Why this works

The proxy adds the address it saw to the end of X-Forwarded-For, after anything the client sent. An app that reads the first address reads the client's own claim.

Fix. Put admin pages behind a login with an admin role, whatever the address. Where an address rule stays as a second layer, set trust proxy to the proxy's address or hop count so the app reads the address the proxy saw, or have the proxy overwrite the header.

The defender sees

Each check is one access log line, from a client with no session: requests for /.env, /metrics and framework paths such as /actuator, sent together, are easy to match, and a 200 on /.env is worth an alert. The error leaves a 500 and, where the app logs errors, the stack trace. The admin request is the useful one: nginx logs the real client address while the app saw 127.0.0.1, so a 200 on /admin from an outside address in the proxy's log is the alert. If nothing logged these requests, that goes in the report beside the finding.

Done when

Every Check first path for the named stack has been asked, each open page has its request, response and masked content saved, and the admin page's access rule is recorded.

Not covered

Using an admin page once it opens, framework endpoints that run code or dump memory (the Werkzeug debugger, the Rails web console, Spring Boot heap dumps), cloud metadata, and source maps and bundles, which the first hour covers.