T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/watchdog.sh:173- Finding
Unreliable network checks trigger privileged and persistent proxy configuration changes
- Content
View full analysis
/dev/null # 清除环境变量 systemctl --user set-environment http_proxy= https_proxy= all_proxy= HTTP_PROXY= HTTPS_PROXY= ALL_PROXY= 2>/dev/null # 注释掉 bashrc 中的代理配置 sed -i 's/^export \(http\|https\|all\)_proxy=/#DISABLED: export \1_proxy=/' ~/.bashrc 2>/dev/null touch "$PROXY_DISABLED_FILE" log "✅ 代理已禁用" } ``` This function is reached after both network probes fail: ```bash check_network() { ping -c 1 -W 3 www.baidu.com > /dev/null 2>&1 && return 0 ping -c 1 -W 3 223.5.5.5 > /dev/null 2>&1 && return 0 return 1 } ``` ### Technical Analysis The watchdog treats failure to ping two hard-coded external targets as proof that the system proxy is faulty. It then performs configuration changes substantially broader than the legitimate requirement of monitoring and restarting the Gateway: - It invokes `sudo` to rename `/etc/profile.d/proxy.sh`, affecting system-wide shell configuration. - It clears proxy variables from the systemd user-manager environment. - It rewrites the user's `~/.bashrc`. - It creates a marker that prevents later attempts to restore or reevaluate the disabled proxy. - It provides no backup, rollback, locking, or validation that the proxy caused the failure. ICMP probes can fail because of packet filtering, DNS failure, endpoint unavailability, routing policy, captive portals, or deliberate network interference. Such failures do not establish that disabling the proxy is appropriate. The `sudo` command does not itself bypass sudo policy. However, if the account has passwordless or cached sudo authoriz ...[truncated 1574 chars]- Remediation
View remediation
