Visit our newest sister site!
Hundreds of free aircraft flight manuals
Civilian • Historical • Military • Declassified • FREE!

TUCoPS :: Linux :: Apps A-M :: cfengi.htm

Cfengine String Format Vulernabilities



    Every recent version except 1.6.0a11 released on 1st Oct 2000


    Pekka Savola found following.  cfd daemon in GNU CFEngine contains
    several  format   string  vulnerabilities   in  syslog()    calls.
    Everyone, or if  access controls are  being used, accepted  hosts,
    can inject the network daemon with a message causing  segmentation
    fault.  As  cfd is almost  always run as  root due to  it's nature
    (centralized  configuration  management  etc.),  this can be quite
    lethal and lead into a root compromise.

    1.5.x and 1.6.0a10 were tested on Red Hat Linux; however, this  is
    not  part  of  Red  Hat  Linux  or  Powertools.  Debian, at least,
    includes cfengine as a package.

    Pekka tried to reproduce this on FreeBSD 3.4 or 4.1 -- no luck; he
    wouldn't be surprised if it was exploitable some way or the  other

    If access controls are used (this is not the default) in  cfd.conf
    or equivalent, the attacker must have access to an allowed  system
    first.   Spoofing would  probably also yield similar results;  the
    fact that there doesn't need not  to be any reply from the  server
    makes it easier.  Segmentation fault can be induced as follows:

        $ telnet cfdserver 5308
        Trying x.y.z.w...
        Connected to cfdserver.some.domain.
        Escape character is '^]'.
        CAUTH myhostname root %s%s%s%s%s%s%s%s
        telnet> quit
        Connection closed.

    where is your IP address and myhostname is some resolvable
    hostname.   A  longer  string  of  %s's  can  also be used if that
    doesn't produce good results.

    If the  %s string  is not  long enough,  string like the following
    will be syslogged; this doesn't look good:

        cfdserver cfd[11330]: Reverse hostname lookup failed, host
        claiming to be myhostname root
        cfdserver.some.domain(null) nev^M  was s%s%s^M
        ^A^Q0^D^Hj ^H^Hj

    In the end, cfd dies in a segmentation fault.

    As  you  can  set  %s%s%s  freely,  and it's passed almost without
    checking as-is to syslog(), it shouldn't be too difficult for  Joe
    Hacker to exploit  this.  Also,  other components of  cfengine use
    the same logging functions, so a local root exploit could also  be
    possible but those aren't as interesting as this and will be fixed
    at the same time.


    Different fix was applied  to the newly released  1.6.0.a11 (alpha
    version).  There is an impression that there isn't going to be  an
    official fix for 1.5.x releases.

    Workaround  is  to  enable  access  controls  in  cfd.conf  and/or
    firewall off  TCP port  5308.   These can't  be considered  _good_
    workarounds as users  in the local  network/legit hosts can  still
    exploit the service.

    "Standard"  patch  to  syslog  calls  included.   It applies quite
    cleanly to both 1.5.x and 1.6.0aXX.

    diff -uNr cfengine-1.6.0.a10.orig/src/log.c cfengine-1.6.0.a10/src/log.c
    --- cfengine-1.6.0.a10.orig/src/log.c	Wed Sep  6 14:43:03 2000
    +++ cfengine-1.6.0.a10/src/log.c	Sun Oct  1 20:09:09 2000
    @@ -71,12 +71,12 @@

 		         if (LOGGING && IsPrivileged())
    -			syslog(LOG_ERR,string,VFQNAME);
    +			syslog(LOG_ERR,"%s",string,VFQNAME);

 			    if (strlen(errstr) != 0)
    -			   syslog(LOG_ERR,errstr,VFQNAME);
    -			   syslog(LOG_ERR,strerror(errno),VFQNAME);
    +			   syslog(LOG_ERR,"%s",errstr,VFQNAME);
    +			   syslog(LOG_ERR,"%s",strerror(errno),VFQNAME);
    @@ -110,11 +110,11 @@
        case cflogonly:
                          if (LOGGING && IsPrivileged())
    -			syslog(LOG_INFO,string,VFQNAME);
    +			syslog(LOG_INFO,"%s",string,VFQNAME);

 			    if ((errstr == NULL) || (strlen(errstr) > 0))
    -			   syslog(LOG_ERR,errstr,VFQNAME);
    +			   syslog(LOG_ERR,"%s",errstr,VFQNAME);

    @@ -125,7 +125,7 @@

 		         if (LOGGING && IsPrivileged())
    -			syslog(LOG_ERR,string,VFQNAME);
    +			syslog(LOG_ERR,"%s",string,VFQNAME);

 		         if (string[strlen(string)-1] != '\n')
    @@ -141,8 +141,8 @@

 			    if (LOGGING && IsPrivileged())
    -			   syslog(LOG_ERR,errstr,VFQNAME);
    -			   syslog(LOG_ERR,strerror(errno),VFQNAME);
    +			   syslog(LOG_ERR,"%s",errstr,VFQNAME);
    +			   syslog(LOG_ERR,"%s",strerror(errno),VFQNAME);

    For SuSE Linux:

        SuSE-6.0: please use the update packages for the SuSE-6.1 distribution.


        SuSE-6.3: Please use the update packages for the SuSE-6.4 distribution.


    For Linux-Mandrake:

        Linux-Mandrake 7.1: 7.1/RPMS/cfengine-1.5.4-5mdk.i586.rpm

    There are precompiled binary packages of cfengine for some  NetBSD
    ports available from:

    If no precompiled binary is  available for your platform, you  can
    build your  own from  source.   First, make  sure that  you have a
    version of the pkgsrc hierarchy from 2nd October 2000 or later.

TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2015 AOH