我正在学习SQLInjection的一些培训网页(所以我不知道什么是后端)。我正在尝试下一次注射,以获得DB类型。
(1) http://url/?departamento=1 union select user()这样,如果DB是MySQL,我就会得到一些结果。然而,我没有看到任何结果。如果我将注入更改为这个新句子,数据将被正确地返回,因此DB是MySQL (即使我也可以看到这个新注入的DB名称):
(2) http://url/?departamento=1 union select 1,user()然而,如果我再次改变注入到其中之一,结果就会改变。
(3) http://url/?departamento=1 union select 1,2,user() (I don't see any data)
(4) http://url/?departamento=1 union select user(),2 (Here I don't see the DB name)我不明白为什么要添加(在第二个select语句中)更多的列来查看数据。为什么会发生这种情况?
谢谢!
发布于 2018-11-25 19:26:31
假设后端是Java,代码正在执行类似的操作:
// 1 union select 1,user()
String query = "select a, b, c from someTable where departamento = "
+ request.getParameter("departamento"); // the injection is here
try (Statement stmt = con.createStatement()) {
try (Result rs = stmt.executeQuery()) {
while (rs.next()) {
int a = rs.getInt(1); // column "a"
String b = rs.getString(2); // column "b"
Date c = rs.getDate(3); // column "c"
System.out.println("a: " + a + ", b: " + b + ", " c: " + c);
}
}
}要使注入工作,您需要生成一个有效的SQL语句。
departemento)的右侧匹配。https://stackoverflow.com/questions/53470986
复制相似问题