Summary
Glances' IP plugin allows user-controlled configuration of the public_api endpoint, which is used directly in outbound HTTP requests without validating scheme, hostname, or IP address.
An attacker who can change the Glances configuration may abuse this to make the server perform arbitrary HTTP requests to internal or external systems and, when basic authentication is configured, to leak credentials to attacker-controlled endpoints.
Affected context
This vulnerability affects Glances deployments that:
- Enable and use the IP plugin with the
public_apiconfiguration parameter, - Allow non-admin users, automation, or external processes to modify or influence the Glances configuration file or environment,
- Run Glances in environments with network access to internal services, cloud metadata endpoints, or other sensitive HTTP(S) targets.
In such scenarios, the server's own network position and trust relationships can be abused to reach systems that are not directly accessible to the attacker.
Exploit preconditions
- Attack surface: Glances configuration layer and any interface or mechanism that can modify the
public_api,public_username, orpublic_passwordsettings (e.g., configuration files, management scripts, container env templating). - Required access: Ability to influence or edit the Glances configuration; no direct HTTP endpoint in Glances needs to be exposed to the attacker for exploitation.
- Trigger point: Execution of the Glances IP plugin functionality that performs outbound HTTP requests using
public_api(typically during monitoring or plugin refresh cycles). - Why exploitation is possible: The
public_apivalue is passed directly to the HTTP client (urlopen_auth) with no scheme restriction, hostname/IP validation, or allow/deny lists. When credentials are configured, they are automatically attached via anAuthorization: Basicheader to any requested URL, including attacker-specified ones.
Why this happens
The underlying issue is a classic Server-Side Request Forgery (SSRF) pattern: user-influenced URLs are used directly for server-initiated HTTP requests without enforcing a trust boundary.
Concretely:
- The
public_apiconfiguration parameter is treated as a fully trusted URL. - No validation is performed to ensure it targets only intended, safe domains, protocols, or address ranges.
- The HTTP client wrapper (
urlopen_auth) blindly uses this value, allowing requests to arbitrary internal or external hosts. - When
public_usernameandpublic_passwordare set, the code automatically includes them in the Authorization header for all such requests.
This behavior maps to CWE-918: Server-Side Request Forgery (SSRF), where a server's network position and credentials are exposed through unvalidated, user-controlled outbound requests.
Potential impact
- Access to internal HTTP(S) services that are not directly exposed to the internet (e.g., internal APIs, admin panels).
- Retrieval of sensitive data from cloud provider metadata endpoints, potentially exposing instance credentials or configuration details.
- Credential exfiltration when
public_usernameandpublic_passwordare configured, as these may be sent to attacker-controlled hosts in theAuthorization: Basicheader. - Use of the Glances host as a pivot for internal network reconnaissance, including port probing via HTTP-based responses.
- Potential interaction with control-plane or management APIs reachable only from inside the network, which could expand the compromise if additional weaknesses exist.
General mitigation guidance
Effective mitigation patterns focus on reducing trust in configuration-controlled URLs and hardening outbound network behavior:
- Constrain target endpoints:
- Introduce strict allow-lists for
public_apiso only known, approved domains or paths can be used. - Enforce scheme restrictions (e.g.,
https://only) and prohibit ambiguous or non-HTTP schemes. - Validate that hostnames and IPs do not resolve to loopback, link-local, or private address ranges unless explicitly required and controlled.
- Separate sensitive credentials:
- Avoid automatically attaching credentials to arbitrary URLs; tie credentials to specific, validated hosts or endpoints.
- Use scoped authentication mechanisms where secrets are bound to particular domains rather than generic configuration parameters.
- Harden network egress:
- Apply firewall or egress filtering from the Glances host/container to limit which external and internal addresses can be reached over HTTP/HTTPS.
- Use proxy or service mesh policies to confine outbound traffic to vetted services.
- Improve configuration hygiene:
- Restrict who can modify Glances configuration files or related deployment manifests.
- Treat monitoring configuration as a sensitive asset, aligning its access controls with application-level secrets.
How teams detect issues like this
Detection should combine code-level analysis with runtime monitoring:
- Static analysis and code review:
- Flag any use of configuration-derived or user-controlled values passed directly into HTTP client APIs (e.g.,
urlopen,requests.get, or wrappers likeurlopen_auth). - Look for lack of hostname, scheme, or IP range validation around outbound URL construction.
- Review plugin and integration code for patterns where credentials are attached to all requests without host-bound scoping.
- Configuration and policy checks:
- Automatically audit Glances configuration for non-default or suspicious
public_apivalues (e.g., IP literals, internal domain patterns, link-local/cloud metadata endpoints). - Implement CI/CD checks that reject deployment artifacts configuring
public_apito unapproved targets.
- Network and runtime monitoring:
- Monitor outbound HTTP(S) requests from Glances hosts or containers, focusing on calls to internal IP ranges or metadata service endpoints.
- Use anomaly detection to spot unusual destinations or spikes in traffic originating from monitoring nodes.
Automated security scanners and code review tools can be configured with SSRF-focused rules to surface these patterns before deployment.

