-
Notifications
You must be signed in to change notification settings - Fork 654
/
Jdbc.java
36 lines (31 loc) · 1.04 KB
/
Jdbc.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package org.joychou.controller;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.sql.DriverManager;
/**
* Jdbc Attack @2023.04
*/
@Slf4j
@RestController
@RequestMapping("/jdbc")
public class Jdbc {
/**
* <a href="https://github.com/JoyChou93/java-sec-code/wiki/CVE-2022-21724">CVE-2022-21724</a>
*/
@RequestMapping("/postgresql")
public void postgresql(String jdbcUrlBase64) throws Exception{
byte[] b = java.util.Base64.getDecoder().decode(jdbcUrlBase64);
String jdbcUrl = new String(b);
log.info(jdbcUrl);
DriverManager.getConnection(jdbcUrl);
}
@RequestMapping("/db2")
public void db2(String jdbcUrlBase64) throws Exception{
Class.forName("com.ibm.db2.jcc.DB2Driver");
byte[] b = java.util.Base64.getDecoder().decode(jdbcUrlBase64);
String jdbcUrl = new String(b);
log.info(jdbcUrl);
DriverManager.getConnection(jdbcUrl);
}
}