Bug 17903: Fix possible SQL injection in serial claims

To recreate:
/cgi-bin/koha/serials/claims.pl?serialid=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: Mason James <mtj@kohaaloha.com>
This commit is contained in:
Jonathan Druart 2017-01-13 16:40:59 +01:00 committed by Mason James
parent 6185e0b62d
commit f68e2f242f
1 changed files with 4 additions and 2 deletions

View File

@ -477,9 +477,11 @@ sub SendAlerts {
return { error => "no_order_selected" };
}
$strsth .= join( ",", @$externalid ) . ")";
$strsth .= join( ",", ('?') x @$externalid ) . ")";
my $sthorders = $dbh->prepare($strsth);
$sthorders->execute;
$sthorders->execute( @$externalid );
my $dataorders = $sthorders->fetchall_arrayref( {} );
my $sthbookseller =