diff --git a/main/project/JavaSource/org/owasp/webgoat/Catcher.java b/main/project/JavaSource/org/owasp/webgoat/Catcher.java
index 563a91688..3d490e1f1 100644
--- a/main/project/JavaSource/org/owasp/webgoat/Catcher.java
+++ b/main/project/JavaSource/org/owasp/webgoat/Catcher.java
@@ -82,7 +82,7 @@ public class Catcher extends HammerHead
// setCacheHeaders(response, 0);
WebSession session = (WebSession) request.getSession(true).getAttribute(WebSession.SESSION);
session.update(request, response, this.getServletName()); // FIXME: Too much in this
- // call.
+ // call.
int scr = session.getCurrentScreen();
Course course = session.getCourse();
diff --git a/main/project/JavaSource/org/owasp/webgoat/lessons/AbstractLesson.java b/main/project/JavaSource/org/owasp/webgoat/lessons/AbstractLesson.java
index 6b0c337f4..873a9a91b 100644
--- a/main/project/JavaSource/org/owasp/webgoat/lessons/AbstractLesson.java
+++ b/main/project/JavaSource/org/owasp/webgoat/lessons/AbstractLesson.java
@@ -11,7 +11,6 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;
-
import org.apache.ecs.Element;
import org.apache.ecs.ElementContainer;
import org.apache.ecs.StringElement;
@@ -504,9 +503,9 @@ public abstract class AbstractLesson extends Screen implements Comparable"
- + "Send this message to: " +
- s.getWebgoatContext().getFeedbackAddress() + "");
+ + "Send this message to: " + s.getWebgoatContext().getFeedbackAddress() + "");
}
Html html = new Html();
@@ -531,15 +530,15 @@ public abstract class AbstractLesson extends Screen implements Comparable"
- + "Send this message to: " +
- s.getWebgoatContext().getFeedbackAddress() + "");
+ + "Send this message to: " + s.getWebgoatContext().getFeedbackAddress() + "");
}
// Solutions are html files
diff --git a/main/project/JavaSource/org/owasp/webgoat/lessons/BackDoors.java b/main/project/JavaSource/org/owasp/webgoat/lessons/BackDoors.java
index 0802a54a1..309e6336e 100644
--- a/main/project/JavaSource/org/owasp/webgoat/lessons/BackDoors.java
+++ b/main/project/JavaSource/org/owasp/webgoat/lessons/BackDoors.java
@@ -78,10 +78,11 @@ public class BackDoors extends SequentialLessonAdapter
{
return concept2(s);
}
-
+
private void addDBEntriesToEC(ElementContainer ec, ResultSet rs)
{
- try {
+ try
+ {
if (rs.next())
{
Table t = new Table(0).setCellSpacing(0).setCellPadding(0).setBorder(1);
@@ -92,7 +93,7 @@ public class BackDoors extends SequentialLessonAdapter
tr.addElement(new TH("Salary"));
tr.addElement(new TH("E-Mail"));
t.addElement(tr);
-
+
tr = new TR();
tr.addElement(new TD(rs.getString("userid")));
tr.addElement(new TD(rs.getString("password")));
@@ -112,7 +113,8 @@ public class BackDoors extends SequentialLessonAdapter
}
ec.addElement(t);
}
- } catch (SQLException e) {
+ } catch (SQLException e)
+ {
// TODO Auto-generated catch block
e.printStackTrace();
}
@@ -166,9 +168,8 @@ public class BackDoors extends SequentialLessonAdapter
userInput = SELECT_ST + userInput;
String[] arrSQL = userInput.split(";");
Connection conn = DatabaseUtilities.getConnection(s);
- Statement statement = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
- ResultSet.CONCUR_READ_ONLY);
-
+ Statement statement = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
+
if (arrSQL.length == 2)
{
if (userInput.toUpperCase().indexOf("CREATE TRIGGER") != -1)
@@ -178,7 +179,6 @@ public class BackDoors extends SequentialLessonAdapter
}
ResultSet rs = statement.executeQuery(arrSQL[0]);
addDBEntriesToEC(ec, rs);
-
}
return ec;
diff --git a/main/project/JavaSource/org/owasp/webgoat/lessons/BlindSqlInjection.java b/main/project/JavaSource/org/owasp/webgoat/lessons/BlindSqlInjection.java
index 121c12144..974abb709 100644
--- a/main/project/JavaSource/org/owasp/webgoat/lessons/BlindSqlInjection.java
+++ b/main/project/JavaSource/org/owasp/webgoat/lessons/BlindSqlInjection.java
@@ -89,8 +89,8 @@ public class BlindSqlInjection extends LessonAdapter
ResultSet.CONCUR_READ_ONLY);
ResultSet answer_results = answer_statement.executeQuery(answer_query);
answer_results.first();
- //System.out.println("Account: " + accountNumber);
- //System.out.println("Answer : " + answer_results.getString(1));
+ // System.out.println("Account: " + accountNumber);
+ // System.out.println("Answer : " + answer_results.getString(1));
if (accountNumber.toString().equals(answer_results.getString(1)))
{
makeSuccess(s);
@@ -144,7 +144,6 @@ public class BlindSqlInjection extends LessonAdapter
return new StringElement("By Chuck Willis");
}
-
/**
* Gets the hints attribute of the DatabaseFieldScreen object
*
@@ -153,35 +152,33 @@ public class BlindSqlInjection extends LessonAdapter
protected List getHints(WebSession s)
{
List hints = new ArrayList();
- hints.add("Compound SQL statements can be made by joining multiple tests with keywords like AND and OR. "
- + "Create a SQL statement that you can use as a true/false test and then "
- + "select the first character of the target element and do a start narrowing "
- + "down the character using > and <"
- + "
The backend database is HSQLDB. Keep that in mind if you research SQL functions "
- + "on the Internet since different databases use some different functions and syntax.");
- hints.add("This is the code for the query being built and issued by WebGoat:
"
- + "\"SELECT * FROM user_data WHERE userid = \" + accountNumber ");
- hints.add("The application is taking your input and inserting it at the end of a pre-formed SQL command. "
- + "You will need to make use of the following SQL functions: "
- + "
SELECT - query for your target data and get a string "
- + "
substr(string, start, length) - returns a "
- + "substring of string starting at the start character and going for length characters "
- + "
ascii(string) will return the ascii value of the first character in string "
- + "
> and < - once you have a character's value, compare it to a choosen one");
- hints.add("Example: is the first character of the first_name of userid " + TARGET_ACCT_NUM
- + " less than 'M' (ascii 77)? "
- + "
101 AND (ascii( substr((SELECT first_name FROM user_data WHERE userid=" + TARGET_ACCT_NUM
- + ") , 1 , 1) ) < 77 ); "
- + "
If you get back that account number is valid, then yes. If get back that the number is"
- + "invalid then answer is no.");
- hints.add("Another example: is the second character of the first_name of userid "
- + TARGET_ACCT_NUM
- + " greater than 'm' (ascii 109)? "
- + "
101 AND (ascii( substr((SELECT first_name FROM user_data WHERE userid="
- + TARGET_ACCT_NUM
- + ") , 2 , 1) ) > 109 ); "
- + "
If you get back that account number is valid, then yes. If get back that the number is "
- + "invalid then answer is no.");
+ hints.add("Compound SQL statements can be made by joining multiple tests with keywords like AND and OR. "
+ + "Create a SQL statement that you can use as a true/false test and then "
+ + "select the first character of the target element and do a start narrowing "
+ + "down the character using > and <"
+ + "
The backend database is HSQLDB. Keep that in mind if you research SQL functions "
+ + "on the Internet since different databases use some different functions and syntax.");
+ hints.add("This is the code for the query being built and issued by WebGoat:
"
+ + "\"SELECT * FROM user_data WHERE userid = \" + accountNumber ");
+ hints.add("The application is taking your input and inserting it at the end of a pre-formed SQL command. "
+ + "You will need to make use of the following SQL functions: "
+ + "
SELECT - query for your target data and get a string "
+ + "
substr(string, start, length) - returns a "
+ + "substring of string starting at the start character and going for length characters "
+ + "
ascii(string) will return the ascii value of the first character in string "
+ + "
> and < - once you have a character's value, compare it to a choosen one");
+ hints.add("Example: is the first character of the first_name of userid " + TARGET_ACCT_NUM
+ + " less than 'M' (ascii 77)? "
+ + "
101 AND (ascii( substr((SELECT first_name FROM user_data WHERE userid=" + TARGET_ACCT_NUM
+ + ") , 1 , 1) ) < 77 ); "
+ + "
If you get back that account number is valid, then yes. If get back that the number is"
+ + "invalid then answer is no.");
+ hints.add("Another example: is the second character of the first_name of userid " + TARGET_ACCT_NUM
+ + " greater than 'm' (ascii 109)? "
+ + "
101 AND (ascii( substr((SELECT first_name FROM user_data WHERE userid=" + TARGET_ACCT_NUM
+ + ") , 2 , 1) ) > 109 ); "
+ + "
If you get back that account number is valid, then yes. If get back that the number is "
+ + "invalid then answer is no.");
return hints;
}
@@ -233,7 +230,7 @@ public class BlindSqlInjection extends LessonAdapter
super.handleRequest(s);
} catch (Exception e)
{
- //System.out.println("Exception caught: " + e);
+ // System.out.println("Exception caught: " + e);
e.printStackTrace(System.out);
}
}
diff --git a/main/project/JavaSource/org/owasp/webgoat/lessons/CSRF.java b/main/project/JavaSource/org/owasp/webgoat/lessons/CSRF.java
index e661e06a3..290fab958 100644
--- a/main/project/JavaSource/org/owasp/webgoat/lessons/CSRF.java
+++ b/main/project/JavaSource/org/owasp/webgoat/lessons/CSRF.java
@@ -68,7 +68,7 @@ public class CSRF extends LessonAdapter
private final static int TITLE_COL = 2;
private static int count = 1;
private final static int USER_COL = 4; // Added by Chuck Willis - used to show user who posted
- // message
+ // message
private final static IMG MAC_LOGO = new IMG("images/logos/macadamian.gif").setAlt("Macadamian Technologies")
.setBorder(0).setHspace(0).setVspace(0);
diff --git a/main/project/JavaSource/org/owasp/webgoat/lessons/Category.java b/main/project/JavaSource/org/owasp/webgoat/lessons/Category.java
index 063b57420..87a14c8a6 100644
--- a/main/project/JavaSource/org/owasp/webgoat/lessons/Category.java
+++ b/main/project/JavaSource/org/owasp/webgoat/lessons/Category.java
@@ -40,7 +40,7 @@ public class Category implements Comparable
{
public final static Category INTRODUCTION = new Category("Introduction", new Integer(5));
-
+
public final static Category GENERAL = new Category("General", new Integer(100));
public final static Category ACCESS_CONTROL = new Category("Access Control Flaws", new Integer(200));
@@ -64,7 +64,7 @@ public class Category implements Comparable
public final static Category INJECTION = new Category("Injection Flaws", new Integer(1200));
public final static Category INSECURE_COMMUNICATION = new Category("Insecure Communication", new Integer(1300));
-
+
public final static Category INSECURE_CONFIGURATION = new Category("Insecure Configuration", new Integer(1400));
public final static Category INSECURE_STORAGE = new Category("Insecure Storage", new Integer(1500));
diff --git a/main/project/JavaSource/org/owasp/webgoat/lessons/Challenge2Screen.java b/main/project/JavaSource/org/owasp/webgoat/lessons/Challenge2Screen.java
index 924767fb8..2b06a26ab 100644
--- a/main/project/JavaSource/org/owasp/webgoat/lessons/Challenge2Screen.java
+++ b/main/project/JavaSource/org/owasp/webgoat/lessons/Challenge2Screen.java
@@ -282,7 +282,6 @@ public class Challenge2Screen extends SequentialLessonAdapter
*/
/*
* (non-Javadoc)
- *
* @see lessons.LessonAdapter#doStage3(session.WebSession)
*/
protected Element doStage3(WebSession s) throws Exception
@@ -631,7 +630,7 @@ public class Challenge2Screen extends SequentialLessonAdapter
t.setBorder(1);
}
- String[] colWidths = new String[]{"55", "110", "260", "70"};
+ String[] colWidths = new String[] { "55", "110", "260", "70" };
TR tr = new TR();
tr.addElement(new TH().addElement("Protocol").setWidth(colWidths[0]));
tr.addElement(new TH().addElement("Local Address").setWidth(colWidths[1]));
@@ -678,7 +677,7 @@ public class Challenge2Screen extends SequentialLessonAdapter
tr = new TR();
TD td;
StringTokenizer tokens = new StringTokenizer(lines.nextToken(), "\t ");
- while (tokens.hasMoreTokens() && columnCount <4)
+ while (tokens.hasMoreTokens() && columnCount < 4)
{
td = new TD().setWidth(colWidths[columnCount++]);
tr.addElement(td.addElement(tokens.nextToken()));
@@ -725,7 +724,7 @@ public class Challenge2Screen extends SequentialLessonAdapter
osw.write(message);
} catch (Exception e)
{
- //System.out.println("Couldn't write " + message + " to " + s);
+ // System.out.println("Couldn't write " + message + " to " + s);
e.printStackTrace();
}
}
diff --git a/main/project/JavaSource/org/owasp/webgoat/lessons/ClientSideFiltering/ClientSideFiltering.java b/main/project/JavaSource/org/owasp/webgoat/lessons/ClientSideFiltering/ClientSideFiltering.java
index 804f26fb8..530a74af1 100644
--- a/main/project/JavaSource/org/owasp/webgoat/lessons/ClientSideFiltering/ClientSideFiltering.java
+++ b/main/project/JavaSource/org/owasp/webgoat/lessons/ClientSideFiltering/ClientSideFiltering.java
@@ -95,8 +95,6 @@ public class ClientSideFiltering extends SequentialLessonAdapter
t.setID("hiddenEmployeeRecords");
t.setStyle("display: none");
-
-
workspaceDiv.addElement(t);
@@ -334,7 +332,8 @@ public class ClientSideFiltering extends SequentialLessonAdapter
hints.add("Stage 1: Use Firebug to find where the information is stored on the client side.");
- hints.add("Stage 1: Examine the hidden table to see if there is anyone listed who is not in the drop down menu.");
+ hints
+ .add("Stage 1: Examine the hidden table to see if there is anyone listed who is not in the drop down menu.");
hints.add("Stage 1: Look in the last row of the hidden table.");
diff --git a/main/project/JavaSource/org/owasp/webgoat/lessons/ConcurrencyCart.java b/main/project/JavaSource/org/owasp/webgoat/lessons/ConcurrencyCart.java
index c3bbdf763..20034a318 100644
--- a/main/project/JavaSource/org/owasp/webgoat/lessons/ConcurrencyCart.java
+++ b/main/project/JavaSource/org/owasp/webgoat/lessons/ConcurrencyCart.java
@@ -137,7 +137,7 @@ public class ConcurrencyCart extends LessonAdapter
} catch (ParameterNotFoundException pnfe)
{
- //System.out.println("[DEBUG] no action selected, defaulting to createShoppingPage");
+ // System.out.println("[DEBUG] no action selected, defaulting to createShoppingPage");
ec = createShoppingPage(s, quantity1, quantity2, quantity3, quantity4);
}
@@ -154,9 +154,7 @@ public class ConcurrencyCart extends LessonAdapter
}
/*
- * ********************************************************************* ******************
- * PURCHASING PAGE **********************************
- * *********************************************************************
+ * PURCHASING PAGE
*/
private ElementContainer createPurchaseContent(WebSession s, int quantity1, int quantity2, int quantity3,
@@ -303,9 +301,7 @@ public class ConcurrencyCart extends LessonAdapter
}
/*
- * ********************************************************************* ******************
- * CONFIRMATION PAGE ********************************
- * *********************************************************************
+ * CONFIRMATION PAGE
*/
private ElementContainer confirmation(WebSession s, int quantity1, int quantity2, int quantity3, int quantity4)
@@ -420,9 +416,7 @@ public class ConcurrencyCart extends LessonAdapter
}
/*
- * ********************************************************************* ******************
- * SHOPPING PAGE **********************************
- * *********************************************************************
+ * SHOPPING PAGE
*/
private ElementContainer createShoppingPage(WebSession s, int quantity1, int quantity2, int quantity3, int quantity4)
diff --git a/main/project/JavaSource/org/owasp/webgoat/lessons/CrossSiteScripting/CrossSiteScripting.java b/main/project/JavaSource/org/owasp/webgoat/lessons/CrossSiteScripting/CrossSiteScripting.java
index 1260b13b0..96ae2e6da 100644
--- a/main/project/JavaSource/org/owasp/webgoat/lessons/CrossSiteScripting/CrossSiteScripting.java
+++ b/main/project/JavaSource/org/owasp/webgoat/lessons/CrossSiteScripting/CrossSiteScripting.java
@@ -98,23 +98,25 @@ public class CrossSiteScripting extends GoatHillsFinancial
{
return Category.XSS;
}
-
-
- public String getLessonSolutionFileName(WebSession s) {
+
+ public String getLessonSolutionFileName(WebSession s)
+ {
String solutionFileName = null;
String stage = getStage(s);
solutionFileName = "/lesson_solutions/Lab XSS/Lab " + stage + ".html";
return solutionFileName;
}
-
+
@Override
- public String getSolution(WebSession s) {
+ public String getSolution(WebSession s)
+ {
String src = null;
try
{
- //System.out.println("Solution: " + getLessonSolutionFileName(s));
- src = readFromFile(new BufferedReader(new FileReader(s.getWebResource(getLessonSolutionFileName(s)))), false);
+ // System.out.println("Solution: " + getLessonSolutionFileName(s));
+ src = readFromFile(new BufferedReader(new FileReader(s.getWebResource(getLessonSolutionFileName(s)))),
+ false);
} catch (IOException e)
{
s.setMessage("Could not find the solution file");
@@ -123,7 +125,7 @@ public class CrossSiteScripting extends GoatHillsFinancial
return src;
}
-
+
/**
* Gets the hints attribute of the DirectoryScreen object
*
@@ -148,9 +150,9 @@ public class CrossSiteScripting extends GoatHillsFinancial
// Stage 3
-
// Stage 4
- hints.add("Stage4: Examine content served in response to form submissions looking for data taken from the form.");
+ hints
+ .add("Stage4: Examine content served in response to form submissions looking for data taken from the form.");
hints.add("Stage4: There is a class called HtmlEncoder in org.owasp.webgoat.util");
// Stage 5
hints
@@ -179,8 +181,8 @@ public class CrossSiteScripting extends GoatHillsFinancial
}
else if (STAGE2.equals(stage))
{
- instructions = "Stage 2: Block Stored XSS using Input Validation.
" +
- " THIS LESSON ONLY WORKS WITH THE DEVELOPER VERSION OF WEBGOAT
"
+ + " THIS LESSON ONLY WORKS WITH THE DEVELOPER VERSION OF WEBGOAT
"
+ "Implement a fix to block the stored XSS before it can be written to the database. "
+ "Repeat stage 1 as 'Eric' with 'David' as the manager. Verify that 'David' is not affected by the attack.";
}
@@ -192,8 +194,8 @@ public class CrossSiteScripting extends GoatHillsFinancial
}
else if (STAGE4.equals(stage))
{
- instructions = "Stage 4: Block Stored XSS using Output Encoding.
" +
- " THIS LESSON ONLY WORKS WITH THE DEVELOPER VERSION OF WEBGOAT
"
+ + " THIS LESSON ONLY WORKS WITH THE DEVELOPER VERSION OF WEBGOAT
"
+ "Implement a fix to block XSS after it is read from the database. "
+ "Repeat stage 3. Verify that 'David' is not affected by Bruce's profile attack.";
}
@@ -205,8 +207,8 @@ public class CrossSiteScripting extends GoatHillsFinancial
}
else if (STAGE6.equals(stage))
{
- instructions = "Stage 6: Block Reflected XSS using Input Validation.
" +
- " THIS LESSON ONLY WORKS WITH THE DEVELOPER VERSION OF WEBGOAT