swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

Property names are not escaped and allow XSS

Open joevennix opened this issue 10 years ago • 13 comments

To reproduce, point swagger-ui at a JSON schema file that uses a model with a property containing <script>alert(1)</script>. The script will execute. I've attached a sinatra server that demonstrates the issue by replacing the "photoUrls" property with "photoUrls<script>alert(1)</script>":

https://gist.github.com/joevennix/b2bc8c04fd74f2f5d2b2

joevennix avatar Jan 13 '16 04:01 joevennix

Any update on when this might be fixed? Using a Content-Security-Policy header containing connect-src 'self' online.swagger.io mitigates this, but Internet Explorer is still vulnerable.

danderson00 avatar Jul 29 '16 23:07 danderson00

@danderson00 - please consider submitting a PR to fix the issue, but we'll try to look into it as soon as possible as well.

webron avatar Jul 29 '16 23:07 webron

@fehguy is there an ETA for this issue's resolution?

bradygaster-zz avatar Aug 15 '16 17:08 bradygaster-zz

Any day now

fehguy avatar Aug 15 '16 17:08 fehguy

See https://github.com/swagger-api/swagger-ui/commit/a906cffea4550eaa5369e4933a50753213cf09df

fehguy avatar Aug 23 '16 23:08 fehguy

Is there any CVE for this one?

hoomanb1 avatar Sep 13 '16 05:09 hoomanb1

FYI, this is also still being reported as not fixed on the nodesecurity.io advisory which is used by some dependency scanners like david-dm. Not sure how to report the version it is fixed in.

danderson00 avatar Sep 13 '16 23:09 danderson00

@fehguy what's the status here?

bradygaster-zz avatar Sep 13 '16 23:09 bradygaster-zz

We've pushed out three close releases - 2.2.1, 2.2.2 and 2.2.3 handling all the known XSS issues we've had whether reported to us (publicly or otherwise) or with our own experience, including this one.

Should you find any new additional XSS issues, please open new tickets on those and we'll address them as soon as possible.

webron avatar Sep 14 '16 04:09 webron

@bradygaster I contacted the node security folks and they've updated their page to show that 2.2.1 has this fixed.

fehguy avatar Sep 14 '16 14:09 fehguy

Thanks for your work on this!

danderson00 avatar Sep 14 '16 16:09 danderson00

@fehguy thanks so much! got your email. looks like things are good.

bradygaster-zz avatar Sep 14 '16 17:09 bradygaster-zz

Just an FYI a cve-2016-1000229 has been assigned to this issue.

hoomanb1 avatar Oct 14 '16 02:10 hoomanb1