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

Response headers are not escaped when generating the curl command, allowing for XSS

Open joevennix opened this issue 10 years ago • 0 comments

To reproduce, hit an API endpoint that returns a response with a Content-type of <script>alert(1)</script>. The script will be injected into the page and will execute. An example sinatra server is attached that can be used to reproduce. Set /swagger.json as the JSON file, and try the GET /v2/pet/1 call.

The sinatra file can be found here, you will need to gem install sinatra before running: https://gist.github.com/joevennix/df28a686471860e0d562

joevennix avatar Jan 12 '16 21:01 joevennix