前言
(申请Wiki账号)
个人觉得漏洞威胁不算太大,但也作为一个弱鸡的学习经历将其记录下来
Media Library Assistant用于进行图像和文件管理
影响版本
<2.82
漏洞版本下载地址:https://downloads.wp.xz.cn/plugin/media-library-assistant.2.81.zip
LFI
漏洞位置:
/media-library-assistant/includes/mla-file-downloader.php
引入class-mla-file-downloader.php
,且注意下文的两个参数: mla_download_file
和 mla_download_type
以及方法: mla_process_download_file()
跟入 mla_process_download_file()
,注意到:
$file_name = $args['mla_download_file'];
$match_name = str_replace( '\\', '/', $file_name );
$base_dir = pathinfo( __FILE__, PATHINFO_DIRNAME );
$match_dir = str_replace( '\\', '/', $base_dir );
$allowed_path = substr( $match_dir, 0, strpos( $match_dir, 'plugins' ) );
if ( 0 !== strpos( $match_name, $allowed_path ) ) {
$message = 'ERROR: download path out of bounds.';
} elseif ( false !== strpos( $match_name, '..' ) ) {
$message = 'ERROR: download path invalid.';
}
} else {
$message = 'ERROR: download argument(s) not set.';
可以看出为了防止目录穿越对 ..
进行了过滤,只能读取plugin目录下的内容,这么来看,可能可以读取插件目录下的某些信息但利用效果似乎不大
然后就可以进行下载:
if ( empty( $message ) ) {
header('Pragma: public'); // required
header('Expires: 0'); // no cache
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Last-Modified: '.gmdate ( 'D, d M Y H:i:s', filemtime ( $file_name ) ).' GMT');
header('Cache-Control: private',false);
header('Content-Type: '.$args['mla_download_type']);
poc:
该漏洞不需要授权
修复
在2.82版本中,直接禁止了这一行为:
xss
前提: admin角色
在 设置/Media Library Assistant
的所有标签的搜索框存在xss
如 views
标签:includes/class-mla-settings-view-tab.php:
s参数即是注入点,无过滤
触发:
同理在uploads等的标签中的搜索框也存在:
修复
在2.82版本中增加了wordpress内置函数 esc_attr
进行过滤操作
参考链接: