* Some initial refactoring * Make it one application * Got it working * Fix problem on Windows * Move WebWolf * Move first lesson * Moved all lessons * Fix pom.xml * Fix tests * Add option to initialize a lesson This way we can create content for each user inside a lesson. The initialize method will be called when a new user is created or when a lesson reset happens * Clean up pom.xml files * Remove fetching labels based on language. We only support English at the moment, all the lesson explanations are written in English which makes it very difficult to translate. If we only had labels it would make sense to support multiple languages * Fix SonarLint issues * And move it all to the main project * Fix for documentation paths * Fix pom warnings * Remove PMD as it does not work * Update release notes about refactoring Update release notes about refactoring Update release notes about refactoring * Fix lesson template * Update release notes * Keep it in the same repo in Dockerhub * Update documentation to show how the connection is obtained. Resolves: #1180 * Rename all integration tests * Remove command from Dockerfile * Simplify GitHub actions Currently, we use a separate actions for pull-requests and branch build. This is now consolidated in one action. The PR action triggers always, it now only trigger when the PR is opened and not in draft. Running all platforms on a branch build is a bit too much, it is better to only run all platforms when someone opens a PR. * Remove duplicate entry from release notes * Add explicit registry for base image * Lesson scanner not working when fat jar When running the fat jar we have to take into account we are reading from the jar file and not the filesystem. In this case you cannot use `getFile` for example. * added info in README and fixed release docker * changed base image and added ignore file Co-authored-by: Zubcevic.com <rene@zubcevic.com>
79 lines
3.0 KiB
Java
79 lines
3.0 KiB
Java
package org.owasp.webgoat;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
public class SqlInjectionLessonIntegrationTest extends IntegrationTest {
|
|
|
|
public static final String sql_2 = "select department from employees where last_name='Franco'";
|
|
public static final String sql_3 = "update employees set department='Sales' where last_name='Barnett'";
|
|
public static final String sql_4_drop = "alter table employees drop column phone";
|
|
public static final String sql_4_add = "alter table employees add column phone varchar(20)";
|
|
public static final String sql_5 = "grant select on grant_rights to unauthorized_user";
|
|
public static final String sql_9_account = " ' ";
|
|
public static final String sql_9_operator = "or";
|
|
public static final String sql_9_injection = "'1'='1";
|
|
public static final String sql_10_login_count = "2";
|
|
public static final String sql_10_userid = "1 or 1=1";
|
|
|
|
public static final String sql_11_a = "Smith' or '1' = '1";
|
|
public static final String sql_11_b = "3SL99A' or '1'='1";
|
|
|
|
public static final String sql_12_a = "Smith";
|
|
public static final String sql_12_b = "3SL99A' ; update employees set salary= '100000' where last_name='Smith";
|
|
|
|
public static final String sql_13 = "%update% '; drop table access_log ; --'";
|
|
|
|
@Test
|
|
public void runTests() {
|
|
startLesson("SqlInjection");
|
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
params.clear();
|
|
params.put("query", sql_2);
|
|
checkAssignment(url("/WebGoat/SqlInjection/attack2"), params, true);
|
|
|
|
params.clear();
|
|
params.put("query", sql_3);
|
|
checkAssignment(url("/WebGoat/SqlInjection/attack3"), params, true);
|
|
|
|
params.clear();
|
|
params.put("query", sql_4_add);
|
|
checkAssignment(url("/WebGoat/SqlInjection/attack4"), params, true);
|
|
|
|
params.clear();
|
|
params.put("query", sql_5);
|
|
checkAssignment(url("/WebGoat/SqlInjection/attack5"), params, true);
|
|
|
|
params.clear();
|
|
params.put("operator", sql_9_operator);
|
|
params.put("account", sql_9_account);
|
|
params.put("injection", sql_9_injection);
|
|
checkAssignment(url("/WebGoat/SqlInjection/assignment5a"), params, true);
|
|
|
|
params.clear();
|
|
params.put("login_count", sql_10_login_count);
|
|
params.put("userid", sql_10_userid);
|
|
checkAssignment(url("/WebGoat/SqlInjection/assignment5b"), params, true);
|
|
|
|
params.clear();
|
|
params.put("name", sql_11_a);
|
|
params.put("auth_tan", sql_11_b);
|
|
checkAssignment(url("/WebGoat/SqlInjection/attack8"), params, true);
|
|
|
|
params.clear();
|
|
params.put("name", sql_12_a);
|
|
params.put("auth_tan", sql_12_b);
|
|
checkAssignment(url("/WebGoat/SqlInjection/attack9"), params, true);
|
|
|
|
params.clear();
|
|
params.put("action_string", sql_13);
|
|
checkAssignment(url("/WebGoat/SqlInjection/attack10"), params, true);
|
|
|
|
checkResults("/SqlInjection/");
|
|
|
|
}
|
|
}
|