Skip to content

Commit

Permalink
Fix SQL injection mitigation answer (fixes WebGoat#505)
Browse files Browse the repository at this point in the history
You need to submit the IP of the webgoat-prd server, not just any of the IPs.
  • Loading branch information
Omniscimus authored and nbaars committed Nov 19, 2018
1 parent 3536fd0 commit 5921a06
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class SqlInjectionLesson12a extends AssignmentEndpoint {
@SneakyThrows
public AttackResult completed(@RequestParam String ip) {
Connection connection = DatabaseUtilities.getConnection(webSession);
PreparedStatement preparedStatement = connection.prepareStatement("select ip from servers where ip = ?");
PreparedStatement preparedStatement = connection.prepareStatement("select ip from servers where hostname = 'webgoat-prd' and ip = ?");
preparedStatement.setString(1, ip);
ResultSet resultSet = preparedStatement.executeQuery();
if (resultSet.next()) {
Expand Down

0 comments on commit 5921a06

Please sign in to comment.