Avoid the NEXT Log4Shell vulnerability!
The Java platform has accrued a number of features over the years. Some of these features are no longer commonly used, but their existence remains a security liability, providing attackers with a diverse toolkit to leverage against Java-based systems.
It is possible to eliminate some of this attack surface area by creating custom JVM images with jlink, but this is not always feasible or desired. Another option is to use the –limit-modules command line parameter when running your application, but this is a relatively coarse tool that cannot be used to disable individual features like serialization or native process execution.
A third option is aegis4j, a Java agent which can patch key system classes to completely disable a number of standard Java features:
jndi: all JNDI functionality (
rmi: all RMI functionality (
process: all process execution functionality (
httpserver: all use of the JDK HTTP server (
serialization: all Java serialization (
unsafe: all use of
scripting: all JSR 223 scripting (
jshell: all use of the Java Shell API (
For more information, see the GitHub repository.