All Projects → Gui774ume → ebpfkit-monitor

Gui774ume / ebpfkit-monitor

Licence: Apache-2.0 license
ebpfkit-monitor is a tool that detects and protects against eBPF powered rootkits

Programming Languages

c
50402 projects - #5 most used programming language
go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to ebpfkit-monitor

ebpfkit
ebpfkit is a rootkit powered by eBPF
Stars: ✭ 472 (+490%)
Mutual labels:  rootkit, linux-kernel, ebpf, linux-kernel-hacking, runtime-security
bpfbox
🐝 BPFBox 📦 Exploring process confinement in eBPF
Stars: ✭ 93 (+16.25%)
Mutual labels:  linux-kernel, ebpf, runtime-security
kernel new features
一个深挖 Linux 内核的新功能特性,以 io_uring, cgroup, ebpf, llvm 为代表,包含开源项目,代码案例,文章,视频,架构脑图等
Stars: ✭ 1,094 (+1267.5%)
Mutual labels:  linux-kernel, ebpf
Lowlevelprogramming University
How to be low-level programmer
Stars: ✭ 7,224 (+8930%)
Mutual labels:  linux-kernel, linux-kernel-hacking
Umbra
A LKM rootkit targeting 4.x and 5.x kernel versions which opens a backdoor that can spawn a reverse shell to a remote host, launch malware and more.
Stars: ✭ 98 (+22.5%)
Mutual labels:  rootkit, linux-kernel
lkm-sandbox
Collection of Linux Kernel Modules and PoC to discover, learn and practice Linux Kernel Development
Stars: ✭ 36 (-55%)
Mutual labels:  linux-kernel, linux-kernel-hacking
ipftrace
[Deplicated] Now we have more sophisticated (and compact) implementation in ipftrace2 repository. Please check it as well.
Stars: ✭ 60 (-25%)
Mutual labels:  linux-kernel, ebpf
portablebpf
You came here so you could have a base code to serve you as an example on how to develop a BPF application, compatible to BCC and/or LIBBPF, specially LIBBPF, having the userland part made in C or PYTHON.
Stars: ✭ 32 (-60%)
Mutual labels:  linux-kernel, ebpf
Polycube
eBPF/XDP-based software framework for fast network services running in the Linux kernel.
Stars: ✭ 217 (+171.25%)
Mutual labels:  linux-kernel, ebpf
satan
🔓 x86 Linux Kernel rootkit for Debian 9 (4.9.0-11-686-pae)
Stars: ✭ 31 (-61.25%)
Mutual labels:  rootkit, linux-kernel
Awesome Linux Rootkits
awesome-linux-rootkits
Stars: ✭ 583 (+628.75%)
Mutual labels:  rootkit, linux-kernel
Ebpf exporter
Prometheus exporter for custom eBPF metrics
Stars: ✭ 829 (+936.25%)
Mutual labels:  linux-kernel, ebpf
Ipftrace2
A packet oriented Linux kernel function call tracer
Stars: ✭ 193 (+141.25%)
Mutual labels:  linux-kernel, ebpf
Diamorphine
LKM rootkit for Linux Kernels 2.6.x/3.x/4.x/5.x (x86/x86_64 and ARM64)
Stars: ✭ 725 (+806.25%)
Mutual labels:  rootkit, linux-kernel
Sutekh
An example rootkit that gives a userland process root permissions
Stars: ✭ 62 (-22.5%)
Mutual labels:  rootkit, linux-kernel
rbbcc
BCC port for MRI - this is unofficial bonsai project.
Stars: ✭ 45 (-43.75%)
Mutual labels:  ebpf
kernel pendulum sdm845
Pendulum Kernel (old Rebirth) based on LE.UM.3.2.2.r1.1 CAF with google-common merged in for Xiaomi Poco F1 and Mi 8 with LTO, CFI and SCS enabled.
Stars: ✭ 9 (-88.75%)
Mutual labels:  linux-kernel
drop-tcp-sock
This module allows one to kill TCP sockets (including TIME-WAIT state).
Stars: ✭ 58 (-27.5%)
Mutual labels:  linux-kernel
Embedded-Linux-Education-Kit
Embedded Linux Education Kit
Stars: ✭ 66 (-17.5%)
Mutual labels:  linux-kernel
Simple-Antirootkit-SST-Unhooker
This is a demo project to illustrate the way to verify and restore original SST in case of some malware hooks
Stars: ✭ 31 (-61.25%)
Mutual labels:  rootkit

ebpfkit-monitor

License: GPL v2 License

ebpfkit-monitor is an utility that you can use to statically analyse eBPF bytecode or monitor suspicious eBPF activity at runtime. It was specifically designed to detect ebpfkit.

Disclaimer

This project is not an official Datadog product (experimental or otherwise), it is just code that happens to be developed by Datadog employees as part of an independent security research project. The rootkit herein is provided for educational purposes only and for those who are willing and curious to learn about ethical hacking, security and penetration testing with eBPF.

Do not attempt to use these tools to violate the law. The author is not responsible for any illegal action. Misuse of the provided information can result in criminal charges.

System requirements

  • golang 1.13+
  • This project was developed on a Ubuntu Focal machine (Linux Kernel 5.4)
  • Kernel headers are expected to be installed in lib/modules/$(uname -r) (see Makefile)
  • clang & llvm (11.0.1)
  • Graphviz (to generate graphs)
  • go-bindata (go get -u github.com/shuLhan/go-bindata/...)

Build

  1. To build ebpfkit-monitor, run:
# ~ make
  1. To install ebpfkit-monitor (copies ebpfkit-monitor to /usr/bin/ebpfkit-monitor) run:
# ~ make install

Getting started

Run ebpfkit-monitor -h to get help.

# ~ ebpfkit-monitor -h
Usage:
  ebpfkit-monitor [command]

Available Commands:
  graph       graph generates a graphviz representation of the ELF file
  help        Help about any command
  map         prints information about one or multiple maps
  prog        prints information about one or multiple programs
  report      prints summarized information about the maps and programs
  start       start monitoring the bpf syscall at runtime

Flags:
  -h, --help               help for ebpfkit-monitor
  -l, --log-level string   log level (options: panic, fatal, error, warn, info, debug or trace). Set to "debug" to see bpf events. (default "info")

Use "ebpfkit-monitor [command] --help" for more information about a command.

Examples

List all the program sections provided in the ELF file

# ~ ebpfkit-monitor prog --asset my_elf_file.o

Dump the bytecode of a program

# ~ ebpfkit-monitor prog --asset my_elf_file.o --section kprobe/my_program --dump

List all the programs that use the bpf_probe_write_user eBPF helper

# ~ ebpfkit-monitor prog --asset my_elf_file.o --helper BpfProbeWriteUser

List all the programs that interact with the "piped_progs" eBPF map

# ~ ebpfkit-monitor prog --asset my_elf_file.o --map piped_progs

List all the maps declared in the ELF file

# ~ ebpfkit-monitor map --asset my_elf_file.o

Monitor the bpf syscall and print events to the screen

# ~ sudo ebpfkit-monitor start --log-level debug

Monitor the bpf syscall and write the captured events in a file

# ~ sudo ebpfkit-monitor start --output /tmp

Monitor the bpf syscall, write the captured events in a file and ensure that only "bpftool" is allowed to use the "bpf" syscall

# ~ sudo ebpfkit-monitor start --output /tmp --allowed-processes "/usr/sbin/bpftool"

Generate a graph from the provided ELF file

# ~ ebpfkit-monitor graph -a my_elf_file.o
INFO[2021-08-03T13:19:12Z] Graph generated: /tmp/ebpfkit-monitor-graph-4104912074
# ~ fdp -Tsvg /tmp/ebpfkit-monitor-graph-4104912074 > ./graphs/output.svg

output.svg

Future work

  • Move the project to BTF & CO-RE
  • Use lsm eBPF programs instead of bpf_override_return for access control

License

  • The golang code is under Apache 2.0 License.
  • The eBPF programs are under the GPL v2 License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].