File tree Expand file tree Collapse file tree 4 files changed +56
-12
lines changed
Expand file tree Collapse file tree 4 files changed +56
-12
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ Gradle wrapper should solve everything. Simply git clone the repo:
1414git clone https://github.com/tothi/log4shell-vulnerable-app
1515```
1616
17+ ### running with gradle wrapper
18+
1719And in the project dir with the file [ build.gradle] ( ./build.gradle ) ,
1820simply run:
1921
@@ -27,7 +29,37 @@ or on Windows platform:
2729.\gradlew.bat appRun
2830```
2931
30- (JDK is needed.)
32+ JDK is needed. Versions 8 and 11 were tested and are working, 17 seems to
33+ have issues.
34+
35+ ### building a portable fat jar
36+
37+ This method builds a one-file portable fat JAR including an embedded
38+ Tomcat server.
39+
40+ Simply run the gradle wrapper with the configured `shadowJar' task:
41+
42+ ```
43+ ./gradlew shadowJar
44+ ```
45+
46+ or on Windows platform:
47+
48+ ```
49+ .\gradlew.bat shadowJar
50+ ```
51+
52+ The compiled and packages JAR file will be built in the folder ` ./build/libs ` .
53+
54+ It is portable and can be launched using JRE:
55+
56+ ```
57+ java -jar ./build/libs/log4shell-vulnerable-app-all.jar
58+ ```
59+
60+ The all-in-one portable JAR is available on the [ releases page] ( https://github.com/tothi/log4shell-vulnerable-app/releases ) here in the repo.
61+
62+ ### interacting with the vulnerable application
3163
3264The vulnerable application should listen on _ all_ interfaces by
3365default (DANGEROUS behavior if you run it on a production box).
Original file line number Diff line number Diff line change 11plugins {
22 id " war"
33 id " org.gretty" version " 3.0.5"
4+ id " com.github.johnrengelman.shadow" version " 7.1.2"
5+ id " java"
46}
57
68sourceCompatibility = " 1.8"
@@ -12,9 +14,29 @@ repositories {
1214
1315dependencies {
1416 implementation ' org.apache.logging.log4j:log4j-core:2.14.1'
17+ if (project. gradle. startParameter. taskNames. first(). contains(" shadow" )) {
18+ implementation ' org.apache.tomcat.embed:tomcat-embed-jasper:8.5.75'
19+ }
1520}
1621
1722gretty {
1823 contextPath = ' app'
1924 servletContainer = ' tomcat85'
2025}
26+
27+ sourceSets {
28+ main {
29+ java {
30+ srcDir ' src'
31+ if (! project. gradle. startParameter. taskNames. first(). contains(" shadow" )) {
32+ exclude ' **/launch/**'
33+ }
34+ }
35+ }
36+ }
37+
38+ jar {
39+ manifest {
40+ attributes(' Main-Class' : ' launch.Main' )
41+ }
42+ }
Original file line number Diff line number Diff line change 1212
1313public class VulnServlet extends HttpServlet {
1414 protected void doGet (HttpServletRequest req , HttpServletResponse res ) throws ServletException {
15- Logger logger = LogManager .getLogger ();
15+ Logger logger = LogManager .getLogger (VulnServlet . class );
1616 try {
1717 Map <String , String > headers = Collections .list (req .getHeaderNames ()).stream ().collect (Collectors .toMap (h -> h , req ::getHeader ));
1818 res .setContentType ("text/plain; charset=utf-8" );
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments