在沙箱环境中运行程序时如何禁止系统调用?

发布于 2024-10-07 13:49:58 字数 291 浏览 0 评论 0 原文

我正在查看 codepad.org,一段 while(1) fork 给出了以下输出。

不允许的系统调用:SYS_fork

检查此链接以获取确切的详细信息。 http://codepad.org/rNR9mMVv

谷歌搜索更多,我知道他们还使用套接字禁用系统调用。

不允许的系统调用:SYS_socketcall

谁能告诉我如何在沙盒环境中运行程序之前禁用某些系统调用?

I was checking out codepad.org and a while(1) fork gave the following output.

Disallowed system call: SYS_fork

Check this link for exact details. http://codepad.org/rNR9mMVv

Googling more, I got to to know that they also disable system call using sockets.

Disallowed system call: SYS_socketcall

Can anyone tell me how one can disable certain system calls before running the program in a sandboxed environment?

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

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

发布评论

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

评论(4

冰雪之触 2024-10-14 13:49:58

通过用具有空存根或异常抛出器而不是真实函数的模拟替换运行时库?

By replacing runtime libraries with mocks that have empty stubs or exception throwers instead of real functions?

始终不够 2024-10-14 13:49:58

如果您愿意付出性能损失,可以使用 ptrace() 来实现此目的。我现在似乎找不到另一种方法。

If you're willing to pay the performance penalty, ptrace() can be used for this. There's another way I cannot seem to find right now.

尤怨 2024-10-14 13:49:58

系统调用通过操作系统将函数注入到进程中来工作。但是,如果您为自己喜欢的可执行格式编写了自定义加载程序,则可以将其链接到您自己的加载程序。如果格式允许,您还可以对可执行文件进行二进制更改,以从您提供的单独动态库中提取这些函数。

System calls work by injecting the function into the process by the operating system. If, however, you wrote a custom loader for your favourite executable format, you would have the power to link it against your own. You could also binary alter the executable, if the format allows for it, to pull those functions from a separate dynamic library, provided by you.

天冷不及心凉 2024-10-14 13:49:58

我知道这是一个老问题,但我正在研究同样的东西,所以这是我的建议 - 使用 SELinuxGentoo 项目,有一些关于 SELinux 的好东西。查看 SELinux 策略类型< /a> (4.b),特别是有针对性的政策。我不确定 codepad.org,但类似的 ideone.com 使用 Gentoo,所以也许 SELinux 应该是最简单的方法。

I know this is an old question, but I was researching the same stuff, so here is my suggestion - use SELinux. The Gentoo project, has some nice stuff about SELinux. Have a look at the SELinux Policy Types (4.b), and the targeted policy in particular. I'm not sure about codepad.org, but the similar ideone.com uses Gentoo, so perhaps SELinux should be the easiest way to go.

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