Skip to content

Charm configures /etc/grafana-agent.yaml to be world readable

Low
sed-i published GHSA-4v68-8hj7-x63r Jan 17, 2025

Package

grafana-agent (juju charm)

Affected versions

223

Patched versions

None

Description

Summary

When deploying the grafana-agent charm (revision 223) it writes /etc/grafana-agent.yaml to the file system and makes the file world readable (it sets permissions to 0644). The file contains Prometheus scrape configuration which will potentially includes HTTP basic auth information, including passwords in order to access the configured service endpoint.

Keeping the file world readable allows any user on the system to access /etc/grafana-agent.yaml and extract HTTP basic auth information.

Details

The file is written from here and the actual write operation is implemented here. The simple with open(path, "w") as f: will default to 0644 for the target file. Other files, e.g. certificates and their keys written by write_file might be affected as well, but I haven't expored this further yet.

PoC

  1. Deploy grafana-agent: $ juju deploy grafana-agent
  2. Related to any other application, e.g. $ juju reate grafana-agent:cos-agent ams:cos-agent
  3. Check permissions of /etc/grafana-agent.yaml on the machine grafana-agent is deployed on

Impact

An arbitrary user having access to the machine grafana-agent is deployed on can extract password information for other services grafana-agent is meant to scrape for metrics.

Severity

Low

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N

CVE ID

No known CVE

Weaknesses

Credits