-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathHCRootkit_Sutersu.java
More file actions
73 lines (61 loc) · 1.86 KB
/
HCRootkit_Sutersu.java
File metadata and controls
73 lines (61 loc) · 1.86 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
//@author Lacework Labs
//@category Analysis
//@keybinding
//@menupath
//@toolbar
import java.util.List;
import ghidra.app.script.GhidraScript;
import ghidra.program.model.address.Address;
import ghidra.program.model.listing.Function;
import ghidra.program.model.mem.MemoryBlock;
import ghidra.program.model.symbol.Symbol;
public class HCRootkit_Sutersu extends GhidraScript {
static String vermagic = "vermagic"; // modinfo
static String kthread = "kthread";
@Override
protected void run() throws Exception {
println("Kernel Magic: " + getKernelMagic());
println("ICMP_INIT: " + getEmbeddedIPv4());
getEmbeddedIPs();
}
/**
* @return string value of kernel magic or error
* @throws Exception when .modinfo not found
*/
String getKernelMagic() throws Exception{
try {
Address verMagicAddr = find(getMemoryBlock(".modinfo").getStart(), vermagic.getBytes());
return getDataAt(verMagicAddr).getValue().toString();
} catch (Exception e) {
return "[!] section \"modinfo\" not identified.";
}
}
/**
* @return Embedded IPs for HC_RK Rookit Sutersu variant
* @throws Exception
*/
String getEmbeddedIPv4() throws Exception {
try {
List<Symbol> symb = getSymbols("icmp_init", null);
Address icmpInitAddr = symb.get(0).getAddress();
return(icmpInitAddr.toString());
} catch (Exception e) {
return "[!] Error obtaining embedded IPs";
}
}
/**
* Identify IPs within Sutersu's .rodata.str1.1 data section
* @throws Exception
*/
void getEmbeddedIPs() throws Exception {
try {
Address endOfRoDataSec = getMemoryBlock(".rodata.str1.1").getEnd();
Address tmpAddr = getDataBefore(endOfRoDataSec).getAddress();
println("[IPv4]" + getDataBefore(endOfRoDataSec).getValue().toString());
println("[IPv4]" + getDataBefore(tmpAddr).getValue().toString());
} catch (Exception e) {
println("[!] Section not found");
}
}
}