Skip to content

Commit 5a631ac

Browse files
committed
fix: Time-Based Blind SQL Injection via options[stato] Parameter
1 parent e5b7aae commit 5a631ac

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

modules/contratti/ajax/select.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@
5353

5454
if (empty($elements)) {
5555
$where[] = '`an_anagrafiche`.`idanagrafica`='.prepare($superselect['idanagrafica']);
56-
$stato = !empty($superselect['stato']) ? $superselect['stato'] : 'is_pianificabile';
56+
$allowed_stati = ['is_pianificabile', 'is_completato', 'is_fatturabile'];
57+
$stato = !empty($superselect['stato']) && in_array($superselect['stato'], $allowed_stati)
58+
? $superselect['stato']
59+
: 'is_pianificabile';
5760
$where[] = '`idstato` IN (SELECT `id` FROM `co_staticontratti` WHERE '.$stato.' = 1)';
5861
}
5962

modules/ordini/ajax/select.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@
4848
if (empty($elements)) {
4949
$where[] = '`an_anagrafiche`.`idanagrafica`='.prepare($superselect['idanagrafica']);
5050

51-
$stato = !empty($superselect['stato']) ? $superselect['stato'] : 'is_fatturabile';
51+
$allowed_stati = ['is_fatturabile', 'is_evadibile', 'is_completato'];
52+
$stato = !empty($superselect['stato']) && in_array($superselect['stato'], $allowed_stati)
53+
? $superselect['stato']
54+
: 'is_fatturabile';
5255
$where[] = '`or_statiordine`.'.$stato.' = 1';
5356
}
5457
}

modules/preventivi/ajax/select.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@
5656
$where[] = '`an_anagrafiche`.`idanagrafica`='.prepare($superselect['idanagrafica']);
5757
$where[] = '`co_preventivi`.`default_revision`=1';
5858

59-
$stato = !empty($superselect['stato']) ? $superselect['stato'] : 'is_pianificabile';
59+
$allowed_stati = ['is_pianificabile', 'is_completato', 'is_fatturabile', 'is_concluso'];
60+
$stato = !empty($superselect['stato']) && in_array($superselect['stato'], $allowed_stati)
61+
? $superselect['stato']
62+
: 'is_pianificabile';
6063
$where[] = '('.$stato.' = 1)';
6164
}
6265

0 commit comments

Comments
 (0)