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:
parent
3536fd0b6d
commit
5921a06747
@ -33,7 +33,7 @@ public class SqlInjectionLesson12a extends AssignmentEndpoint {
|
|||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public AttackResult completed(@RequestParam String ip) {
|
public AttackResult completed(@RequestParam String ip) {
|
||||||
Connection connection = DatabaseUtilities.getConnection(webSession);
|
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);
|
preparedStatement.setString(1, ip);
|
||||||
ResultSet resultSet = preparedStatement.executeQuery();
|
ResultSet resultSet = preparedStatement.executeQuery();
|
||||||
if (resultSet.next()) {
|
if (resultSet.next()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user