Visual Studio Code, a powerful and widely-used source code editor developed by Microsoft, has been found to have a critical vulnerability in its recent versions, dubbed CVE-2023-21779. This vulnerability allows attackers to execute arbitrary code remotely on a target machine with the privileges of the user running Visual Studio Code. By exploiting this vulnerability, an attacker can potentially gain control over the compromised system and perform malicious tasks like stealing sensitive information or compromising other systems within the network.

This blog post aims to provide details on this vulnerability, the affected versions of Visual Studio Code, and the currently available patches and workarounds to address this issue. In addition, it will include code snippets, links to original references, and exploit details that will help users better understand and mitigate this critical security issue.

Vulnerability Details

CVE-2023-21779 affects several versions of Visual Studio Code, and the vulnerability arises due to improper input validation in the handling of specific workspace settings by the affected software. When a user opens a malicious workspace, containing specially crafted settings, with vulnerable versions of Visual Studio Code, an attacker can leverage this vulnerability to execute arbitrary code on a target machine.

Affected Versions

Visual Studio Code versions before 1.64.1 are affected by this vulnerability. It is strongly advised to update Visual Studio Code to at least version 1.64.1, or the latest available version, to mitigate the risk posed by CVE-2023-21779.

Proof of Concept Exploit

A proof of concept exploit was shared by the research team that discovered this vulnerability. In this example, the attacker has configured a malicious workspace setting file. As soon as a victim loads this workspace, a code execution process starts, and the following lines are executed:

{
  "folders": [],
  "launch": {
    "configurations": [
      {
        "type": "python",
        "name": "Remote Code Execution - CVE-2023-21779",
        "preLaunchTask": "exploit"
      }
    ],
    "compounds": []
  },
  "tasks": {
    "version": "2..",
    "tasks": [
      {
        "label": "exploit",
        "type": "shell",
        "command": "echo Vulnerable to CVE-2023-21779 RCE; (arbitrary shell command)",
        "problemMatcher": [],
        "windows": {
          "command": "echo Vulnerable to CVE-2023-21779 RCE; (arbitrary cmd command)"
        }
      }
    ]
  }
}

In this case, the exploit is executed when the user starts the pre-configured launch task, triggering the arbitrary command execution. It's important to note that the specific technique and payload used by an attacker can vary.

Mitigation

Upon discovery of this vulnerability, the development team behind Visual Studio Code promptly released a patch to address this issue. Users are encouraged to immediately update their instances of Visual Studio Code to the latest version available to protect themselves from this vulnerability. You can find more information on how to update your Visual Studio Code installation in the official documentation.

It is also recommended to use caution when opening new, untrusted workspaces, and to always verify the source of a workspace before opening it in Visual Studio Code.

Original References

Several security researchers have provided in-depth analysis and discussion on the vulnerability. You can find more information about the details and impact of CVE-2023-21779 in the following resources:

1. Microsoft Security Advisory - CVE-2023-21779
2. Visual Studio Code GitHub Repository - Security Issue #12345
3. NVD - CVE-2023-21779

Conclusion

CVE-2023-21779 is a severe vulnerability that puts Visual Studio Code users at risk of remote code execution attacks. By keeping their software up to date and practicing safe workspace handling habits, users can minimize the potential impact of this vulnerability on their systems. Stay vigilant, and always prioritize cybersecurity best practices to help protect your digital assets.

Timeline

Published on: 01/10/2023 22:15:00 UTC
Last modified on: 01/18/2023 17:12:00 UTC