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

Use Python webbrowser module instead of open_url command to prevent arbitrary remote code execution. #55

Open
Thom1729 opened this issue Apr 1, 2018 · 1 comment

Comments

@Thom1729
Copy link

Thom1729 commented Apr 1, 2018

When a link in a preview is clicked, this package uses the open_url command to open the URL of the link. The intended behavior is to open the link in a web browser. However, when you pass a file:// URL to open_url, this is basically like double-clicking the target of the URL. If the target is (say) a shell script, then that script will run. On some OSes, it is possible to specify file:// URLs referring to unknown remote file shares, and the OS will attempt to connect to the share. As a result, you can create a URL that will execute arbitrary code if you click on the link in the preview.

Instead, this package should use Python's built-in webbrowser module.

@math2001
Copy link
Owner

Are you sure that this will fix the problem though? From the Python documentation:

Note that on some platforms, trying to open a filename using this function, may work and start the operating system’s associated program. However, this is neither supported nor portable.

And doesn't open_url rely on something like webbrowser underneath (like a c equivalent)

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

No branches or pull requests

2 participants