vBulletin 5.x 前台RCE漏洞复现

vBulletin 5.x 前台RCE漏洞复现

漏洞原理

本质是一个文件包含漏洞,攻击者可以通过包含文件执行任意php代码。

vBulletin 5.x 前台RCE漏洞复现

追踪源码分析

vBulletin 5.x 前台RCE漏洞复现

如果get参数传入则赋值给$path,继续追踪path变量

vBulletin 5.x 前台RCE漏洞复现

如果path的变量长度大于2则判断是否是gif等文件,是的话则返回404

执行前检查路径

vBulletin 5.x 前台RCE漏洞复现

#strpos取“/”在path中的位置,如果有/ 则函数为真,不继续执行

linux中路径只能为分割只能为 /, 但windows中路径分割 / 和\ 是等价的,所以在windows环境中可以通过\ 来利用此文件包含

RCE复现

访问http://172.16.12.2/vb5/index.php?routestring=…\

文件报错

vBulletin 5.x 前台RCE漏洞复现

可以看到文件包含的函数require_once()报错且绝对路径泄露,中间件为phpstudy,系统版本为windows。

phpstudy默认日志目录为phpstudy目录下的 \apache\logs\
尝试访问http://172.16.12.2/vb5/index.php?routestring=..\ ..\..\..\..\..\..\phpstudy\apache\logs\error.log

可以成功利用文件包含漏洞读取文本信息

制造错误访问日志将php代码写入error.log,再将错误日志包含到代码执行

vBulletin 5.x 前台RCE漏洞复现

再次包含文件漏洞利用看看,刚才写入的内容被php解释了,但是代码有错误
vBulletin 5.x 前台RCE漏洞复现

(其实能传参数到access.log 也可以,同理)

此处略过重置环境的心酸。。。。。。。。。

重新传马

vBulletin 5.x 前台RCE漏洞复现

测试访问并菜刀连接
vBulletin 5.x 前台RCE漏洞复现

成功上线

vBulletin 5.x 前台RCE漏洞复现

参考

https://www.ichunqiu.com/experiment/detail?id=60507&source=1&token=05718a26ed6d61917692f2bfa7647cfe

https://ssd-disclosure.com/ssd-advisory-vbulletin-routestring-unauthenticated-remote-code-execution/