防止RMI服务器代码修改

发布于 2024-09-29 21:04:36 字数 307 浏览 2 评论 0原文

我正在编写一个使用 Java RMI 的客户端-服务器解决方案(通过 Cajo 项目)。

我想让服务器尽可能安全。据我所知,通过使用 Java 反射,恶意客户端将能够查看任何给定对象内的所有方法名称和字段名称,这些对象要么绑定在 RMI 注册表中,要么从服务器“代理”(在 Cajo 中,代理项是实际驻留在服务器上但客户端可以引用它的对象)。但是,恶意客户端是否能够查看任何程序逻辑或修改服务器上的任何代码?或者查看字段的实际内容怎么样?

请假设不允许对服务器进行物理访问,并且对服务器的唯一网络访问是通过 Cajo TCP 端口 (1198)。

谢谢

I'm writing a client-server solution which is using Java RMI (Via the Cajo project).

I want to make the server as secure as possible. I understand that by using Java reflection, a malicious client would be able to view all method names and field names inside any given object which has either been bound in the RMI regestry or "proxied" from the server (In Cajo, a proxied item is an object who actually resides on the server but the client can reference it). However, would a malicious client be able to view any program logic, or modify any code on the server? Or what about viewing the actual contents of the fields?

Please assume that physical access to the server is not allowed and the only network access to the server is via the Cajo TCP port (1198).

Thanks

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

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

发布评论

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

评论(2

好听的两个字的网名 2024-10-06 21:04:37

RMI 基于代理对象和序列化。

  • 代理对象:这些对象仅包含接口中指定的方法,原始对象的所有其他方法和字段不存在于代理中,并且无法通过反射访问。由于所有方法在接口中都已经是公共的,因此不可能进行任何攻击。

  • 序列化对象:是服务器端值的一对一副本,所有方法和字段都可以在客户端上访问,但对客户端副本的更改不会转发到服务器,因为两个副本都是独立的。具有修改字段的对象仍然可以用作 RMI 方法的参数,因此请在服务器上验证您的输入。

RMI is based on proxy objects and serialisation.

  • Proxy objects: these only contains methods specified in an interface, all other methods and fields of the original Object do not exist within the proxy and can't be accessed via reflection. No attacks are possible since all methods are already public in the interface.

  • Serialised objects: are one on one copies of the server side values, all methods and fields can be accessed on the client, but changes to the client copy are not forwarded to the server since both copies are independent. An object with modified fields can still be used as argument of an RMI method, so validate your input on the server.

甜心 2024-10-06 21:04:37

我明白通过使用Java
反射,恶意客户端会
能够查看所有方法名称和
任何给定对象内的字段名称
已绑定在 RMI 中
从服务器注册或“代理”

正确。然而这些字段是什么?只是一个 IP 地址:端口和一些用于代理方法的幻数。无需担心,没有任何内容是客户端无法通过正常方式使用的。

但是,恶意客户端是否能够
查看任何程序逻辑,或修改任何
服务器上的代码?

不可以。除了通过代理之外,它无法访问服务器。它根本看不到实际的远程对象实现。

或者查看字段的实际内容怎么样?

不,出于同样的原因。

I understand that by using Java
reflection, a malicious client would
be able to view all method names and
field names inside any given object
which has either been bound in the RMI
regestry or "proxied" from the server

Correct. However what are those fields? Just an IP address:port and some magic numbers for the methods being proxied. Nothing to worry about there, there's nothing being exposed that the client can't already use by normal means.

However, would a malicious client be able to
view any program logic, or modify any
code on the server?

No. It doesn't have any access to the server other than via the proxy. It can't see the actual remote object implementations at all.

Or what about viewing the actual contents of the fields?

No, for the same reason.

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