Adding request intercept assignment
This commit is contained in:
parent
ac16342c17
commit
f7ec164601
@ -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 <a href="http://code.google.com/p/webgoat">WebGoat</a>
|
||||||
|
* @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!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/.DS_Store
vendored
Normal file
BIN
webgoat-lessons/http-basics/src/main/resources/plugin/HttpBasics/.DS_Store
vendored
Normal file
Binary file not shown.
@ -105,4 +105,23 @@
|
|||||||
which you put in src/main/resources/plugin/lessonplans/{lang}/{fileName}.adoc -->
|
which you put in src/main/resources/plugin/lessonplans/{lang}/{fileName}.adoc -->
|
||||||
<div class="adoc-content" th:replace="doc:HttpBasics_ProxyIntro3.adoc"></div>
|
<div class="adoc-content" th:replace="doc:HttpBasics_ProxyIntro3.adoc"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="lesson-page-wrapper">
|
||||||
|
<!-- stripped down without extra comments -->
|
||||||
|
<div class="adoc-content" th:replace="doc:HttpBasics_ProxyIntercept.adoc"></div>
|
||||||
|
<div class="attack-container">
|
||||||
|
<div class="assignment-success"><i class="fa fa-2 fa-check hidden" aria-hidden="true"></i></div>
|
||||||
|
<form class="attack-form" accept-charset="UNKNOWN" name="intercept-request"
|
||||||
|
method="POST"
|
||||||
|
action="/WebGoat/HttpBasics/intercept-request"
|
||||||
|
enctype="application/json;charset=UTF-8">
|
||||||
|
|
||||||
|
<input type="text" value="doesn't matter really" name="changeMe" />
|
||||||
|
<input type="submit" value="Submit" />
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<div class="attack-feedback"></div>
|
||||||
|
<div class="attack-output"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</html>
|
</html>
|
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
Binary file not shown.
After Width: | Height: | Size: 205 KiB |
@ -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.
|
Loading…
x
Reference in New Issue
Block a user