FIX security vulnerability reported by ADLab of Venustech

This commit is contained in:
Laurent Destailleur 2017-12-21 12:47:49 +01:00
parent 3f6b3b51ca
commit 4a5988accb
10 changed files with 68 additions and 17 deletions

View File

@ -36,7 +36,7 @@ $langs->load("users");
if (!$user->rights->adherent->lire) if (!$user->rights->adherent->lire)
accessforbidden(); accessforbidden();
$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"]; $rowid=GETPOST("rowid",'int');
@ -44,10 +44,10 @@ $rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
* View * View
*/ */
llxHeader();
$form = new Form($db); $form = new Form($db);
llxHeader();
$object = new Subscription($db); $object = new Subscription($db);
$result = $object->fetch($rowid); $result = $object->fetch($rowid);

View File

@ -19,6 +19,14 @@
* *
*/ */
// Protection to avoid direct call of template
if (empty($langs) || ! is_object($langs))
{
print "Error, template page can't be called as URL";
exit;
}
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$langs->load("cashdesk"); $langs->load("cashdesk");

View File

@ -17,6 +17,14 @@
* *
*/ */
// Protection to avoid direct call of template
if (empty($langs) || ! is_object($langs))
{
print "Error, template page can't be called as URL";
exit;
}
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';

View File

@ -19,6 +19,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($langs) || ! is_object($langs))
{
print "Error, template page can't be called as URL";
exit;
}
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';

View File

@ -16,6 +16,15 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($langs) || ! is_object($langs))
{
print "Error, template page can't be called as URL";
exit;
}
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$langs->load("main"); $langs->load("main");

View File

@ -16,6 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($langs) || ! is_object($langs))
{
print "Error, template page can't be called as URL";
exit;
}
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$langs->load("banks"); $langs->load("banks");

View File

@ -17,6 +17,14 @@
* *
*/ */
// Protection to avoid direct call of template
if (empty($langs) || ! is_object($langs))
{
print "Error, template page can't be called as URL";
exit;
}
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");

View File

@ -30,7 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$langs->load("orders"); $langs->load("orders");
$langs->load("companies"); $langs->load("companies");
$_socid = $_GET["id"]; $id = GETPOST('id','int');
$_socid = GETPOST("id",'int');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
@ -45,10 +46,10 @@ if ($user->societe_id > 0)
if ($_POST["action"] == 'setpricelevel') if ($_POST["action"] == 'setpricelevel')
{ {
$soc = New Societe($db); $soc = New Societe($db);
$soc->fetch($_GET["id"]); $soc->fetch($id);
$soc->set_price_level($_POST["price_level"],$user); $soc->set_price_level($_POST["price_level"],$user);
header("Location: multiprix.php?id=".$_GET["id"]); header("Location: multiprix.php?id=".$id);
exit; exit;
} }

View File

@ -33,7 +33,7 @@ $langs->load("orders");
$langs->load("companies"); $langs->load("companies");
// Security check // Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:''; $socid = GETPOST("socid", 'int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'societe',$socid,''); $result = restrictedArea($user, 'societe',$socid,'');

View File

@ -81,7 +81,8 @@ function test_sql_and_script_inject($val, $type)
// For SQL Injection (only GET and POST are used to be included into bad escaped SQL requests) // For SQL Injection (only GET and POST are used to be included into bad escaped SQL requests)
if ($type != 2) if ($type != 2)
{ {
$inj += preg_match('/delete\s+from/i', $val); $inj += preg_match('/updatexml^(/i', $val);
$inj += preg_match('/delete\s+from/i', $val);
$inj += preg_match('/create\s+table/i', $val); $inj += preg_match('/create\s+table/i', $val);
$inj += preg_match('/update.+set.+=/i', $val); $inj += preg_match('/update.+set.+=/i', $val);
$inj += preg_match('/insert\s+into/i', $val); $inj += preg_match('/insert\s+into/i', $val);