@@ -35,38 +35,104 @@ Install guide for Ubuntu:
35
35
1. git clone
[email protected] :WebGoat/WebGoat.git
36
36
2. cd WebGoat
37
37
3. git checkout develop
38
- 4. (optional) Open the file:
39
- ./WebGoat/webgoat-lessons/sql-injection/src/main/java/org/owasp/webgoat/plugin/introduction/SqlInjectionLesson5a.java
40
- and insert into the line 59 the following code:
41
- static String makeTainted(String accountName) {
42
- return accountName;
43
- }
44
-
45
- public void main() {
46
- String test = makeTainted("dave");
47
- completed(test);
48
- }
49
-
50
- The code adds an artificial entry point (the function "main") and also
51
- an artificial function "makeTainted" for making input to the function
52
- "completed" tainted. The reason for "makeTainted" function is that the
53
- WebGoat uses the Spring servlet framework which delivers the already
54
- potentially tainted data to the method "completed". But we do not have
55
- any feature in our rules specification which would capture that.
56
-
57
- NOTE: the entry-point for the Python driver script should thus then be:
58
- --entry-point org.owasp.webgoat.plugin.introduction.SqlInjectionLesson5a.main
59
-
60
38
4. mvn clean install -DskipTests
61
- 5. cd ..
62
- 6. rm -rf ./webgoat-container
39
+ 5. Create the following two files representing the entry point to WebGoat:
40
+ ./WebGoat/__MAIN__/src/main/java/Main.java:
41
+ import org.owasp.webgoat.plugin.introduction.SqlInjectionLesson5a;
42
+ import org.owasp.webgoat.plugin.introduction.SqlInjectionLesson5b;
43
+ import org.owasp.webgoat.plugin.introduction.SqlInjectionLesson6a;
44
+
45
+ public class Main {
46
+
47
+ static String makeTainted(String accountName) {
48
+ return accountName;
49
+ }
50
+
51
+ public static void main(String[] args) {
52
+ // SqlInjectionLesson5a
53
+ /*
54
+ {
55
+ String test = makeTainted("dave");
56
+ SqlInjectionLesson5a obj = new SqlInjectionLesson5a();
57
+ obj.completed(test);
58
+ }
59
+ */
60
+
61
+ // SqlInjectionLesson5b
62
+ /*
63
+ {
64
+ String test = makeTainted("dave");
65
+ SqlInjectionLesson5b obj = new SqlInjectionLesson5b();
66
+ try {
67
+ obj.completed(test, null);
68
+ }
69
+ catch(java.io.IOException e) {
70
+ }
71
+ }
72
+ */
73
+
74
+ // SqlInjectionLesson6a
75
+ /*
76
+ {
77
+ String test = makeTainted(args[0]);
78
+ SqlInjectionLesson6a obj = new SqlInjectionLesson6a();
79
+ try {
80
+ obj.completed(test);
81
+ }
82
+ catch(java.io.IOException e) {
83
+ }
84
+ }
85
+ */
86
+ }
87
+ }
88
+ Uncomment one of the blocks (depending on what lesson you want to analyse).
89
+
90
+ ./WebGoat/__MAIN__/pom.xml:
91
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
92
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
93
+ <modelVersion>4.0.0</modelVersion>
94
+ <groupId>__MAIN__</groupId>
95
+ <artifactId>__MAIN__</artifactId>
96
+ <packaging>jar</packaging>
97
+
98
+ <parent>
99
+ <groupId>org.owasp.webgoat</groupId>
100
+ <artifactId>webgoat-parent</artifactId>
101
+ <version>8.0.0.M3</version>
102
+ </parent>
103
+
104
+ <dependencies>
105
+ <dependency>
106
+ <groupId>org.owasp.webgoat.lesson</groupId>
107
+ <artifactId>sql-injection</artifactId>
108
+ <version>${project.version}</version>
109
+ <scope>provided</scope>
110
+ <type>jar</type>
111
+ </dependency>
112
+ <dependency>
113
+ <groupId>org.owasp.webgoat</groupId>
114
+ <artifactId>webgoat-container</artifactId>
115
+ <version>${project.version}</version>
116
+ <scope>provided</scope>
117
+ <type>jar</type>
118
+ </dependency>
119
+ </dependencies>
120
+ </project>
121
+ 6. cd __MAIN__
122
+ 7. mvn package
123
+ 8. cd ..
124
+ 9. cd ..
125
+ 10. rm -rf ./webgoat-container
63
126
64
127
The WebGoat does not seem to have a deployment step. Fortunately, the whole
65
128
app is relatively small, so we can load everything for each lesson. It means
66
129
that we can pass to the Python driver script these options:
67
130
-I <security-scanner-root-dir>/benchmarks/GENUINE/WebGoat
68
131
-L <security-scanner-root-dir>/benchmarks/GENUINE/WebGoat
69
-
132
+
133
+ From the step 5 above it should be clear that the entry point is specified as:
134
+ --entry-point Main.main
135
+
70
136
General notes: The project is set up in a relatively standard way, likely to allow people to
71
137
understand easily what's going on if they look at the code. The main vulnerabilities are
72
138
in the webgoat-lessons folder, which holds server web service endpoints that then test if
0 commit comments