jail-shell | linux security tool mainly using chroot , namespaces | Identity Management library
kandi X-RAY | jail-shell Summary
kandi X-RAY | jail-shell Summary
through the configuration file jail-shell automatically generates the chroot running environment. through jail-shell management commands it’s very easy to add, list, delete, restrict users, and easy to install, delete chroot running environment. the linux chroot technology is used to restrict the user’s directory access, to avoid users accessing restricted directories and to prevent users from destroying the system. the chroot running enviroment is readonly, this prevents users from deleting protected directories and files, creating device files, and accessing restricted files. use linux namespace technology, limit the visible range of user pid, mount directories, and avoid information leakage. provides a system command-and-proxy channel that allows users to execute a real system’s restricted command in a chroot environment, protecting the system in the event that it provides the necessary functionality. only a list of commands is required to automatically copy the dynamic library that the command relies on to the chroot environment, avoiding the cumbersome work of copying the dynamic library manually. discard critical capabilities privileges to avoid the system, and the chroot running environment, being cracked by rootkit. supports redhat, sles, debian and their derivative operating systems. when using jail-shell, the minimum security authorization principle should be adopted. in the premise of ensuring the use of
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of jail-shell
jail-shell Key Features
jail-shell Examples and Code Snippets
Community Discussions
Trending Discussions on jail-shell
QUESTION
I am trying to understand the chroot escape exploitation. I was reading this article: https://tbhaxor.com/breaking-out-of-chroot-jail-shell-environment/
From this website, I found this graph:
I am confused about the step where it says
"multiple chdir will change the kernel cwd to / using n times chdir("..") syscall"
Why is this true? Like chdir("..") from chrooted root directory should just return itself, right? But if you do it n times, it will take you to the host root? Why do you have to do it "n" times and then it works?
...ANSWER
Answered 2021-Nov-23 at 11:16I am the author of the post you mentioned here,
Because you don't know where exactly CWD was when the user has executed chroot syscall. It could be at /home/test/john
or /home/test/john/mydir
and so on.
But when you do chdir("..")
syscall for let's say 5 times here. In the first case, it will take back to you on root in 3 chdir and when you perform ..
on the root directory it is ineffective read more.
Now in the second case, it will take you to the root directory in 4 chdir("..")
syscalls. So again ..
on the root directory is ineffective. Generally, exploits use 1000 chdirs just because they don't want to take any chance to miss the actual root directory. Here from "actual root directory" I mean working directory or CWD
.
When you do chroot it doesn't change the working directory or cwd for kernel but only changes for the applications running inside it. That is why when you don't drop the privileges and perform double chroot in the already chrooted environment it breaks you out of the chroot jail. I have understood this working from this post. I hope you will too find it useful.
Here is one more resource for you to understand difference between CWD and ROOT directory: https://github.com/earthquake/chw00t#got-that-but-how-does-it-work.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install jail-shell
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page