Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Pen-Test
[Top] [All Lists]

Re: how an hacker can bypass a chrooted environement ?

Subject: Re: how an hacker can bypass a chrooted environement ?
Date: Fri, 12 May 2006 20:45:27 +0200 (CEST)
Hello,

I was wondering how an attacker can bypass a chrooted environement. A
(common) technique consist in finding a vulnerable program (in the
chrooted environnement) and injecting it a shellcode (i.e
../../../../../../../bin/bash for ex.)  by BoF.  But normally, in the
chrooted environement, you volontarily add only necessary tools (like
ls, cat, less...), and vulnerable softwares are uncommon...

Well, without a vulnerable program, there is nothing to attack and thus no chroot environment to bypass :-) However, I'd guess you're considering the following scenario:


There is a vulnerable application running in chrooted environment, the directory it is chrooted in doesn't actually need to contain any files. The attacker manages to exploit a vulnerability in the program, i.e. (s)he is able to make it run whatever code (s)he wants. The real objective is, however, to be able to access to the files on the system. This is called "breaking out of the chroot".

One of the well-known techniques is the ../../../.., which is based on one (bad) property of chroot -- the chroot(2) system call does not change the current working directory.

Consider the following sequence of steps achieves:

1) mkdir("goo")
2) chroot("goo")
3) chdir("../../../../../..")
4) chroot(".")

Steps 1 and 2 create a directory called "goo" and set the root directory of current process to that dir. However, the current WORKING directory is not changed -- it is OUTSIDE the root directory of the process. Step 3 then moves upwards in the hierarchy (the original chrooted directory tree might have been several directories deep in the tree), trying to reach the "true" root directory. The last step sets the new root to the current working directory (= true root), thus accomplishing the "break-out-of-chroot" mission.

That's why some security patches enforce chdir("/") immediately after chroot() call. Note that this is not the only method of breaking out of the chroot jail, it's just one of the more widely used ones.

Peter

--
[Name] Peter Kosinar   [Quote] 2B | ~2B = exp(i*PI)   [ICQ] 134813278



------------------------------------------------------------------------------
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.
------------------------------------------------------------------------------


<Prev in Thread] Current Thread [Next in Thread>