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

[BUG] Possible XSS issue within metadata #2707

Closed
chrispymm opened this issue Dec 1, 2023 · 3 comments
Closed

[BUG] Possible XSS issue within metadata #2707

chrispymm opened this issue Dec 1, 2023 · 3 comments

Comments

@chrispymm
Copy link

Describe your context

dash                 2.8.0
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-table           5.0.0

Describe the bug
When accessing this url (or similar)

http://0.0.0.0:8050/wp-content/plugins/dzs-videogallery/deploy/designer/preview.php?swfloc="><script>alert(document.domain)</script>

I see an alert pop up on the screen with the document.domain showing that the JS within the url was inserted into the page.

Inspecting the page I can see that the metadata in the head contains opengraph tags for a twitter card, and the twitter:url tag has the offending JS appended after it

<meta name="description" content="">
<!-- Twitter Card data -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="http://0.0.0.0:8050/wp-content/plugins/dzs-videogallery/deploy/designer/preview.php?swfloc="><script>alert(document.domain)</script>

Our app is using an index string as per the docs, but this issue appears even without it.

app.index_string = """
<!DOCTYPE html>
<html>
    <head>
        {%metas%}
        <title>{%title%}</title>
        {%favicon%}
        {%css%}
    </head>
    <body>
        {%app_entry%}
        {%config%}
        {%scripts%}
        {%renderer%}
    </body>
</html>
"""

I am unsure where the twitter card metadata is coming from, our app does not add it (as far as I can see) but the dash docs only claim to add 3 meta tags by default, none of which is twitter/og related. Is this part of dash?

Another maybe related note, providing an array of meta tags to the Dash command as per the docs does not change the tags that are output.

Expected behavior

No JS alert should be seen. Url should be escaped before insertion into the page.

I am aware this could be specific to our app, but I can find nothing within our code that is modifying these tags, so it appears to be an issue with dash. Any help or guidance would be appreciated.

@AnnMarieW
Copy link
Collaborator

AnnMarieW commented Dec 3, 2023

Related to #2536

@alexcjohnson
Copy link
Collaborator

Thanks for reminding me @AnnMarieW!

@chrispymm can you try updating to the latest Dash v2.14? We included a fix for #2536 (#2540) in Dash v2.10 that I suspect fixes your flavor too.

@chrispymm
Copy link
Author

Thanks @alexcjohnson, I've updated to 2.14.2 and that has resolved the issue. My apologies, I know I upgraded as part of my attempts to solve the issue, and only raised the issue because it hadn't worked! But clearly I made a mistake somewhere 🤦‍♂️.

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

No branches or pull requests

3 participants