2015-06-08 18:29:37 +00:00
|
|
|
/*
|
2018-10-30 00:09:20 +00:00
|
|
|
* Copyright (c) 2010-2015 SAP SE.
|
|
|
|
* 2016-2018 The University of Sheffield.
|
|
|
|
*
|
2015-06-08 18:29:37 +00:00
|
|
|
* All rights reserved. This program and the accompanying materials
|
2018-10-30 00:09:20 +00:00
|
|
|
* This program and the accompanying materials are made
|
|
|
|
* available under the terms of the Eclipse Public License 2.0
|
|
|
|
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
2015-06-08 18:29:37 +00:00
|
|
|
*
|
2018-10-30 00:09:20 +00:00
|
|
|
* SPDX-License-Identifier: EPL-2.0
|
2015-06-08 18:29:37 +00:00
|
|
|
*/
|
|
|
|
|
2017-05-21 14:58:16 +00:00
|
|
|
package com.logicalhacking.dasca.dataflow.test.data;
|
2015-06-08 18:29:37 +00:00
|
|
|
|
|
|
|
import java.sql.Connection;
|
|
|
|
import java.sql.SQLException;
|
|
|
|
import java.sql.Statement;
|
|
|
|
|
2017-05-21 14:58:16 +00:00
|
|
|
import com.logicalhacking.dasca.dataflow.test.data.dummy.IO;
|
2015-06-08 18:29:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Test Case 17:
|
|
|
|
//reachability from multiple identical bad sinks to one bad source with multiple vulnerabilities
|
|
|
|
public class Test17 {
|
2015-06-08 19:43:23 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 2 findings
|
|
|
|
*/
|
|
|
|
public void bad(int i) {
|
2015-06-08 18:29:37 +00:00
|
|
|
String userName = "";
|
2015-06-08 19:43:23 +00:00
|
|
|
|
2015-06-08 18:29:37 +00:00
|
|
|
if(i < 0) {
|
2015-06-08 19:43:23 +00:00
|
|
|
userName = IO.readLine();
|
|
|
|
} else {
|
|
|
|
userName = IO.readLine();
|
2015-06-08 18:29:37 +00:00
|
|
|
}
|
2015-06-08 19:43:23 +00:00
|
|
|
|
2015-06-08 18:29:37 +00:00
|
|
|
Connection conn = IO.getDBConnection();
|
|
|
|
try {
|
|
|
|
Statement stmt = conn.createStatement();
|
|
|
|
stmt.execute("SELECT * FROM user WHERE name='" + userName + "';");
|
|
|
|
} catch(SQLException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
2015-06-08 19:43:23 +00:00
|
|
|
Test17 test = new Test17();
|
|
|
|
test.bad(5);
|
|
|
|
}
|
2015-06-08 18:29:37 +00:00
|
|
|
}
|