Cloudflare Image Resizing 插件能提升您网站的性能,该插件使用 Cloudflare 图像大小调整服务动态优化图像并调整图像大小,通过将 Cloudflare 全球位置的 AVIF/WEBP 图像直接传送到用户的浏览器,体验显着的速度提升。该插件利用最快的可用 PHP 函数,无需任何数据库调用,确保最小的性能开销。您网站的速度不会受到影响.
📍 该漏洞由星群漏洞库自动化检索发现 📍
漏洞点位于 cf-image-resizing.php 中的 hook_rest_pre_dispatch 方法,因为注册了 REST API 端点,且传入cf_image_resizing_fit 参数后未加过滤,直接通过 file_put_contents 函数写入到了 config.php 文件中,导致漏洞产生 (其实本质就是一个文件写入洞,但漏洞标题是远程代码执行).
public static function hook_rest_pre_dispatch($result, $server, $request)
{
if ('/wp/v2/settings/' !== $request->get_route() && 'POST' !== $request->get_method()) {
return $result;
}
if(null !== $result)
{
return $result;
}
$config_file = WP_PLUGIN_DIR.'/cf-image-resizing/config.php';
......
$fit = @isset($request['cf_image_resizing_fit']) ? $request['cf_image_resizing_fit'] : null;
if (null !== $fit)
{
$file_content = file_get_contents($config_file);
$file_content = preg_replace("/(define\(\'CF_IMAGE_RESIZING_FIT\'\,\s\')(.*)(\'\)\;)/", "$1$fit$3", $file_content);
file_put_contents($config_file, $file_content);
}
......
return $result;
}
------WebKitFormBoundary03rNBzFMIytvpWhy--
没有回复内容