The Key the Heap Kept: Reading a Secret Out of an Actuator Heap Dump
The challenge
Voltaro's billing app exposes Spring Actuator. A heap dump holds what /env masks. Recover the payment API key it really uses.
What you'll learn
- Enumerate an exposed Spring Boot Actuator from its /actuator index
- Explain why masked /env values still leak which secrets exist
- Extract readable strings from a binary heap dump with a pipe
- Tell a configuration fallback from the value a service really uses
- Lock down Actuator in production
Skills tested
Prerequisites
- Using curl
- Shell pipes and grep
How it works
Spring Boot Actuator adds operational endpoints under /actuator. /actuator itself lists every endpoint that is exposed, so one request maps the attack surface.
Since Spring Boot 3, /actuator/env masks every value as ******. It still returns every property name and its origin, so it tells you exactly which secrets the service holds (here PSP_API_KEY, SPRING_DATASOURCE_PASSWORD, PSP_WEBHOOK_SECRET).
/actuator/heapdump returns an HPROF snapshot of the JVM heap. Masking is applied when a value is rendered as JSON, not in memory, so the heap holds the raw environment, the parsed configuration and the I/O buffers of recent HTTP calls. strings pulls the readable text out of the binary and grep finds the secret. This is the technique behind the 2024 research that recovered cloud credentials from a car maker's exposed heapdump endpoint.
Common mistakes
- Stopping at /actuator/env.
******is the mask, not the value. - Saving the dump.
curl -ofails on a read-only disk: pipe it straight intostrings. - Grepping the binary directly.
grepon the raw dump only says binary file matches: runstringsfirst, or usegrep -a. - Taking the application.yml fallback.
plk_live_E95Su8Rvq7tJA2aS0k80m7svappears inside${PSP_API_KEY:...}, the default Spring uses only whenPSP_API_KEYis unset. The environment sets it, and theAuthorization: Bearerheader of the last Paylark request shows the key actually sent. - Taking another secret. The database password and the
whsec_webhook secret leak too, but the question is the payment API key. - Keeping the trailing character. A
!or#after a string is the next record's tag byte in the dump, not part of the key.
How to defend against it
- Expose only what you need:
management.endpoints.web.exposure.include=health,info. - Never expose
heapdump(orenv,configprops,threaddump) on a reachable port. Disable it withmanagement.endpoint.heapdump.access=none. - Move Actuator to a separate
management.server.portbound to localhost or a private network, and require authentication with Spring Security. - Do not keep real keys as fallbacks in
application.yml: a${VAR:default}default ships inside the jar. - Assume an exposed heap dump leaked every secret the process held, and rotate them all.