Description
The picoCTF News blog exposes an API reference that includes a /heapdump endpoint. Download the Java heap dump and search it for picoCTF.
Setup
Browse to the API Documentation article. The Spring Boot Actuator catalog (/actuator or the docs page itself) lists a /heapdump endpoint.
Use the built-in "Try it out" or run curl manually to download the heap dump file (it will be tens of MB).
Confirm the format with file heapdump and head -c 32 heapdump | xxd. You should see the HPROF magic header JAVA PROFILE 1.0.2.
curl -s http://verbal-sleep.picoctf.net:63972/actuator | jqcurl http://verbal-sleep.picoctf.net:63972/heapdump -o heapdumpfile heapdumpgrep -a picoCTF heapdumpSolution
Walk me through it- Step 1Hit the hidden endpointThe API documentation lists Spring Boot Actuator routes.
/heapdumpreturns a binary JVM snapshot - hundreds of megabytes of every live object, including any String fields the app holds.bashcurl http://verbal-sleep.picoctf.net:63972/heapdump -o heapdumpbashfile heapdump # Expected: 'heapdump: Java HPROF profile data, JAVA PROFILE 1.0.2' xxd heapdump | head -1 # Expected first 12 bytes: 4a 41 56 41 20 50 52 4f 46 49 4c 45 ('JAVA PROFILE')Learn more
Spring Boot Actuator is a production monitoring module that exposes management endpoints over HTTP. When misconfigured, it can leak sensitive runtime information. The
/heapdumpendpoint triggers a full JVM heap snapshot and streams it as a binary HPROF file, often hundreds of megabytes containing every live object in memory. The application stores the flag in aStringvariable, and JavaStringobjects live on the heap until the garbage collector reclaims them, so anything held in memory at dump time ends up in the file.Actuator endpoints were publicly exposed by default before Spring Boot 2.0. Even after the default was changed, misconfigurations remain extremely common: thousands of production services still expose
/env,/beans,/heapdump, and/tracewithout any authentication. The Spring Boot guidance is unambiguous:/heapdumpshould never be reachable from the public internet. CVE-2017-8046 (a Spring Data REST PATCH RCE) is a related but separate Spring data leak class worth knowing as background.Proper hardening involves moving actuator endpoints to a different port with firewall rules, enabling Spring Security authentication on the management interface, and selectively exposing only the endpoints needed (e.g., just
/healthfor load balancer checks). Themanagement.endpoints.web.exposure.includeproperty controls which endpoints are available. - Step 2Search the dump
grep -aforces text mode so the regex actually matches. Without-a, grep auto-detects the file as binary and exits with no output, which looks like an empty result.bashgrep -a picoCTF heapdumpbashgrep -aB5 -A5 'picoCTF{' heapdumpbash# Equivalent with strings:bashstrings heapdump | grep picoCTFLearn more
Heap dumps contain the raw bytes of every object alive in the JVM at the moment the dump was triggered. This includes strings, byte arrays, configuration objects, database credentials, session tokens, API keys, and any other in-memory data - all in plaintext. The
-aflag ingreptells it to treat the binary file as text so regular pattern matching still works.The
stringscommand is an equally effective alternative: it scans any binary for sequences of printable ASCII characters above a minimum length. Both tools are standard in forensic investigation and incident response for extracting readable artifacts from memory images, core dumps, and crash files. Tools like Eclipse Memory Analyzer (MAT) and VisualVM provide GUI-based heap analysis with object graphs, reference chains, and leak suspects.From a security standpoint, the key lesson is that anything stored in memory - even temporarily - can be recovered from a heap dump. This is why sensitive values like private keys and passwords should be stored in
char[](which can be zeroed) rather thanString(which is immutable and persists until GC collection) in Java applications.
Flag
picoCTF{Pat!3nt_15_Th3_K3y_ad7e...}
Truncated for site policy; the actual flag continues past the redaction. No authentication or decoding needed - just download and search the dump.
How to prevent this
How to prevent this
- Set
management.endpoints.web.exposure.include=health,infoand never expose/heapdump,/env,/beans, or/traceon a public interface. - Move actuator to a separate management port (
management.server.port) and firewall it to internal IPs only. Load balancers can still reach/health; the public internet cannot. - Require authentication on whatever does stay exposed (Spring Security on the management context), and treat heap dumps as a credential-equivalent artifact in incident response runbooks.