Fix SQL injection mitigation answer (fixes #505)
You need to submit the IP of the webgoat-prd server, not just any of the IPs.
This commit is contained in:
@ -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()) {
|
||||
|
Reference in New Issue
Block a user