We received email from our campus InfoSec group that a portion of our Koha site was vulnerable to cross-site scripting attacks. Below is the gist of the email we received: GET: https://[our server]cgi-bin/koha/opac-shelves.pl?op=list&category=%22/%3E%3Cimg%20src=x%20onerror=%22alert(%27Doh!%20Insert%20Hax%20Here.%27)%22%20/%3E%3C!%E2%80%94 ATTACK DETAILS: This page is vulnerable to Cross-site scripting attacks. Cross-site scripting attacks, in general, are an issue because they are enabling attacks. Specially-crafted malicious URLs can steal authentication tokens/cookies when a logged-in user visits them, giving the attacker full access to that user's account in the application. Reflected XSS attacks, in particular, are a concern as they can be used to socially engineer a user into clicking on what appears to be a legitimate URL. Please also consider the following: - Web application security testing should be performed regularly, especially for any public web applications. This includes tracking application inventory, general code review and vulnerability assessments using web application security testing tools. - All input received by the web server should be checked before it is processed. The best method is to remove all unwanted input and accept only expected input. For example, ensure angle brackets are not allowed in any input to any Web page fields. Additionally, no syntactic input should be allowed. Syntactic input can come from databases, other servers, etc. All input into a Web application must be filtered to ensure the delivery of clean content to individuals using your service. - Other References: OWASP Guide to Building Secure Web Applications and Web Services https://www.owasp.org/index.php/Category:OWASP_Guide_Project
Created attachment 67192 [details] [review] Bug 19333: Fix XSS in opac-shelves category is send back to the template, it must be escaped
Are 506 and 514 correct? What about line 685? 684 is escaped.
506 <input type="hidden" name="category" value="category" /> 514 <input type="hidden" name="category" value="category" /> Are wrong, they are not TT variables 685 <input type="hidden" name="category" value="[% s.category %]" /> Should be ok, come from the DB and is varchar(1)
Marking this failed QA because of Jonathan's comment#3
(In reply to Katrin Fischer from comment #4) > Marking this failed QA because of Jonathan's comment#3 My comment was saying the patch is correct ;)
Created attachment 67951 [details] [review] Bug 19333: Fix XSS in opac-shelves category is send back to the template, it must be escaped Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Moving to PQA in same run
Pushed to master for 17.11, thanks to everybody involved!
This patch has been pushed to 16.11.x and will be in 16.11.13.
These patches have been pushed to 17.05.x and are in 17.05.05.
Pushed to 16.05.x, for 16.05.18 release