C : chroot 内的 system() 调用

发布于 2024-11-30 23:06:29 字数 233 浏览 5 评论 0原文

我有一个用 C 编写的程序,它在监狱内运行 chroot,它会进行一些系统调用,例如 system ("ls")。问题是当我在监狱内运行该程序时,该程序不会执行系统调用。我已经包含了可执行文件的所有必要库(使用 ldd bash 命令找到它们),以及 bash 可执行文件( /bin/bash ),以及它的库(也使用 ldd 找到)。似乎少了点什么。有人对此有什么想法吗?

I have a program written in C, which runs chrooted, inside a jail, that makes some system calls e.g system ( "ls" ). The problem is that the program does not execute the system calls when I run it inside the jail. I have included all the necessary libraries of the executable ( found them with ldd bash command ), along with the bash executable ( /bin/bash ), and it's libraries ( also found with ldd ). It seems that something is missing. Does anyone have an idea about that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

挽清梦 2024-12-07 23:06:29

根据定义,system 运行“/bin /sh -c <命令>"。

/bin/sh 复制到您的 chroot 监狱(或将其链接到 /bin/bash),您应该可以开始了。

By definition, system runs "/bin/sh -c <command>".

Copy /bin/sh to your chroot jail (or link it to /bin/bash) and you should be good to go.

温柔少女心 2024-12-07 23:06:29

这可能有效,但拥有 chroot 的目的通常是为了防止攻击者执行任意 shell 命令。一旦你将 /bin/sh 放入 chroot 监狱中,你就已经消除了拥有 chroot 监狱的任何目的。

That might work, but the purpose of having a chroot is generally to prevent attackers from being able to execute arbitrary shell commands. Once you have put /bin/sh into a chroot jail you've eliminated any purpose to having the chroot jail in the first place.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文