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

XSS vulnerability in GraphiQL implementation #275

Open
bryanenders opened this issue Oct 14, 2022 · 0 comments
Open

XSS vulnerability in GraphiQL implementation #275

bryanenders opened this issue Oct 14, 2022 · 0 comments

Comments

@bryanenders
Copy link

The value of the GET parameter query is returned unescaped in the main block of inline JavaScript. Without Content Security Policy (CSP), one is able to break out of the config variable and execute arbitrary JavaScript.

It appears that graphiql_workspace.html.eex renders the page with the query_string variable. This template is loaded by Absinthe.Plug.GraphiQL which attempts to escape the query parameter. It is trivial to bypass this escaping with a backslash.

Steps to Reproduce

  1. Browse /api/v2_alpha/graphiql?query=xxx\%27});confirm(document.domain);%20var%20x=new%20graphiqlWorkspace.AppConfig(%22x%22,{//.
  2. Observe the JavaScript alert dialog with the value of document.domain.

Credits

40826d uncovered this vulnerability and wrote the initial draft of this bug report

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

1 participant