← Java / Spring · Contents

JAVA-037 / Advanced

SSRF: server requests a user-provided URL

A10:2021 Server-Side Request Forgery · CWE-918 SSRF

Why is this a problem?

Access to the metadata service (169.254.169.254) and internal APIs.

How to fix it

java
URI endpoint = approvedEndpoints.get(serviceId);
if (endpoint == null) throw new IllegalArgumentException();

Further reading