Описание
Presto JDBC Server-Side Request Forgery by nextUri
Summary
Presto JDBC is vulnerable to Server-Side Request Forgery (SSRF) when connecting a remote Presto server. An attacker can modify the nextUri parameter to internal server in response content that Presto JDBC client will request next and view sensitive information from highly sensitive internal servers or perform a local port scan.
Details
The Presto protocol has a nextUri parameter that specifies which URI the client will request next to obtain more query data. Presto JDBC will directly use the nextUri returned by the remote Presto server as the URL for the next request. So if a malicious server modify the nextUri parameter to the internal server, JDBC will request it and cause SSRF.
For unexpected responses, JDBC will put the response body into the error. So the response of the internal server will be leaked if the server also returns the error directly to the user.
The relevant code is in file path /presto-client/src/main/java/com/facebook/presto/client/StatementClientV1.java and function advance .
The flowchart is as follows:
PoC
Running an HTTP service to route POST /v1/statement redirect to the intranet. For example, using these Python code:
Connecting to the malicious server using JDBC:
Pwned!
Impact
When the target remote Presto server to be connected is controllable, an attacker can view sensitive information from highly sensitive internal servers or perform a local port scan.
Vulnerability Discovery Credit: Jianyu Li @ WuHeng Lab of ByteDance
Пакеты
com.facebook.presto:presto-jdbc
<= 0.283
Отсутствует
7.6 High
CVSS3
Дефекты
7.6 High
CVSS3