From: David M. Zendzian (dmz@dmzs.com)
Date: Tue May 16 2006 - 21:06:25 EDT
All this talk about chroot makes me wonder about xen or vmware...anyone have any thoughts/comments on breaking out of a virtual operating system?
-----Original Message-----
From: "Marco Ivaldi" <raptor@0xdeadbeef.info>
To: pen-test@securityfocus.com
Sent: 5/16/06 8:36 AM
Subject: Re: how an hacker can bypass a chrooted environement ?
Hey pen-test,
On Fri, 12 May 2006, Rob wrote:
> from man 2 chroot():
>
> -- Note that this call does not change the current working directory, so
> that '.' can be outside the tree rooted at '/'. In particular, the
> super-user can escape from a 'chroot jail' by doing 'mkdir foo; chroot
> foo; cd ..'. --
>
> Also, mknod() some device files like /dev/kmem or /dev/hda1, then use
> root priviledges to muck with kernel, or raw write data to disk.
Beside the already described techniques, here follows a quick summary of
some other rather old tricks to break out of the chroot jail:
1) Load a kernel module;) Capability needed: CAP_SYS_MODULE.
2) Speaking about the already mentioned mknod() technique (capability
needed: CAP_MKNOD), you could also use it to abuse ttys and virtual
file systems through the mount() syscall (capability needed:
CAP_SYS_ADMIN): procfs, devfs, devpts.
3) Inject code through ptrace() into a process outside the chroot jail,
provided you meet the required conditions to do so. This could work for
instance when the uid nobody is shared between several processes
(semi-common misconfiguration). Depending on the situation, this could
also be accomplished even with uid != 0. For further details, see also:
http://www.phrack.org/phrack/59/p59-0x0c.txt
4) Other uid != 0 tricks: (UNIX) sockets, shared memory segments and other
IPCs, exploiting local kernel vulnerabilities;), some other application
specific points.
5) Abuse sysctl() to set the modprobe binary path? Direct access to I/O
ports? Sniff network traffic? Impersonate a local administration
service (sshd)? Change netfilter rules? And so on... (you need
different capabilities for those).
I'm sure i left some possibilities out (use your fantasy), but i guess
this pretty much shows how you shouldn't blindly rely only on chroot to
secure your servers. YMMV.
Cheers,
-- Marco Ivaldi Antifork Research, Inc. http://0xdeadbeef.info/ 3B05 C9C5 A2DE C3D7 4233 0394 EF85 2008 DBFD B707 ------------------------------------------------------------------------------ This List Sponsored by: Cenzic Concerned about Web Application Security? Why not go with the #1 solution - Cenzic, the only one to win the Analyst's Choice Award from eWeek. As attacks through web applications continue to rise, you need to proactively protect your applications from hackers. Cenzic has the most comprehensive solutions to meet your application security penetration testing and vulnerability management needs. You have an option to go with a managed service (Cenzic ClickToSecure) or an enterprise software (Cenzic Hailstorm). Download FREE whitepaper on how a managed service can help you: http://www.cenzic.com/news_events/wpappsec.php And, now for a limited time we can do a FREE audit for you to confirm your results from other product. Contact us at request@cenzic.com for details. ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ This List Sponsored by: Cenzic Concerned about Web Application Security? Why not go with the #1 solution - Cenzic, the only one to win the Analyst's Choice Award from eWeek. As attacks through web applications continue to rise, you need to proactively protect your applications from hackers. Cenzic has the most comprehensive solutions to meet your application security penetration testing and vulnerability management needs. You have an option to go with a managed service (Cenzic ClickToSecure) or an enterprise software (Cenzic Hailstorm). Download FREE whitepaper on how a managed service can help you: http://www.cenzic.com/news_events/wpappsec.php And, now for a limited time we can do a FREE audit for you to confirm your results from other product. Contact us at request@cenzic.com for details. ------------------------------------------------------------------------------
This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:55:59 EDT