Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not load kernels from untrusted locations #11620

Closed
DonJayamanne opened this issue Oct 11, 2022 · 0 comments
Closed

Do not load kernels from untrusted locations #11620

DonJayamanne opened this issue Oct 11, 2022 · 0 comments

Comments

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Oct 11, 2022

Code Execution Vulnerability

A code execution vulnerability exists in VS Code Jupyter 2022.9.100* and earlier versions.
An attacker can create arbitrarry kernels in the %PROGRAMDATA%/jupyter/kernels directory which ends up getting loaded by the Jupyter extension, and results in malicious proceses being launched within the context of the user.

Patches

The fix is available starting with Jupyter 2022.9.1100000000. The fix mitigates this attack by not loading kernlespecs from such untrusted locations.

Workarounds

It is advised that users create kernels in other directories as defined here which do not have such relaxed permission, or create a folder %PROGRAMDATA%\jupyter\kernels\ and configure it to be writable only by the current user.
Optionally, users could continue to use such kernels by updating the setting jupyter.kernels.trusted to include the path to such kernelspecs.

Updating the setting jupyter.kernels.trusted:

  • Copy the fully qualified path to the kernelspec, e.g. C:\ProgramData\Jupyter\kernels\Python3\kernel.json
  • Open the VS User Settings UI using the command Preferences: Open User Settings from the Command Palette.
  • Search for the setting jupyter.kernels.trusted
  • Add a new value into the list using the Add button
  • Re-load VS Code

At any point it is possible to remove the above kernel from the setting there by disallowing this kernel to run in VS Code.

References

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant