TP5框架版本5.0.10安全漏洞修复方案
2022-12-13 16:01:12网站/服务器安全 263人已围观
一、补丁修复1
/thinkphp/library/think/App.php 文件 大概在328行
/** * 执行模块 * @access public * @param array $result 模块/控制器/操作 * @param array $config 配置参数 * @param bool $convert 是否自动转换控制器和操作名 * @return mixed */ public static function module($result, $config, $convert = null) { ....省略.... // 获取控制器名 $controller = strip_tags($result[1] ?: $config['default_controller']); //20211201 star if (!preg_match('/^[A-Za-z](\w|\.)*$/', $controller)) { throw new HttpException(404, 'controller not exists:' . $controller); } //20211201 end $controller = $convert ? strtolower($controller) : $controller; ....省略.... }
二、补丁修复2
/thinkphp/library/think/Request.php 文件 大概在496行
/** * 当前的请求类型 * @access public * @param bool $method true 获取原始请求类型 * @return string */ public function method($method = false) { if (true === $method) { // 获取原始请求类型 return IS_CLI ? 'GET' : (isset($this->server['REQUEST_METHOD']) ? $this->server['REQUEST_METHOD'] : $_SERVER['REQUEST_METHOD']); } elseif (!$this->method) { if (isset($_POST[Config::get('var_method')])) { $this->method = strtoupper($_POST[Config::get('var_method')]); $this->{$this->method}($_POST); } elseif (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) { $this->method = strtoupper($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']); } else { $this->method = IS_CLI ? 'GET' : (isset($this->server['REQUEST_METHOD']) ? $this->server['REQUEST_METHOD'] : $_SERVER['REQUEST_METHOD']); } } return $this->method; } 改成: public function method($method = false) { if (true === $method) { // 获取原始请求类型 return $this->server('REQUEST_METHOD') ?: 'GET'; } elseif (!$this->method) { if (isset($_POST[Config::get('var_method')])) { $method = strtoupper($_POST[Config::get('var_method')]); if (in_array($method, ['GET', 'POST', 'DELETE', 'PUT', 'PATCH'])) { $this->method = $method; $this->{$this->method}($_POST); } else { $this->method = 'POST'; } unset($_POST[Config::get('var_method')]); } elseif (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) { $this->method = strtoupper($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']); } else { $this->method = $this->server('REQUEST_METHOD') ?: 'GET'; } } return $this->method; }
完事更新代码
联系微信
扫码联系技术微信
---------------专业解决网站各种疑难杂症,可淘宝担保交易,安全无风险---------------
建站、仿站、二次开发、网站改版、网站修改、网站漏洞修复、网站被黑修复、网站安全、服务器安全等
点击了解更多 >>
相关文章
随机图文
pbootcms调取当前栏目的父栏目编码
适用范围:在列表页或详情页使用 调取当前栏目的父栏目编码 {sort:pcode}CSS3针对不同的屏幕尺寸使用不同css
实例 <!-- 宽度大于 900px 的屏幕使用该样式 --> <link rel="stylesheet" media="screen and (min-width: 900px)" href="widescreen.css"> <!-- 宽度小于或等于 600px 的屏幕使用该样式 --> <link rel="stylesheet"BT宝塔面板一个站点绑定多个SSL证书
用过宝塔的同学应该都知道,在宝塔面板SSL证书设置中,只能上传设置一份SSL证书,不能设置多个。 实例场景 我用thinkphp开发的一个项目,同时开发了PC网站和手机网站,并绑定了两个域名www.abc.com,m.abc.com并都需要部署SSL证书。 这个时候宝塔面板直接设置就不能满足了,所以我们现在只能手动修改配置文件。 实现方法点击返回网页顶部代码
<div onclick="$('body,html').animate({scrollTop: 0}, 500);">返回顶部</div>