Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Solaris Runtime Linker - Exploit Detection

Date: Sat Jul 16 2005 - 12:40:00 CDT

This is a demonstration of exploit detection using the Solaris implementation of C2 Auditing (BSM) to detect the system has been compromised. Of course , it helps to be logging locally as well to a secure central log server or protected media.

This was tested on an unpatched Solaris 10 Sparc system.

  Sun Document ID: 101794

C2 (BSM) Detection of Exploit
  Start of BSM Trace
  Comment: I am an unprivileged user here. Audit userid/groupid is pete:pete.
  Effective userid/groupid is pete:pete.
header,81,2,setpgrp(2),,megadeth.metalrock.ripnet,2005-07-02 18:44:46.576 -05:00
  subject,pete,pete,pete,pete,pete,1400,4075230069,8199 196630 whitesnake-2.metalrock.ripnet
  Comment: I run "ping" (which is setuid root) Note the value of the "LD_AUDIT" environment variable. This is the "Red Flag". LD_AUDIT should not be set at all on a normal system.
 LD_AUDIT redirects program execution to the vulnerable library, created by an unprivileged user.
header,976,2,execve(2),,megadeth.metalrock.ripnet,2005-07-02 18:44:46.598 -05:00
  SHELL=/bin/bash,SSH_CLIENT= 32799 22,OLDPWD=/users/pete/ShellCode,
  LD_AUDIT=/users/pete/danger/break-sec.so,LOGNAME=pete,SSH_CONNECTION= 32799 22,DISPLAY=localhost:10.0,_=/usr/sbin/ping
  Comment: The effective userID is now root; this is to be expected as ping is a setuid root program. However, the program should exit immediately.
subject,pete,root,pete,pete,pete,1433,4075230069,8199 196630 whitesnake-2.metalrock.ripnet
  header,108,2,old setuid(2),,megadeth.metalrock.ripnet,2005-07-02 18:44:46.606 -05:00
  subject,pete,root,pete,root,pete,1433,4075230069,8199 196630 whitesnake-2.metalrock.ripnet
  use of privilege,successful use of priv,proc_setid
  Comment: This is where the program execution is redirected to the exploit library via the
  LD_AUDIT environment variable. A shell is executed (/bin/ksh).
  The effective userID and groupID is still root and the user pete has a root shell.
header,198,2,execve(2),,megadeth.metalrock.ripnet,2005-07-02 18:44:46.608 -05:00
  subject,pete,root,pete,root,pete,1433,4075230069,8199 196630 whitesnake-2.metalrock.ripnet
  header,99,2,fork1(2),,megadeth.metalrock.ripnet,2005-07-02 18:44:46.616 -05:00
  argument,0,0x59a,child PID
  subject,pete,root,pete,root,pete,1433,4075230069,8199 196630 whitesnake-2.metalrock.ripnet
  End of BSM Trace
  An unprivileged user has now circumvented the security of the system.
  The user has root shell and has full control of the system!
  BSM enabled the detection of this compromise by logging the following combination of events:
  1. Detecting the "LD_AUDIT" environment variable being set by an unprivileged user.
  2. Detecting the execution of a setuid root program (ping) by an unprivileged user (normally ok).
  3. Detecting the string "use of privilege,successful use of priv,proc_setid"
  4. Detecting the immediate execution of a shell as the effective user id "root" by the unprivileged user.
  The non-default BSM policies that must be enabled are "argv", and "arge". The "ex" BSM flag must also be set.
  This configuration logs program arguments and the environment in which the program is
  executing respectively. The "arge" policy enabled the discovery that "LD_AUDIT" environment
  variable was set inappropriately, which simplifies the analysis.


If a Solaris administrator configures BSM appropriately, there ARE "reliable symptoms that would indicate the described issue has been exploited to gain elevated privileges", which is contrary to what Sun Document ID: 101794
states in the "Symptoms" section. I have informed SUN Sun of this information.