During pentest remediation on a client’s platform, I found three exposures that were cheap to fix and easy to miss: VPN configs and QR codes of them in the public web root, a dependency manifest anyone could download, and a payment API key that could end up in error logs. None needed a big change. The more useful part was checking how much each one exposed before rating it.
VPN configs, and pictures of them, in the public web root
A folder under the public assets directory held WireGuard client configs for three devices. Each .conf file carried a real private key and preshared key, and anyone could download it without logging in. Next to each config was a PNG, and decoding them showed each was a QR code of the same config with the same live keys. The keys had leaked twice, as a file and as a scannable image.
That second copy is why a deny rule for .conf files wouldn’t have been enough. The fix was to delete all of the files from the repo and from every server, then confirm that each file returned 404 on every host. The deploy already excluded that folder, so the server copies were stale leftovers no deploy would ever remove. The docs now say configs go through the team’s password manager and never under the web root.
Before rating it, I checked what the keys could reach. The VPN server sat in its own isolated network with no peering and no other machines, and its addresses weren’t on any allow-list the app trusted. A stranger could use it as an internet exit node but not to get into production, which put it at medium severity. My recommendation was to shut the VPN server down if it was no longer used, which makes rotating the keys unnecessary.
A dependency manifest anyone could read
Composer’s vendor/composer/installed.json was readable over HTTP and listed every dependency with its exact version, which tells an attacker exactly which known vulnerabilities to try. Nothing legitimate is served from vendor/, so the fix was one Apache rule that refuses the whole tree:
RewriteRule ^vendor/ - [F,L]
The catch was in the deploy. The release package didn’t include .htaccess, and production read its Apache config from a separate file loaded at boot. Merging the change fixed local development only; production needed that config file updated and Apache reloaded. If your web server config lives outside the repo, a fix in the repo may not be live.
An API key in error messages
A payment client built its exception message like this when the gateway answered with an error and no readable message:
throw new \Exception('Request failed with code: ' . $status
. ', message: ' . $response
. ' headers: ' . print_r($curlOptions, true) // includes Authorization: Basic <key>
. ' form: ' . print_r($form, true)); // includes a card token on one path
The cURL options included the Authorization: Basic header with the merchant API key in base64, which decodes in one step. The exception was logged, and the logs fed a third-party error tracker and an error email.
I reproduced it locally with a mock gateway that returned a 502 with an empty body, and the placeholder key showed up in the log. Then I searched every retained production log for Authorization: Basic, and there were zero hits. The branch only runs when a gateway error comes back without a readable message, which is most likely during a gateway outage. It hadn’t fired, so the key didn’t need rotating.
The fix moved message building into one small function and dropped both print_r dumps. The URL, the status code and the gateway’s own response are enough to debug. The tests check every response shape, and in each one the message must not contain Authorization, Basic , CURLOPT or token.
What to check in your own system
- List everything under your web root and look for keys, configs and images of either. A QR code is a credential if it encodes one.
- Block
vendor/,.git/and similar folders at the web server, then confirm the rule is live in production as well as in the repo. - Never put request options, headers or form data into exception messages. Log the status and the response instead.
- Add a test that fails if an error message contains a secret.
- Before you rate a leak, check what the leaked thing can reach, and search your logs to see whether it was actually exposed.