Summary
A server-side request forgery vulnerability in Apache Hive's Avro SerDe schema resolution can cause Hive to fetch an attacker-controlled URL while querying an Avro table. An authenticated user with table-creation privileges may use this behavior to reach cloud metadata services, internal network endpoints, or local resources available to the Hive process.
Affected context
The issue occurs in Hive deployments that use Avro tables and resolve schemas through the avro.schema.url table property. It becomes risky when an authenticated remote user can create or alter a table, set that property to an attacker-controlled location, and cause the table to be queried. External tables are commonly relevant because they allow table metadata to reference resources outside the managed data path.
Exploit preconditions
- Attack surface: Network-accessible HiveServer2 or Metastore services
- Required access: Valid Hive authentication and
CREATE TABLEor equivalent DDL privilege - Trigger point: Avro schema resolution when the affected table is queried
- Additional access: The table creator can typically query the created table; another user with
SELECTaccess may also trigger resolution - Why exploitation is possible: Hive resolves a user-influenced schema URL from table metadata and performs a server-side fetch using the Hive process identity
- Not required: Write access to the table location or administrative privileges
Why this happens
The vulnerability results from treating a table property that can be controlled by a sufficiently privileged user as a trusted network resource. During Avro schema resolution, Hive follows the configured URL from the server side without adequately restricting destinations or schemes. This maps to CWE-918: Server-Side Request Forgery, where attacker-influenced input causes a server to make requests to unintended local, internal, or external resources.
Potential impact
- Exposure of cloud instance metadata or temporary credentials
- Access to internal network services reachable by the Hive host
- Disclosure of local files or service responses available to the Hive process
- Network reconnaissance from a trusted server location
- Potential follow-on compromise if retrieved data contains credentials or sensitive configuration
General mitigation guidance
Mitigation generally focuses on reducing trust in schema locations and restricting outbound connectivity from Hive services.
Common defensive patterns include:
- Permit only approved schema schemes and trusted hostnames or repositories
- Reject loopback, link-local, private, and otherwise restricted destination ranges after resolving hostnames
- Avoid allowing arbitrary remote URLs in table metadata when managed schema storage is available
- Apply network egress controls that prevent Hive processes from reaching metadata services and unnecessary internal networks
- Run HiveServer2 and related services with least-privilege identities and minimal filesystem access
- Treat external-table and schema-location privileges as sensitive capabilities
- Centralize and audit schema distribution through authenticated, allowlisted repositories
How teams detect issues like this
Detection can combine metadata inspection, application logging, and network telemetry:
- Search metastore metadata for Avro tables whose
avro.schema.urluses unexpectedhttp,https,file, orftpschemes - Flag URLs targeting link-local addresses, cloud metadata endpoints, private network ranges, localhost, or unusual internal hosts
- Review HiveServer2 and Metastore logs for
CREATE TABLEorALTER TABLEoperations that set schema URLs, followed by queries against those tables - Correlate schema-resolution failures and outbound requests with the identity that created or modified the table
- Monitor flow logs and metadata-service access logs for requests originating from Hive host identities
- Use static analysis and policy checks to identify unrestricted URL fetching or missing destination validation in schema-resolution code

