52 lines
1.3 KiB
Java
52 lines
1.3 KiB
Java
/*
|
|
* Copyright (c) 2010-2015 SAP SE.
|
|
* 2016-2018 The University of Sheffield.
|
|
*
|
|
* All rights reserved. This program and the accompanying materials
|
|
* 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/
|
|
*
|
|
* SPDX-License-Identifier: EPL-2.0
|
|
*/
|
|
|
|
package com.logicalhacking.dasca.dataflow.test.data;
|
|
|
|
import java.sql.Connection;
|
|
import java.sql.SQLException;
|
|
import java.sql.Statement;
|
|
|
|
import com.logicalhacking.dasca.dataflow.test.data.dummy.IO;
|
|
|
|
|
|
// Test Case 18:
|
|
//reachability from multiple differing bad sinks to one bad source with one vulnerability
|
|
public class Test18 {
|
|
|
|
/*
|
|
* 1 findings
|
|
*/
|
|
public void bad() {
|
|
String userName;
|
|
|
|
if(true) {
|
|
userName = IO.readLine();
|
|
} else {
|
|
userName = IO.readLine2();
|
|
}
|
|
|
|
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) {
|
|
Test18 test = new Test18();
|
|
test.bad();
|
|
}
|
|
}
|