插件下载地址:https://downloads.wordpress.org/plugin/wp-mobile-edition.2.2.7.zip
首次启用该插件,插件会自动安装一个theme:mTheme-Unus。该theme下css/css.php文件存在任意文件可读漏洞。
漏洞代码:
foreach ($files as $file)
{
$content .= file_get_contents($file);
}
// Remove comments
$content = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $content);
// Remove tabs, spaces, newlines, etc...
$content = str_replace(array("\r", "\n", "\t", ' ', ' '), '', $content);
// Delete cache files older than an hour
$oldDate = time()-3600;
$cachedFiles = scandir($cachePath);
foreach ($cachedFiles as $file)
{
$filemtime = @filemtime($cachePath.$file);
if (strlen($file) == 32 and ($filemtime === false or $filemtime < $oldDate))
{
unlink($cachePath.$file);
}
}
// Write cache file
file_put_contents($cachePath.$md5, $content);
// Output
echo $content;
file_get_contents()读取$file路径的内容之后,echo输出,导致漏洞。
删除,更新,停用该插件,并不会影响到漏洞存在的文件。
更新至:2.8版本
访问:website/wp-content/themes/mTheme-Unus/css/css.php?files=…/…/…/…/wp-config.php
漏洞依旧存在。
删除wp-content/themes/mTheme-Unus/css/css.php文件。
写了poc没有提交的地方。