The Java Agent: Modifying Bytecode at Runtime to Protect Against Log4J • Joe Beeton • GOTO 2022

Learn how to modify bytecode at runtime to protect against vulnerabilities like Log4Shell with Java Agents, empowering you to dynamically attach to running JVMs and prevent malicious code injection.

Key takeaways
  • Java Agents: Allow modifying bytecode at runtime to protect against vulnerabilities.
  • Dynamic Attaching: Attaching to a running JVM without requiring modifications to the target application.
  • JBomb: A Java agent for modifying bytecode and preventing vulnerabilities, including Log4Shell.
  • ASM: A low-level bytecode manipulation library used by Java agents like JBomb.
  • Instrumentation API: Allows interacting with the JVM, including modifying classes and methods at runtime.
  • Agent Main Method: The entry point for a Java agent, which runs in the context of the target JVM.
  • Premain Method: A special method that is called by the JVM before the main method, used by Java agents.
  • Class File Transformer: A mechanism for modifying bytecode at runtime, used by Java agents like JBomb.
  • Java Agent Flag: A way to specify the location of a Java agent when starting the JVM.
  • Log4Shell: A vulnerability in Log4j that allows remote code execution when a specially crafted log message is received.
  • Injecting Payloads: Injecting malicious code into a running application using a Java agent.
  • Agent JAR File: A file containing the Java agent’s bytecode and configuration.
  • Attached JVM: The JVM that is being attached to by the Java agent.
  • Process ID: The unique identifier for a running process, used to attach to the JVM.
  • Agent Manifest File: A file that contains configuration information for the Java agent.
  • JNDI Server: A server that provides name-to-object references, used by Java agents like JBomb.