XSS in HTML report output

Bug #1612988 reported by Travis McPeak
266
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bandit
Fix Released
Undecided
Unassigned
OpenStack Security Notes
Fix Released
Undecided
Tim Kelsey

Bug Description

The following Python code snippet will cause script execution when a HTML report is generated and viewed:

import subprocess
subprocess.Popen("<script>alert(1)</script>", shell=True)

This is because the HTML formatter is failing to HTML escape the code snippets. We need to investigate the best standard library (or OpenStack condoned library) to HTML escape and then apply that to the issue text.

Revision history for this message
Travis McPeak (travis-mcpeak) wrote :

Alright guys, what's the best way to HTML escape? We should roll a new release for this ASAP.

Revision history for this message
Stanislaw Pitucha (viraptor-gmail) wrote : Re: [Bug 1612988] Re: XSS in HTML report output

cgi.escape, see
https://github.com/HewlettPackard/reconbf/commit/bc2e79f94724fe9953f70ee1e5e3a138147fdd41

I'll do the patch Monday morning unless someone wants to one the weekend?

Revision history for this message
Tim Kelsey (tim-kelsey) wrote :

OK, Stan made the patch to fix this but was unable to make a release so I have done so.We should probably try to handle this sort of stuff in a more organised way going forward but bandit 1.1.0 is out now (also has new test for httpoxy).

Changed in bandit:
status: New → Fix Released
Revision history for this message
Tim Kelsey (tim-kelsey) wrote :
Revision history for this message
Ian Cordasco (icordasc) wrote :

We should open this up now that the fix has been merged and released.

Revision history for this message
Tim Kelsey (tim-kelsey) wrote :

yup, done

information type: Private Security → Public Security
Revision history for this message
Tim Kelsey (tim-kelsey) wrote :

I have opened an OSSN to cover this as well

Tim Kelsey (tim-kelsey)
Changed in ossn:
assignee: nobody → Tim Kelsey (tim-kelsey)
status: New → In Progress
Revision history for this message
Luke Hinds (lhinds) wrote :

This has been published as OSSN-0070:

https://wiki.openstack.org/wiki/OSSN/OSSN-0070

Changed in ossn:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on bandit (stable/0.17.0)

Change abandoned by Ian Cordasco (<email address hidden>) on branch: stable/0.17.0
Review: https://review.openstack.org/355294

To post a comment you must log in.
This report contains Public Security information  
Everyone can see this security related information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.