Skip to content

Malicious project can cause vscode-bazel to run arbitrary executable when linting a *.bzl file

High
philwo published GHSA-2rcw-j8x4-hgcv Apr 14, 2021

Package

vscode-bazel (Visual Studio Code Plug-ins)

Affected versions

0.1.0 - 0.4.0

Patched versions

0.4.1

Description

Impact

An attacker can place a crafted JSON config file into the project folder pointing to a custom executable, leading to arbitrary code execution.

vscode-bazel <= 0.4.0 allow workspace settings to change the path of an executable file used to lint *.bzl files (setting "bazel.buildifierExecutable"). Since the workspace setting can be modified just by dropping a (malicious) JSON config file into a folder, it's possible to execute arbitrary executables from malicious folders this way.

Patches

The problem has been patched in vscode-bazel 0.4.1. We recommend upgrading to version 0.4.1 or above.

For more information

Thanks to @Ry0taK for finding, reporting this vulnerability responsibly and helping us patch it!

If you have any questions or comments about this advisory:

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Local
Attack complexity
Low
Privileges required
Low
User interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H

CVE ID

CVE-2021-22539

Weaknesses

External Control of File Name or Path

The product allows user input to control or influence paths or file names that are used in filesystem operations. Learn more on MITRE.

Credits