Bug 17904: Fix possible SQL injection in late orders

To recreate:
/cgi-bin/koha/acqui/lateorders.plop=send_alert&ordernumber=1)and%20(select*from(select(sleep(20)))a)--%20&letter_code=0

Notice the delay.

The SQL query is not constructed correctly, placeholders must be used.

This vulnerability has been reported by MDSec.

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit b0bb1b0aa6)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
This commit is contained in:
Jonathan Druart 2017-01-13 16:46:51 +01:00 committed by Katrin Fischer
parent 18cd96ece1
commit ddf456271c
1 changed files with 2 additions and 2 deletions

View File

@ -478,10 +478,10 @@ sub SendAlerts {
carp "No order selected";
return { error => "no_order_selected" };
}
$strsth .= join( ",", @$externalid ) . ")";
$strsth .= join( ",", ('?') x @$externalid ) . ")";
$action = "ACQUISITION CLAIM";
$sthorders = $dbh->prepare($strsth);
$sthorders->execute;
$sthorders->execute( @$externalid );
$dataorders = $sthorders->fetchall_arrayref( {} );
}