TP5框架版本5.0.10安全漏洞修复方案
2022-12-13 16:01:12网站/服务器安全 73人已围观
一、补丁修复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; }
完事更新代码
相关文章
随机图文
哀悼日 让网站全站变灰css代码
此代码为提取百度官方的css代码。 html{filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);-webkit-filter:grayscale(100%);-moz-filter:grayscale(100%);-ms-filter:grayscale(100%);-o-filter:grayscale(100%)pbootcms可以用阿里云虚拟主机吗?
有客户问:pbootcms可以用阿里云虚拟主机吗? 可以的。 只要主机支持php+mysql及伪静态都可以。ECharts 一个基于 JavaScript 的开源可视化图表库
官方网站链接:https://echarts.apache.org/zh/index.html 折线图 柱状图 饼图 散点图 地理坐标/地图 K 线图 雷达图 盒须图 热力图 关系图 路径图 树图 矩形树图 旭日图 平行分享一个pbootcms列表分页样式
效果展示 代码 <div class="pages">{page:bar}</div> <style> .pages{text-align:center;padding:20px;} .pages .page-status{display:none;} .pages a{border:1px soli