
By Kprobe technology Open Source Host-based Intrusion Detection System(HIDS), from E_Bwill.
--The name of this project was inspired by the movie - The Matrix
English | 简体中文
Technically, AgentSmith-HIDS is not a Host-based Intrusion Detection System (HIDS) due to lack of rule engine and detection function. However, it can be used as a high performance 'Host Information Collect Agent' as part of your own HIDS solution. The comprehensiveness of information which can be collected by this agent was one of the most important metrics during developing this project, hence it was built to function in the kernel stack and achieve huge advantage comparing to those function in user stack, such as:
| Source | Nodename |
|---|---|
| Host | hostname |
| Docker | container name |
| k8s | pod name |
Achieved by hooking sys_execve()/sys_execveat()/compat_sys_execve()/compat_sys_execveat(), example:
{
"uid":"0",
"data_type":"59",
"run_path":"/tmp",
"exe":"/opt/ltp/testcases/bin/growfiles",
"argv":"growfiles -W gf26 -D 0 -b -i 0 -L 60 -u -B 1000b -e 1 -r 128-32768:128 -R 512-64000 -T 4 -f gfsmallio-35861 -d /tmp/ltp-Ujxl8kKsKY ",
"pid":"35861",
"ppid":"35711",
"pgid":"35861",
"tgid":"35861",
"comm":"growfiles",
"nodename":"test",
"stdin":"/dev/pts/1",
"stdout":"/dev/pts/1",
"sessionid":"3",
"sip":"192.168.165.1",
"sport":"61726",
"dip":"192.168.165.128",
"dport":"22",
"sa_family":"1",
"pid_tree":"1(systemd)->1384(sshd)->2175(sshd)->2177(bash)->2193(fish)->35552(runltp)->35711(ltp-pan)->35861(growfiles)",
"tty_name":"pts1",
"socket_process_pid":"2175",
"socket_process_exe":"/usr/sbin/sshd",
"SSH_CONNECTION":"192.168.165.1 61726 192.168.165.128 22",
"LD_PRELOAD":"/root/ldpreload/test.so",
"user":"root",
"time":"1579575429143",
"local_ip":"192.168.165.128",
"hostname":"test",
"exe_md5":"01272152d4901fd3c2efacab5c0e38e5",
"socket_process_exe_md5":"686cd72b4339da33bfb6fe8fb94a301f"
}
Achieved by hooking sys_bind(), example:
{
"uid":"0",
"data_type":"49",
"sa_family":"2",
"exe":"/usr/bin/python2.7",
"pid":"109640",
"ppid":"215496",
"pgid":"109640",
"tgid":"109640",
"comm":"python",
"nodename":"n225-117-018",
"sip":"0.0.0.0",
"sport":"8000",
"res":"0",
"sessionid":"30",
"user":"root",
"time":"1587540231936",
"local_ip_str":"10.225.117.18",
"hostname_str":"n225-117-018",
"exe_md5":"4f458165a2129ba549f1b6605ee87e74"
}
Achieved by hooking tcp_v4_connect()/tcp_v6_connect()/ip4_datagram_connect()/ip6_datagram_connect(), example:
{
"uid":"0",
"data_type":"42",
"sa_family":"2",
"connect_type":"4",
"dport":"1025",
"dip":"180.101.49.11",
"exe":"/usr/bin/ping",
"pid":"6294",
"ppid":"1941",
"pgid":"6294",
"tgid":"6294",
"comm":"ping",
"nodename":"test",
"sip":"192.168.165.153",
"sport":"45524",
"res":"0",
"sessionid":"1",
"user":"root",
"time":"1575721921240",
"local_ip":"192.168.165.153",
"hostname":"test",
"exe_md5":"735ae70b4ceb8707acc40bc5a3d06e04"
}
Achieved by hooking udp_recvmsg()/udpv6_recvmsg(), example:
{
"uid":"0",
"data_type":"601",
"sa_family":"2",
"dport":"53",
"dip":"192.168.165.2",
"exe":"/usr/bin/ping",
"pid":"6294",
"ppid":"1941",
"pgid":"6294",
"tgid":"6294",
"comm":"ping",
"nodename":"test",
"sip":"192.168.165.153",
"sport":"53178",
"qr":"1",
"opcode":"0",
"rcode":"0",
"query":"www.baidu.com",
"sessionid":"1",
"user":"root",
"time":"1575721921240",
"local_ip":"192.168.165.153",
"hostname":"test",
"exe_md5":"39c45487a85e26ce5755a893f7e88293"
}
Achieved by hooking security_inode_create(), example: