gpt4 book ai didi

php - 修补基于时间的 sql 注入(inject)

转载 作者:行者123 更新时间:2023-11-29 06:09:10 25 4
gpt4 key购买 nike

<分区>

我最近对客户端进行了代码审计,发现这几行代码受到了SQL盲注

代码片段:

<?php
if ($_GET['id'] != ''){
$groepsindeling = $_GET['id'];
} else {
$groepsindeling = $_GET['group'];
}
breadcrumb($groepsindeling);
?>

<?php
$groep = "SELECT * FROM `menubalk` WHERE `webnr` LIKE '%$webnr-%' AND `hoofdgroep` = '$_GET[id]' ORDER BY `naamt1` ASC";
$groepres = mysql_query($groep);
while ($groeprij = mysql_fetch_array($groepres)){
?>

我立即使用 mysqli_real_escape_string() 函数对其进行了修补。

新代码:

<?php
if ($_GET['id'] != ''){

$groepsindeling = mysqli_real_escape_string($_GET['id']);

settype($groepsindeling, "integer");

}
else {
$groepsindeling = mysqli_real_escape_string($_GET['group']);
}
breadcrumb($groepsindeling);
?>

<?php
$groep = "SELECT * FROM `menubalk` WHERE `webnr` LIKE '%$webnr-%' AND `hoofdgroep` = '$_GET[id]' ORDER BY `naamt1` ASC";
$groepres = mysql_query($groep);
while ($groeprij = mysql_fetch_array($groepres)){
?>

我做了进一步的测试,看看代码是否适用于基于 bool 的 SQL 盲注,但它似乎失败了,因为基于时间的 SQL 盲注在这里仍然适用。

感谢所有建议。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com