T06 · System Persistence
- Location
guides/03-advanced-usage.md:333- Finding
Boot-Persistent Glances Service Installed as a System Unit
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This Glances monitoring skill is mostly purpose-aligned, but it gives agents and users copy-paste guidance for privileged containers, public monitoring endpoints, sudo use, and persistent services without enough scoping or safety controls.
Review this skill before installing. Use it only in trusted administrative environments, avoid running the privileged Docker examples unless you understand Docker socket risk, bind Web/API/server modes to localhost by default, add authentication and network controls before remote access, avoid sudo pip and mutable latest images, and manually review any systemd or cron setup before allowing it to persist.
guides/03-advanced-usage.md:333Boot-Persistent Glances Service Installed as a System Unit
guides/03-advanced-usage.md:429Cron Persistence Replaces the User's Entire Crontab
guides/03-advanced-usage.md:19Monitoring Services Are Exposed on All Interfaces Without Mandatory Authentication
troubleshooting.md:80Troubleshooting Guidance Grants Root or Root-Equivalent Access
guides/01-installation.md:42Unpinned Packages and Mutable Container Images Create Supply-Chain Risk
guides/03-advanced-usage.md:192Plaintext and Weak Credential Examples Encourage Insecure Configuration
Mounting /var/run/docker.sock into a container gives processes inside the container effective control over the Docker daemon, which commonly equates to root-equivalent access on the host. Even read-only socket mounts are dangerous because the UNIX socket permissions do not meaningfully constrain Docker API operations the way a read-only file mount would.
docker pull nicolargo/glances:latest
# 以终端模式运行(显示本机系统信息)
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro \
--pid host --network host \
-it nicolargo/glances:latest
Using --pid host shares the host PID namespace with the container, allowing visibility into host processes and weakening isolation. Combined with socket mounts and host networking, this significantly increases the blast radius if the container image is malicious or the application is compromised.
# 以终端模式运行(显示本机系统信息)
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro \
--pid host --network host \
-it nicolargo/glances:latest
# 以 Web 服务器模式运行(端口 61208)
This web-server example again mounts the Docker socket into a long-running service container, extending the window for abuse if the container or exposed web interface is compromised. In this context, the risk is amplified because the service is persistent and network reachable.
docker run -d --restart="always"
-p 61208-61209:61208-61209
-e GLANCES_OPT="-w"
-v /var/run/docker.sock:/var/run/docker.sock:ro
--pid host
nicolargo/glances:latest
The persistent web mode also uses --pid host, which reduces container isolation for a network-exposed service. This is especially risky because a compromise of the web service could grant an attacker richer insight into host processes and aid lateral movement or escape attempts.
-p 61208-61209:61208-61209
-e GLANCES_OPT="-w"
-v /var/run/docker.sock:/var/run/docker.sock:ro
--pid host
nicolargo/glances:latest
The Docker monitoring example grants powerful host access (/var/run/docker.sock and --pid host) but does not warn that this effectively gives the container extensive visibility into, and potential control over, the host. Readers may run the example verbatim without understanding that Docker socket access can often be escalated into host compromise.
Mounting /var/run/docker.sock into a container gives that container the ability to interact with the Docker daemon, which often amounts to root-equivalent control over the host. In this monitoring-guide context, the risk is heightened because the example is presented as a convenient copy-paste deployment without emphasizing the host-compromise implications.
--name=glances
-p 61208-61209:61208-61209
-e GLANCES_OPT="-w"
-v /var/run/docker.sock:/var/run/docker.sock:ro
--pid host
nicolargo/glances:latest
Using --pid host places the container in the host PID namespace, exposing host process information and weakening isolation boundaries. Combined with other privileges, it can materially increase the impact of a container compromise and leak sensitive host process metadata.
-p 61208-61209:61208-61209
-e GLANCES_OPT="-w"
-v /var/run/docker.sock:/var/run/docker.sock:ro
--pid host
nicolargo/glances:latest
Running a container with --pid host exposes host process information to the container and weakens isolation boundaries. In combination with monitoring software this may be intentional, but it materially increases the impact of any compromise of that container.
方案B(Docker): 添加必要权限
docker run --rm -it \
--pid host \
--network host \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
nicolargo/glances:latest-full
Using --network host removes network namespace isolation and exposes the container directly on the host network stack. This increases attack surface and can enable broader reconnaissance or interference if the container is compromised.
docker run --rm -it \
--pid host \
--network host \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
nicolargo/glances:latest-full
Mounting /var/run/docker.sock into a container grants that container control over the Docker daemon, which is effectively control over the host in many deployments. Even read-only mounting of the socket file does not meaningfully limit API operations, so this is dangerous advice without a warning.
docker run --rm -it
--pid host
--network host
-v /var/run/docker.sock:/var/run/docker.sock:ro
nicolargo/glances:latest-full
Potential security issue detected. Manual review is recommended.
docker ps
# 检查 Docker SDK 是否安装
python -c "import docker; c = docker.from_env(); print(c.containers.list())"
# 检查 docker.sock 权限
ls -la /var/run/docker.sock
Potential security issue detected. Manual review is recommended.
python -c "import docker; c = docker.from_env(); print(c.containers.list())"
ls -la /var/run/docker.sock
**常见原因**:
Instructing users to point Glances directly at /var/run/docker.sock enables privileged interaction with the Docker daemon. In the context of a monitoring tool, this may be functionally useful, but it still grants access to a root-equivalent control plane and should be clearly warned about.
方案C: 指定 Docker socket
glances --docker-sock /var/run/docker.sock
The skill explicitly encourages Web UI, API, server mode, remote access, and metric export, but provides no warning that these actions can expose sensitive system telemetry or open network-accessible services. In a monitoring skill, this omission is meaningful because users may launch Glances in listening modes or export data off-host without understanding authentication, binding, firewall, or data sensitivity implications.
The quick-start section includes commands that start a web server, server mode, remote client connections, REST API mode, and data export, yet gives no accompanying warning about network exposure or telemetry leakage. These copy-pasteable examples increase risk because users may execute them directly, potentially exposing monitoring endpoints or sending operational data to external systems without access controls.
The guide instructs users to pull nicolargo/glances:latest, which is mutable and can change over time without notice. This creates supply-chain and reproducibility risk because users may receive an unexpected image version, including a compromised one if the upstream registry or tag is tampered with.
The Docker examples combine host PID sharing, host networking, and runtime socket mounts, but the document does not clearly warn that these options grant deep visibility into and influence over the host. In an AI-assisted execution context, users may run these commands verbatim without understanding the privilege boundary they are removing.
The docker run example ultimately launches nicolargo/glances:latest, so it inherits the same mutable-image risk as the preceding pull command. Because the command also runs with elevated container privileges, using an unpinned image makes the consequences of a malicious or unexpected image materially worse.
This detached docker run command also uses nicolargo/glances:latest, exposing users to mutable-tag supply-chain risk. Since it starts a persistent web service, an unexpected image change could introduce long-lived exposure on the host.
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
# Linux / macOS
mkdir -p ~/.config/glances
# 查看默认配置(Glances 自带示例配置)
glances --config /etc/glances/glances.conf 2>/dev/null || echo "使用默认配置"
The upgrade guidance again tells users to pull :latest, repeating the mutable image risk during maintenance operations. This can silently change deployed behavior and import unreviewed code into an environment.
The guide includes sudo pip3 install glances even though it labels it as not recommended. Installing Python packages with sudo pip can overwrite system-managed files, break OS package integrity, and execute arbitrary package install scripts as root, which is a real risk if users copy the fallback command.
pip3 install --user glances
sudo pip3 install glances
### 问题3: 国内网络超时
The manifest describes the skill as a cross-platform system monitoring tool, which implies observing and reporting system state. This guide instructs use of k to terminate a selected process with SIGKILL, which is an active system-control capability rather than monitoring and is not justified by the stated purpose alone.
The guide lists destructive shortcuts such as process kill (k) and alert deletion/clearing (w, x) without warning about operational impact or irreversibility. For an AI-consumable skill, that creates unsafe affordances by normalizing actions that can terminate workloads or erase useful troubleshooting evidence.
The guide explicitly tells the AI it can install bottle via pip3 install bottle, which expands the agent's scope from monitoring into modifying the host environment. Package installation can introduce supply-chain risk, alter system state, and violate least-privilege expectations for a monitoring-oriented skill.
No suspicious patterns detected.