-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
- replace the result of
pip list | grep dash
below
dash 2.9.3
dash-auth 2.0.0
dash-bootstrap-components 1.4.1
dash-core-components 2.0.0
dash-extensions 0.1.13
dash-html-components 2.0.0
dash-table 5.0.0
-
if frontend related, tell us your Browser, Version and OS
- OS: OSX
- Browser Firefox
- Version 102.10
Describe the bug
Deploying a dash app with pages allows attackers to embed code into the webapp. This is a potential security vulnerability since it allows attackers to execute arbitrary code in the context of the dash sandbox.
Concretely, if use_pages is true, dash calls self._pages_meta_tags()
Line 968 in a8b3ddb
if self.use_pages: |
which always adds the twitter and og meta tags
Line 906 in a8b3ddb
<meta property="twitter:card" content="summary_large_image"> |
The twitter meta tag includes the URL
<!-- Twitter Card data -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="{flask.request.url}">
<meta property="twitter:title" content="{title}">
<meta property="twitter:description" content="{description}">
<meta property="twitter:image" content="{image_url}">
So if the dash app is involved with a URL that includes a <script>
tag, the script specified in the tag will be executed.
Example URL
[dash_app_base_url]/?'"--></style></scRipt><scRipt>netsparker(0x000F45)</scRipt>
This causes our dash app to fail cyber security/pen testing scans.
A workaround is to a custom index_string
which removes all meta
tags, but that has the disadvantage of not including any meta tags, even the ones that we might want.
A better option would be to make the twitter and og meta tags opt-in; it is not clear that specifying a twitter card is necessary for all deployers.
I am happy to submit a PR (include_card_configs
property) if that would help
Screenshots
Vulnerability report

Page source includes the embedded script

Example of an embedded alert in firefox
