Any local user can exploit a bug in rtpm to gain "sys" account privileges. A root compromise is then trivial, since the "sys" privileges are equivalent to root.
Credit:
The information was provided by: Brock Tellier.
UnixWare has a slightly different system of managing the password database than Linux/BSD/Solaris and the like. In addition to the conventional /etc/passwd and /etc/shadow, UnixWare keeps a copy of these files (including encrypted passwords) in /etc/security/ia/master and /etc/security/ia/omaster. These are binary files containing the same information as /etc/passwd and /etc/shadow in a different format. Various UnixWare C functions can be used to access this information. Some programs use this file for authentication purposes, instead of /etc/shadow, such as the i2odialog daemon.
A major security hole opens up once the group "sys" is able to read from this database. If there were no programs setgid sys, this would not be a problem, however UnixWare's owner/group scheme relies very heavily on this group. /dev/*mem* is readable by sys (instead of having a separate kmem group) and many key directories, such as /sbin, and critical binaries are writable by this group. The /etc/security/tcb/privs database (which controls which non-suid/sgid programs gain additional privileges) is also writable by sys. As a consequence, many programs which need to access /dev/kmem and various other config files are sgid sys instead of sgid/suid to a more specialized group. Once we have exploited one of these programs to gain the gid of sys, we have nearly full control over the system.
Vulnerability details:
A simple buffer overflow in /usr/sbin/rtpm will allow us to gain sys privileges. From there, you can strings(1) the /etc/security/ia/master file for the encrypted root password or inject a shell into the /etc/security/tcb/privs file. Either of these will lead to a fairly quick root compromise.
Exploit:
A small warning about this exploit: Rtpm is one of those ASCII GUI programs that messes with your term. If it doesn't exit normally, it will leave you with a mostly unusable session. For this reason, this exploit will drop /tmp/ksh as sgid-sys and exit. After you run the exploit, you'll probably need to forcefully logout (exit might not work) then log back in to get your privs. The default offset should work, but if it doesn't you should write a script to change it rather than deal with logging out/in every time you want to change your offset.
/**
** uwrtpm.c - UnixWare 7.1 rtpm exploit
**
**
** Drops a setgid sys shell in /tmp/ksh. We can't exec a shell because
** rtpm screws up our terminal when it exits abnormally. After running
** this exploit, you must forcefully exit your shell and re-login to exec
** your sys shell.
**
** cc -o uwrtpm uwrtpm.c; ./rtpm <offset>
** use offsets of +-100
**
** Brock Tellier btellier@usa.net
**
**/