Koha-clms/patroncards
Jonathan Druart b5b633b9eb Bug 17900: Fix possible SQL injection in patron cards template editing
To recreate:
/cgi-bin/koha/patroncards/edit-template.pl?op=edit&element_id=23%20and%201%3d2+union+all+select+1,user(),@@version+--%20

Look at the Profile dropdown list.

To fix this problem and to make sure it does not appears anywhere else
in the label and patroncards modules, I have refactored the way the
queries are built in C4::Creators::Lib
Now all of the subroutine takes a hashref in parameters with a 'fields'
and 'filters' parameters.
From these 2 parameters the new internal subroutine _build_query will
build the query and use placeholders.

Test plan:
1/ Make sure you do not recreate the vulnerability with this patch
applied.
2/ With decent data in the labels and patroncards modules, compare all
the different view (undef the New and Manage button groups) with and
without this patch applied.
=> You should not see any differences.

This vulnerability has been reported by MDSec.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit a70980d825)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
2017-01-30 16:25:01 +01:00
..
add_user_search.pl Bug 16459: Add patron to a patron card requires catalogue permission 2016-08-16 16:16:45 +02:00
card-print.pl Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
create-pdf.pl Bug 14138: Followup for 3.22 2016-08-25 10:30:29 +02:00
edit-batch.pl Bug 16154: CGI->multi_param - Assign a list 2016-05-16 14:42:51 +02:00
edit-layout.pl Bug 14107: Patron cards: Make barcode width and height scaling editable 2015-07-24 14:07:18 -03:00
edit-profile.pl Bug 17900: Fix possible SQL injection in patron cards template editing 2017-01-30 16:25:01 +01:00
edit-template.pl Bug 17900: Fix possible SQL injection in patron cards template editing 2017-01-30 16:25:01 +01:00
home.pl Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
image-manage.pl Bug 17879: Use image filename if no image name is entered 2017-01-19 16:09:11 +01:00
manage.pl Bug 17900: Fix possible SQL injection in patron cards template editing 2017-01-30 16:25:01 +01:00
print.pl Bug 17900: Fix possible SQL injection in patron cards template editing 2017-01-30 16:25:01 +01:00