调用java显示有何风险,在运行用户提供的Java代码时,我应该防范哪些安全风险?...

Is there a comprehensive list of the security issues with running user-supplied Java code on a server? I'm already

using timeouts of 10 seconds

running code in a separate process with limited available memory

using SecurityMangager to prevent File and Network IO

running code under an account with extremely limited filesystem permissions

I'm running this on a FreeBSD server if that matters.

解决方案

Looks like a very good start - Security Manager is essential for sandboxing a whole bunch of other stuff you don't mention explicitly (like preventing the user from disabling the Security Manager, of course, and being able to invoke arbitrary commands, or use native code, or get the OS to exec files etc). I assume you are starting from zero permissions and just granting the explicit permissions needed.

Security Manager can't deal with denial-of-service through excessive resource usage, but your other controls probably address this (prevent network connections, control disk usage, timeouts to prevent CPU hogging - if that's what you meant by timeouts).

You say "extremely limited filesystem permissions" - hopefully this also includes disk quota? are you running multiple untrusted processes, and do they share disk space? Running out of file handles might be an issue (not sure how these are managed for a limited account).

There are still occasional JVM vulnerabilities, so the risk depends on what else is on the server, and what the consequences of a problem actually are (how bad is it if you have to wipe the server?).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值