diff --git a/webgoat-lessons/http-basics/src/main/java/org/owasp/webgoat/plugin/HttpBasicsInterceptRequest.java b/webgoat-lessons/http-basics/src/main/java/org/owasp/webgoat/plugin/HttpBasicsInterceptRequest.java new file mode 100644 index 000000000..8118e076b --- /dev/null +++ b/webgoat-lessons/http-basics/src/main/java/org/owasp/webgoat/plugin/HttpBasicsInterceptRequest.java @@ -0,0 +1,59 @@ +package org.owasp.webgoat.plugin; + +import org.owasp.webgoat.endpoints.AssignmentEndpoint; +import org.owasp.webgoat.endpoints.AssignmentHints; +import org.owasp.webgoat.endpoints.AssignmentPath; +import org.owasp.webgoat.lessons.AttackResult; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; + +/** + * ************************************************************************************************* + * + * + * This file is part of WebGoat, an Open Web Application Security Project + * utility. For details, please see http://www.owasp.org/ + * + * Copyright (c) 2002 - 20014 Bruce Mayhew + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Getting Source ============== + * + * Source for this application is maintained at https://github.com/WebGoat/WebGoat, a repository + * for free software projects. + * + * For details, please see http://webgoat.github.io + * + * @author Bruce Mayhew WebGoat + * @created October 28, 2003 + */ +@AssignmentPath("/HttpBasics/intercept-request") +public class HttpBasicsInterceptRequest extends AssignmentEndpoint { + + @RequestMapping(method = RequestMethod.GET) + public @ResponseBody AttackResult completed(HttpServletRequest request) throws IOException { + if (request.getHeader("x-request-intercepted").toLowerCase().equals("true") && request.getParameter("changeMe").equals("Requests are tampered easily")) { + return trackProgress(AttackResult.success("Well done, you tampered the request as expected")); + } else { + return trackProgress(AttackResult.failed("Please try again. Make sure to make all the changes. And case sensitivity may matter ... or not, you never know!")); + } + } +} \ No newline at end of file diff --git a/webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/.DS_Store b/webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/.DS_Store new file mode 100644 index 000000000..cd3a2cf86 Binary files /dev/null and b/webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/.DS_Store differ diff --git a/webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/html/HttpBasics.html b/webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/html/HttpBasics.html index 30832a279..c432070d5 100644 --- a/webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/html/HttpBasics.html +++ b/webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/html/HttpBasics.html @@ -105,4 +105,23 @@ which you put in src/main/resources/plugin/lessonplans/{lang}/{fileName}.adoc -->
+ +
+ +
+
+
+
+ + + + +
+
+
+
+
\ No newline at end of file diff --git a/webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/images/proxy-intercept-button.png b/webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/images/proxy-intercept-button.png new file mode 100644 index 000000000..dd2858d6d Binary files /dev/null and b/webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/images/proxy-intercept-button.png differ diff --git a/webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/images/proxy-intercept-details.png b/webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/images/proxy-intercept-details.png new file mode 100644 index 000000000..e4a81742a Binary files /dev/null and b/webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/images/proxy-intercept-details.png differ diff --git a/webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/lessonPlans/en/HttpBasics_ProxyIntercept.adoc b/webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/lessonPlans/en/HttpBasics_ProxyIntercept.adoc new file mode 100644 index 000000000..37f362c77 --- /dev/null +++ b/webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/lessonPlans/en/HttpBasics_ProxyIntercept.adoc @@ -0,0 +1,25 @@ +=== Use the intercept + +To incercept a request, you start by clicking the green button. This will set a break point for the next request. + +image::plugin_lessons/plugin/HttpBasics/images/proxy-intercept-button.png[Set break/intercept button,style="lesson-image"] + +NOTE: It is also possible set breakpoints that are triggered on conditions. That won't be covered in this lesson though. You are encouraged to explore. +That's part of what hackers do ... explore! + +Once you are interecepting requests and a request is made, it should look something like this: + +image::plugin_lessons/plugin/HttpBasics/images/proxy-intercept-details.png[ZAP history tab,1269,337,style="lesson-image"] + +=== Intercept and modify a request + +Set up the intercept as noted above and then submit the form/request below by clicking the submit button. When you request is intercepted (hits the breakpoint), +modify it as follows. + +* Change the Method to GET +* Add a header 'x-request-intercepted:true' +* Change the input value 'changeMe' to 'Requests are tampered easily' (without the single quotes) + +Then let the request continue through (by hitting the play button). + +NOTE: The two play buttons behave a little differently, but we'll let you tinker and figure that out for yourself. \ No newline at end of file