Skip to content
This repository was archived by the owner on Jun 6, 2024. It is now read-only.

Commit d7492f1

Browse files
authored
Merge pull request #195 from yuantuo666/dev
漏洞修复
2 parents c1b2243 + cc7b10a commit d7492f1

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

functions.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,13 @@ function connectdb(bool $isAPI = false)
327327
$DBPassword = DbConfig["DBPassword"];
328328
$dbname = DbConfig["dbname"];
329329
$GLOBALS['dbtable'] = DbConfig["dbtable"];
330-
$conn = mysqli_connect($servername, $username, $DBPassword, $dbname);
331-
$GLOBALS['conn'] = $conn;
330+
$conn = mysqli_init();
331+
mysqli_options($conn, MYSQLI_OPT_LOCAL_INFILE, false); // 感谢 unc1e 披露的漏洞
332+
$m = mysqli_real_connect($conn, $servername, $username, $DBPassword, $dbname, 3306);
333+
// $conn = mysqli_connect($servername, $username, $DBPassword, $dbname);
334+
332335
// Check connection
333-
if (!$conn) {
336+
if (!$m) {
334337
if ($isAPI) {
335338
// api特殊处理
336339
EchoInfo(-1, array("msg" => "数据库连接失败:" . mysqli_connect_error(), "sviptips" => "Error"));
@@ -340,6 +343,8 @@ function connectdb(bool $isAPI = false)
340343
exit;
341344
}
342345
}
346+
$GLOBALS['conn'] = $conn;
347+
343348
mysqli_query($conn, "set sql_mode = ''");
344349
mysqli_query($conn, "set character set 'utf8'");
345350
mysqli_query($conn, "set names 'utf8'");

index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
*
1010
* 此项目 GitHub 地址:https://github.com/yuantuo666/baiduwp-php
1111
*
12-
* @version 2.2.0
12+
* @version 2.2.0.1
1313
*
1414
* @author Yuan_Tuo <yuantuo666@gmail.com>
1515
* @link https://imwcr.cn/
1616
* @link https://space.bilibili.com/88197958
1717
*
1818
*/
19-
$programVersion_Index = "2.2.0";
19+
$programVersion_Index = "2.2.0.1";
2020
session_start();
2121
define('init', true);
2222
if (version_compare(PHP_VERSION, '7.0.0', '<')) {
@@ -329,7 +329,7 @@ function getip()
329329
}
330330
return $ip;
331331
}
332-
$ip = getip();
332+
$ip = htmlspecialchars(getip(), ENT_QUOTES); // 防注入 #193
333333
$isipwhite = FALSE; //初始化 防止报错
334334
if (USING_DB) {
335335
connectdb();

install/config_raw

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
* PanDownload 网页复刻版,PHP 语言版配置文件
44
* !!!请勿修改本文件,如果手动修改后再在后台设置,可能导致config.php文件被清空!!!
55
*
6-
* @version 2.2.0
6+
* @version 2.2.0.1
77
* @author Yuan_Tuo <yuantuo666@gmail.com>
88
* @link https://imwcr.cn/
99
* @link https://space.bilibili.com/88197958
1010
*/
11-
const programVersion = '2.2.0';
11+
const programVersion = '2.2.0.1';
1212
if (!defined('init')) {
1313
http_response_code(403); header('Content-Type: text/plain; charset=utf-8'); header('Refresh: 3;url=./');
1414
die("HTTP 403 禁止访问!\r\n此文件是 PanDownload 网页复刻版 PHP 语言版项目版本 " . programVersion . " 的配置文件!\r\n禁止直接访问!");

updater.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
*
88
* 此项目 GitHub 地址:https://github.com/yuantuo666/baiduwp-php
99
*
10-
* @version 2.2.0
10+
* @version 2.2.0.1
1111
*
1212
* @author Yuan_Tuo <yuantuo666@gmail.com>
1313
* @link https://imwcr.cn/
1414
* @link https://space.bilibili.com/88197958
1515
*
1616
*/
1717

18-
$programVersion_Updater = "2.2.0";
18+
$programVersion_Updater = "2.2.0.1";

0 commit comments

Comments
 (0)