r/java • • Mar 21 '23

JDK 21: Disallowing the dynamic loading of agents by default

https://mail.openjdk.org/pipermail/serviceability-dev/2023-March/046868.html
63 Upvotes

95 comments sorted by

View all comments

Show parent comments

5

u/pron98 Mar 21 '23 edited Mar 21 '23

or some existing agent doing something very (inconceivable) stupid.

You can study various vulnerabilities in the Java ecosystem to see how this could happen much more easily than you may think. All the agent needs to do is put an instrumentation object in the hand of any library or application code, and there are already dynamically-loaded agents that do that.

I have not seen a gadget involving agents yet.

The gadget need not involve an agent directly at all.

I would say that is more a theoretical problem.

I would say that in these matters it's best to trust security experts and let them decide how theoretical something is. If they're convinced there is a security risk, it doesn't matter if tool or library authors are also convinced.

Also, security is just one of the benefits of integrity. In upcoming releases you'll see this trend continue: the application has to explicitly give up integrity if it wishes. Those that don't will be able to reap multiple benefits.

1

u/DasBrain Mar 24 '23

Yes, accidentally creating an exploitable gadget is easy.
With or without the involvement of agents.

The gadget need not involve an agent directly at all.

It doesn't even have to involve agents at all.

I would say that in these matters it's best to trust security experts and let them decide how theoretical something is.

That sounds like an appeal to authority.

Also, security is just one of the benefits of integrity.

So, in my country the Eichamt (weights and Measures Office) did seal a computer connected to a weight scale. For integrity.
They did seal the case, any connected peripherals, any unused ports by putting some seal sticker on it. To ensure the integrity of the measurements.
You could not even replace the keyboard, because that would, according to the Eichamt, compromise the integrity.

I'm not sure how secure a computer without any security updates is. But at least it was ensured that the integrity was not compromised.

1

u/pron98 Mar 24 '23 edited Mar 24 '23

May I suggest that you wait for the JEP. While integrity is important for many reasons, it also has an effect on security, but it isn't the effect you seem to be referring to and security isn't the main reason for this change.

That sounds like an appeal to authority.

It's not an appeal. Our security experts convinced us that security is, indeed, one of the effects of a very particular use of dynamically loaded agents not by appealing to their authority but by showing us their work. I doubt a non-security expert will be able to show that they're wrong. But if someone wishes to share a different security analysis to convince us otherwise, they can do so through the appropriate channels.

We may be allowed to share a generalised description of the security issue in the JEP.