Summary
The Kafka Connect BigQuery Sink connector accepts externally supplied Google Cloud credential JSON configurations without validating embedded file paths or URLs used as credential sources.
An attacker who can influence these credential configurations may be able to force the connector to read arbitrary local files or initiate arbitrary outbound HTTP requests (SSRF) during authentication.
Affected context
This issue affects deployments using the Kafka Connect BigQuery Sink connector where:
- Google Cloud credentials are provided via JSON configuration files,
- The connector passes credential_source.file or credential_source.url fields directly to Google authentication libraries,
- Configuration values can originate from users, operators, or external systems without strict validation.
The risk is higher in environments where connector configurations are centrally managed but multiple tenants or automated systems can submit or modify connector definitions.
Exploit preconditions
- Attack surface: Kafka Connect configuration API, configuration management UI, or any mechanism that allows supplying/updating connector credential JSON.
- Required access: Ability to create, modify, or inject Google Cloud credential configurations used by the BigQuery Sink connector (e.g., connector admin access, compromised CI/CD or config pipeline, or multi-tenant control plane exposure).
- Trigger point: Connector startup or credential refresh, when the authentication library processes credential_source.file or credential_source.url fields.
- Why exploitation is possible: The connector does not validate or constrain credential source paths or URLs before passing them to authentication libraries, which then dereference them with the connector's local file and network privileges.
Why this happens
The vulnerability stems from treating externally supplied credential configuration as inherently trustworthy and passing it directly into underlying authentication libraries.
Specifically, credential JSON may contain credential_source.file paths or credential_source.url values that the library resolves to load credentials.
Without validation, this behavior aligns with:
- CWE-73: External Control of File Name or Path – attackers control file paths that are read from the local filesystem.
- CWE-918: Server-Side Request Forgery (SSRF) – attackers control URLs that the service accesses, allowing them to pivot outbound HTTP requests to internal or otherwise protected endpoints.
The abstract insecure pattern is delegating sensitive resource resolution (files or network locations) to a library based on unvalidated, user-controlled configuration fields.
Potential impact
- Reading arbitrary files accessible to the Kafka Connect BigQuery Sink connector process (e.g., configuration, secrets, or key material).
- SSRF attacks to internal HTTP(S) services, metadata endpoints, or restricted network resources.
- Discovery of internal network topology or services via controlled outbound requests.
- Possible credential theft or privilege escalation if sensitive files or metadata endpoints are exposed.
- Facilitation of further lateral movement within the infrastructure by combining file disclosure and SSRF with other weaknesses.
General mitigation guidance
Mitigations generally focus on constraining and sanitizing credential sources, as well as limiting connector privileges:
- Validate credential configuration: Ensure credential_source.file and credential_source.url fields are either disallowed in user-provided configurations or validated against strict allowlists (e.g., specific directories or domains).
- Normalize and constrain paths: Resolve paths to their canonical form and reject those that traverse outside approved directories or reference sensitive system locations.
- Constrain outbound URLs: Restrict credential_source.url to trusted domains, enforce HTTPS, and forbid link-local, loopback, or RFC1918 addresses where possible.
- Use controlled credential provisioning: Prefer environment-based or managed identity mechanisms over user-uploaded credential files, reducing the need to parse arbitrary credential JSON.
- Enforce least privilege on the connector host: Limit the connector process's filesystem permissions and network egress so that even if malicious paths or URLs are processed, the blast radius is minimized.
- Isolate sensitive files: Keep secrets and system configuration outside of directories accessible by the connector where feasible.
How teams detect issues like this
Effective detection combines configuration analysis with runtime monitoring:
- Static configuration review: Scan connector configurations and credential JSON for use of credential_source.file and credential_source.url, especially with suspicious paths (e.g., /etc, /var/run, ssh keys) or non-approved domains/IP ranges.
- Policy-based controls: Enforce configuration policies (via admission controllers, CI checks, or configuration linting) that forbid or restrict high-risk credential source values.
- Static application security testing (SAST): Use code scanning rules to flag patterns where user-supplied paths/URLs are passed directly to authentication or file/network APIs without validation.
- Runtime monitoring: Instrument file access logs and network egress telemetry from Kafka Connect nodes to detect unusual reads (e.g., sensitive system files) and unexpected outbound HTTP targets originating from connector processes.
- Change auditing: Track who modifies connector definitions and credential configurations, and alert on high-risk changes involving credential_source fields.

