## Summary
OpenTelemetry Operator’s cmd/otel-allocator TargetAllocator could preserve attacker-controlled ServiceMonitor bearerTokenFile values into Prometheus scrape configs. When targetAllocator.prometheusCR.enabled is enabled, the OpenTelemetry Collector reads the referenced file from its own pod filesystem at scrape time and sends it as Authorization: Bearer ... to the attacker-controlled scrape target. This is fixed in 0.152.0.
## Technical Details
- TargetAllocator watches ServiceMonitor resources and converts selected endpoints into Prometheus scrape configuration entries.
- The endpoint field bearerTokenFile is preserved through conversion as HTTPClientConfig.Authorization.CredentialsFile.
- At scrape time, the Collector loads that scrape config and reads the file from its own pod filesystem, then sends the contents as Authorization: Bearer ... on every scrape interval.
- A tenant who can create/update a ServiceMonitor matched by serviceMonitorSelector and serviceMonitorNamespaceSelector can point bearerTokenFile to a sensitive path (e.g., /var/run/secrets/kubernetes.io/serviceaccount/token) and choose a scrape target they control.
- Preconditions include:
- Collector deployed with targetAllocator.prometheusCR.enabled: true.
- serviceMonitorSelector / serviceMonitorNamespaceSelector matching attacker-writable namespaces.
- Collector service-account token mounted.
- Collector network access to the attacker-chosen target.
- The guard equivalent to Prometheus’ ArbitraryFSAccessThroughSMs.Deny was absent; the fix introduces DenyFSAccessThroughSMs to drop endpoints referencing arbitrary files.
## Affected
- github.com/open-telemetry/opentelemetry-operator — component cmd/otel-allocator (TargetAllocator)
- Affected versions: prior to 0.152.0
## Impact
- High-confidence credential exfiltration: attacker can cause the Collector to send its service-account JWT (or other mounted sensitive files) to an attacker-controlled endpoint.
- Kubernetes API impact is limited by the permissions of the Collector service account.
## Mitigation
1. Upgrade opentelemetry-operator to 0.152.0 or later.
2. Ensure DenyFSAccessThroughSMs is enabled so endpoints with bearerTokenFile (and other arbitrary file references like tlsConfig.caFile, tlsConfig.certFile, tlsConfig.keyFile) are dropped from produced scrape configuration.
3. Reduce attacker ability to write ServiceMonitor objects that match serviceMonitorSelector / serviceMonitorNamespaceSelector (least privilege on CR creation/update).
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N
CWE-200