Back to skill

Security audit

github改hosts文件加速skill,仅针对windows

Security checks for vulnerabilities and agentic risk

Overview

This skill is intended to speed up GitHub on Windows, but it would make persistent administrator-level changes to the system hosts file with weak safeguards.

Review carefully before installing. Only use it for an explicit GitHub hosts-file repair request, inspect the exact entries before any administrator write, back up the hosts file first, and be prepared to remove the entries if GitHub access breaks or certificate warnings appear.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:35
Finding
Unsafe Cross-Domain IP Selection and Privileged Hosts-File Modification<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 35-66 **Vulnerability Type**: Unsafe privileged system-file modification **Risk Level**: Medium ### Vulnerable Code ```powershell $hostsPath = "$env:SystemRoot\System32\drivers\etc\hosts" $domains = @("github.com", "api.github.com", "objects.githubusercontent.com") # Resolve IPs $ips = @{} foreach ($domain in $domains) { $result = nslookup $domain 2>$null $ips[$domain] = ($result | Select-String -Pattern "Addresses:" -Context 0,10 | ForEach-Object { $_.Context.PostContext }) -replace '\s+', '' | Where-Object { $_ -match '^\d+\.\d+\.\d+\.\d+$' } } # Ping each IP and find fastest $results = @() foreach ($ip in ($ips.Values | Select-Object -Unique)) { $avg = (ping -n 3 $ip | Select-String -Pattern "平均").ToString() -replace '.*= (\d+)ms.*', '$1' if ($avg) { $results += [PSCustomObject]@{ IP = $ip; Avg = [int]$avg } } } $fastest = ($results | Sort-Object Avg | Select-Object -First 1).IP # Update hosts $entry = "$fastest github.com`n$fastest api.github.com" $current = Get-Content $hostsPath -Raw -ErrorAction SilentlyContinue if ($current -notmatch "github\.com") { Add-Content -Path $hostsPath -Value $entry } else { $updated = $current -replace "[\d\.]+\s+github\.com`n?[\d\.]+\s+api\.github\.com", $entry Set-Content -Path $hostsPath -Value $updated } # Flush DNS ipconfig /flushdns | Out-Null Write-Host "Done! Fastest IP: $fastest" ``` ### Technical Analysis The script combines all IPv4 addresses resolved for `github.com`, `api.github.com`, and `objects.githubusercontent.com` into one candidate pool. It then selects a single address based only on ping latency and assigns that address to both `github.com` and `api.github.com`. This process does not verify that the selected address is valid for each hostname being mapped. An address returned for `objects.githubusercontent.com`, for example, can be selected and assigned to the two unrelated hostnames. Latency alon ...[truncated 2893 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Preserve a separate candidate list for each hostname and select an address independently for each domain. 2. Abort without modifying the hosts file if any resolution, validation, or latency test fails. 3. Validate each candidate by establishing an HTTPS connection using the intended hostname and normal certificate verification, rather than relying only on ping latency. 4. Replace locale-dependent parsing of `ping` output with locale-independent PowerShell networking APIs. 5. Display the exact proposed old and new mappings and obtain explicit user confirmation before requesting elevation or writing the file. 6. Back up the hosts file before modification and provide an automated rollback command. 7. Manage entries inside explicit marker comments so only entries owned by this skill are modified. 8. Preserve unrelated entries, comments, encoding, and line endings. 9. Write changes to a temporary file, validate the result, and then use an atomic replacement operation. 10. Do not write an empty or null IP address under any circumstances. 11. Either add and validate a domain-specific entry for `objects.githubusercontent.com` or remove it from the resolution list. 12. Prefer normal DNS and CDN routing unless there is a well-justified operational need for static hosts entries. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (1)

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger list includes overly broad terms such as "hosts文件", which can activate the skill in contexts unrelated to GitHub optimization. Because the skill instructs modification of the Windows hosts file with administrator privileges, accidental activation could lead to unsafe or inappropriate system file changes in response to ambiguous user requests.

Static analysis

No suspicious patterns detected.