I am running CheckMarx scan for one of my project and it comes with a SSRF vulnerability for one of the input string parameters of a method. My method is something like below and SSRF vulnerability is thrown for parameter param1.
public String method1(@WebParam(name = "param1") final String param1) {
LOG.info("Inside method1...")
if (StringUtils.isBlank(param1) || !StringUtils.isAlphanumeric(param1)) {
throw new DataManipulationException();
}
// Call 3rd party here (method in line 87 below)
}
Inside the method I am calling a 3rd party URL with HttpClient GetMethod with param1 passed as a query string parameter.
SSRF from CheckMarx is:
The application sends a request to a remote server, for some resource, using @DestinationElement in \src\com\test\Test.java:87. However, an attacker can control the target of the request, by sending a URL or other data in param1 at \src\com\test\Test.java:55.
At line 55, I have
public String method1(@WebParam(name = "param1") final String param1) {
And at Line 87 I have
private String processRequest(final GetMethod method) throws IOException {
Any help to resolve this SSRF vulnerability is appreciated. Thank you.