Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security fix #31

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
CxFlowMasterPush-Test11

The BodgeIt Store is a vulnerable web application which is currently aimed at people who are new to pen testing.

> ### Please note that The BodgeIt Store is no longer being worked on
Expand Down
13 changes: 9 additions & 4 deletions root/basket.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<%@ page import="java.math.*" %>
<%@ page import="java.text.*" %>
<%@ page import="java.util.*" %>

<%@ page import="java.sql.PreparedStatement" %>
<%@ include file="/dbconnection.jspf" %>

<script type="text/javascript">
Expand Down Expand Up @@ -50,9 +50,14 @@ function decQuantity (prodid) {
// Dont need to do anything else

// Well, apart from checking to see if they've accessed someone elses basket ;)
Statement stmt = conn.createStatement();
try {
ResultSet rs = stmt.executeQuery("SELECT * FROM Baskets WHERE basketid = " + basketId);
//Statement stmt = conn.createStatement();
//Security Fix
PreparedStatement preparedStatement = con.prepareStatement(sql);
try {
//ResultSet rs = stmt.executeQuery("SELECT * FROM Baskets WHERE basketid = " + basketId);
String sql = "SELECT * FROM Baskets WHERE basketid =?");
preparedStatement.setString(1, basketId);
ResetSet rs = preparedStatement.executeQuery();
rs.next();
String bUserId = "" + rs.getInt("userid");
if ((userid == null && ! bUserId.equals("0")) || (userid != null && userid.equals(bUserId))) {
Expand Down