Bug 1295998 - search bar does not escape </script> tags from search inputs when producing JSON
Summary: search bar does not escape </script> tags from search inputs when producing JSON
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: web UI
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: 22.1
Assignee: Dan Callaghan
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-06 04:01 UTC by Dan Callaghan
Modified: 2016-02-01 04:30 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-02-01 04:30:57 UTC
Embargoed:


Attachments (Terms of Use)

Description Dan Callaghan 2016-01-06 04:01:38 UTC
Description of problem:
Similar to bug 1215024, just a different piece of template which is not correctly escaping JSON strings embedded in templates. In this case the problem is user-supplied search strings in the search bars.

The problem exists on all grid pages which use the traditional search bar: systems, distros, distro trees, distro families, tasks, jobs, recipes, reserve report. In older Beaker versions this includes other pages too.

Version-Release number of selected component (if applicable):
21.2, but the problem dates back at least to commit 6aa9e505 (Jan 2011) and has probably existed since the search bar was first added.

How reproducible:
easily

Steps to Reproduce:
1. In the search bar's "simplesearch" field, or the value field of an advanced search, enter </script><script>alert('hi') and submit the search.

Actual results:
Alert appears, due to unescaped </script> embedded in a JSON string inside a script on the resulting page.

Expected results:
</script> closing tag should be correctly escaped inside the JSON string so that it's not interpreted as a closing tag by the browser.

Additional info:
The user controlled parameter is read from the URL query string ("reflected XSS" in OWASP parlance) which means it is possible for an attacker to construct a malicious URL containing injected JS and trick a victim into clicking it.

Comment 1 Dan Callaghan 2016-01-06 04:33:16 UTC
http://gerrit.beaker-project.org/4566

Comment 4 Dan Callaghan 2016-02-01 04:30:57 UTC
Beaker 22.1 has been released.


Note You need to log in before you can comment on or make changes to this bug.