No check on the endpoint at all. Whoever can influence it makes your server POST wherever they point it, internal services included.
What goes wrong
A public entry point accepts an endpoint as a plain string and hands it to the network layer to POST. Nothing checks the scheme or the host, nor where that address actually resolves. If a caller can influence the endpoint, they choose where your server sends the request.
That choice includes the places you do not want reachable from your process. Internal services behind the firewall, sure. Worse, the metadata endpoint that hands out short-lived credentials. Your server has network position the caller does not, and this method lends it out.
The word public on the method is doing real damage. An internal helper that trusts its caller is one risk. An exposed method that does the same thing is another, and here the trust and the exposure sit in the same place.
The pattern
public void handle(String endpoint, Payload p) {
network.sendRequest(endpoint, p); // no checks
}public void handle(String endpoint, Payload p) {
URI u = URI.create(endpoint);
if (!isHttps(u) || !allowedHosts.contains(u.getHost())) {
throw new SecurityException('endpoint not allowed');
}
network.sendRequest(u, p);
}Every gate held. The exploit path was reproduced against a negative control, the impact was calibrated, and the finding was signed report-ready.
Why it matters to you
Any method that turns a string into an outbound request is an SSRF primitive once that string is reachable by an attacker. Servers usually have more network reach than the people calling them, so 'send a request to this URL' is a capability to hand out carefully. Validate against an allowlist, resolve the host and re-check it to defeat DNS tricks, and keep the request off loopback and metadata ranges.
Check your own code
- Trace every public method argument that becomes an outbound URL.
- Enforce https and an explicit host allowlist before sending.
- Block loopback, link-local, and metadata IP ranges after DNS resolution.
- Ask why the destination is caller-supplied at all, and pin it server-side if you can.