Falco 防御绕过尝试
Falco 快速安装
Falco | falcosecurity/falco: Cloud Native Runtime Security (github.com)
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
| - https://falco.org/docs/getting-started/try-falco/try-falco-on-ubuntu/
curl -fsSL https://falco.org/repo/falcosecurity-packages.asc | \ sudo gpg --dearmor -o /usr/share/keyrings/falco-archive-keyring.gpg sudo cat >/etc/apt/sources.list.d/falcosecurity.list <<EOF deb [signed-by=/usr/share/keyrings/falco-archive-keyring.gpg] https://download.falco.org/packages/deb stable main EOF sudo apt-get update -y
sudo apt-get install -y dkms make linux-headers-$(uname -r) sudo apt-get install -y dialog
sudo apt-get install -y falco
sudo systemctl status falco
sudo cat /etc/shadow > /dev/null
sudo journalctl _COMM=falco -p warning
sudo grep falco /var/log/syslog
|
Falco 配置文件
/etc/falco/falco.yaml1 2 3 4 5 6 7
|
file_output: enabled: true keep_alive: false filename: /var/log/events.txt
|
Falco 相关环境测试
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
| /usr/bin/falco /usr/bin/falcoctl /usr/bin/falco-driver-loader /etc/systemd/system/falco.service /etc/falco/falco.yaml /dev/falco0
systemctl list-units | grep falco systemctl status falco ls -l /usr/lib/systemd/system/falco* > falco-bpf.service > falcoctl-artifact-follow.service > falco-custom.service > falco-kmod-inject.service > falco-kmod.service > falco-modern-bpf.service
apt show falco > Package: falco > Version: 0.35.1
ps aux | grep falco sudo kill -9 PID
systemctl stop falco - 备注:需要 root 权限 - 关闭后不记录日志,服务重新时会产生一条重启日志
创建一个系统服务,不会告警 sudo nano /lib/systemd/system/shellscript.service [Unit] Description=My Shell Script [Service] ExecStart=/usr/bin/script.sh [Install] WantedBy=multi-user.target
sudo systemctl daemon-reload sudo systemctl enable shellscript.service sudo systemctl start shellscript.service
Create files below dev DB program spawned process Mkdir binary dirs Modify binary dirs Modify Shell Configuration File Non sudo setuid Read sensitive file trusted after startup Read sensitive file untrusted Run shell untrusted System procs network activity System user interactive Write below binary dir Write below etc Write below monitored dir Write below rpm database
|
Falcosidekick 快速安装
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
| https://falco.org/docs/getting-started/try-falco/try-falcosidekick-on-ubuntu/
sudo apt install -y docker.io
sudo docker run --detach --rm --network=host \ --name redis docker.io/redis/redis-stack-server:latest
sudo docker run --detach --rm --network=host \ --env WEBUI_URL=http://localhost:2802 \ --name falcosidekick falcosecurity/falcosidekick:2.27.0
sudo docker logs falcosidekick 2023/07/16 09:13:01 [INFO] : Falco Sidekick version: 2.27.0 2023/07/16 09:13:01 [INFO] : Enabled Outputs : [WebUI] 2023/07/16 09:13:01 [INFO] : Falco Sidekick is up and listening on :2801
sudo docker run --detach --rm --network=host \ --name falcosidekick-ui falcosecurity/falcosidekick-ui
sudo docker logs falcosidekick-ui 2023/07/16 09:17:15 [WARN] : Index does not exist 2023/07/16 09:17:15 [WARN] : Create Index 2023/07/16 09:17:15 [INFO] : Falcosidekick UI is listening on 0.0.0.0:2802 2023/07/16 09:17:15 [INFO] : log level is info
sudo docker ps 6bf43d19fe7e falcosecurity/falcosidekick-ui bcc7aa743beb falcosecurity/falcosidekick:2.27.0 0dacd307fd91 redis/redis-stack-server:latest
... json_output: true http_output: enabled: true url: http://localhost:2801 ...
sudo systemctl restart falco
sudo cat /etc/shadow > /dev/null
http://localhost:2802/dashboard
sudo docker run -it --rm falcosecurity/event-generator \ run syscall --loop
|
UI 界面
默认配置:http://192.168.x.x:2802/ admin admin
规则
日志