Crowdsec Hacker-Modus aktiviert: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| Zeile 67: | Zeile 67: | ||
- STRG + SHIFT + R drücken (Force Reload) | - STRG + SHIFT + R drücken (Force Reload) | ||
=Auf der controlplane Tests= | =Auf der controlplane Tests= | ||
| + | *cscli alerts list | ||
| + | <pre> | ||
| + | ╭────┬───────────────────┬──────────────────────────────────────────────────────────────┬─────────┬────┬───────────┬─────────────────────────────────────────╮ | ||
| + | │ ID │ value │ reason │ country │ as │ decisions │ created_at │ | ||
| + | ├────┼───────────────────┼──────────────────────────────────────────────────────────────┼─────────┼────┼───────────┼─────────────────────────────────────────┤ | ||
| + | │ 19 │ Ip:192.168.178.90 │ LePresidente/http-generic-403-bf │ │ │ captcha:1 │ 2025-04-07 10:49:52.793426307 +0000 UTC │ | ||
| + | │ 18 │ Ip:192.168.178.90 │ crowdsecurity/http-cve-2021-41773 │ │ │ captcha:1 │ 2025-04-07 10:49:52.553615326 +0000 UTC │ | ||
| + | │ 17 │ Ip:192.168.178.90 │ crowdsecurity/http-path-traversal-probing │ │ │ captcha:1 │ 2025-04-07 10:49:52.065041564 +0000 UTC │ | ||
| + | │ 16 │ Ip:192.168.178.90 │ crowdsecurity/http-admin-interface-probing │ │ │ captcha:1 │ 2025-04-07 10:49:51.726351563 +0000 UTC │ | ||
| + | │ 15 │ Ip:192.168.178.90 │ crowdsecurity/http-crawl-non_statics │ │ │ captcha:1 │ 2025-04-07 10:49:50.706075649 +0000 UTC │ | ||
| + | │ 14 │ Ip:192.168.178.90 │ crowdsecurity/http-bad-user-agent │ │ │ captcha:1 │ 2025-04-07 10:49:50.706071295 +0000 UTC │ | ||
| + | │ 13 │ Ip:192.168.178.90 │ crowdsecurity/http-xss-probbing │ │ │ captcha:1 │ 2025-04-07 10:47:26.783425774 +0000 UTC │ | ||
| + | │ 12 │ Ip:192.168.178.90 │ crowdsecurity/http-cve-2021-41773 │ │ │ captcha:1 │ 2025-04-07 10:47:26.228992152 +0000 UTC │ | ||
| + | │ 11 │ Ip:192.168.178.90 │ crowdsecurity/http-path-traversal-probing │ │ │ captcha:1 │ 2025-04-07 10:47:24.964628213 +0000 UTC │ | ||
| + | │ 10 │ Ip:192.168.178.90 │ crowdsecurity/http-admin-interface-probing │ │ │ captcha:1 │ 2025-04-07 10:47:24.135101291 +0000 UTC │ | ||
| + | │ 9 │ Ip:192.168.178.90 │ crowdsecurity/http-crawl-non_statics │ │ │ captcha:1 │ 2025-04-07 10:47:22.359760401 +0000 UTC │ | ||
| + | │ 8 │ Ip:192.168.178.90 │ crowdsecurity/http-sensitive-files │ │ │ captcha:1 │ 2025-04-07 10:47:22.545143901 +0000 UTC │ | ||
| + | │ 7 │ Ip:192.168.178.90 │ crowdsecurity/http-probing │ │ │ captcha:1 │ 2025-04-07 10:47:22.545076598 +0000 UTC │ | ||
| + | │ 6 │ Ip:192.168.178.90 │ crowdsecurity/http-bad-user-agent │ │ │ captcha:1 │ 2025-04-07 10:47:22.359766995 +0000 UTC │ | ||
| + | │ 4 │ Ip:192.168.178.90 │ crowdsecurity/ssh-slow-bf │ │ │ ban:1 │ 2025-04-07 10:10:36.680739028 +0000 UTC │ | ||
| + | │ 3 │ Ip:192.168.178.90 │ crowdsecurity/ssh-bf │ │ │ ban:1 │ 2025-04-07 10:10:36.680724079 +0000 UTC │ | ||
| + | │ 2 │ Ip:1.2.3.4 │ manual 'ban' from │ │ │ ban:1 │ 2025-04-07 09:33:23 +0000 UTC │ | ||
| + | │ │ │ 'a736abd11f52406db0e02d7a3877059b33AmC8XqkH1c9aCq' │ │ │ │ │ | ||
| + | ╰────┴───────────────────┴──────────────────────────────────────────────────────────────┴─────────┴────┴───────────┴─────────────────────────────────────────╯ | ||
| + | </pre> | ||
| + | |||
*cscli decisions list | *cscli decisions list | ||
<pre> | <pre> | ||
Version vom 7. April 2025, 11:08 Uhr
Angriffssimulation im Labor
Vorbereitung: Logbeobachtung aktivieren
- tail -f /var/log/crowdsec.log
Verbindung zum Angreifer herstellen
- ssh attacker
Notwendige Werkzeuge installieren (auf attacker)
- apt install -y nikto hydra
SSH-Angriff testen
Brute-Force-Angriff starten (auf attacker)
- hydra -l admin -x 1:1:a controlplane ssh
Logausgabe beobachten
Im ursprünglichen Terminal:
- tail -f /var/log/crowdsec.log
Aktive Entscheidungen anzeigen
- cscli decisions list
Vorbereitung für nächsten Test: Entscheidungen löschen
SSH-Entscheidungen zurücksetzen
- cscli decisions delete --scenario crowdsecurity/ssh-bf
- cscli decisions delete --scenario crowdsecurity/ssh-slow-bf
- tail -f /var/log/crowdsec.log
Web-Angriff mit nikto
NGINX-Access-Log zur Analyse einbinden
Die Datei /var/log/nginx/access.log muss in der Acquisition-Konfiguration aufgenommen werden, damit HTTP-Angriffe erkannt werden können.
acquis.yaml erweitern
- echo "
filename: /var/log/nginx/access.log labels: type: nginx " >> /etc/crowdsec/acquis.yaml
HTTP-Szenarien und Parser installieren
- cscli collections install crowdsecurity/nginx
CrowdSec neu starten
- systemctl restart crowdsec
Kontrolle: HTTP-Szenarien geladen
- cscli scenarios list | grep http
Erwartete Einträge: - crowdsecurity/http-probing - crowdsecurity/http-crawl-non-browser - crowdsecurity/generic-bad-user-agent
Nikto-Scan starten (auf attacker)
- nikto -h http://controlplane
Ergebnis prüfen
- apt install w3m
Im Browser auf attacker:
Hinweis: NGINX zeigt noch Standardseite
Durch die Verwendung des Stream-Modus im Bouncer wird die neue Entscheidung nur alle 10 Sekunden aktualisiert. Um die blockierte Seite zu sehen: - Browser öffnen - STRG + SHIFT + R drücken (Force Reload)
Auf der controlplane Tests
- cscli alerts list
╭────┬───────────────────┬──────────────────────────────────────────────────────────────┬─────────┬────┬───────────┬─────────────────────────────────────────╮ │ ID │ value │ reason │ country │ as │ decisions │ created_at │ ├────┼───────────────────┼──────────────────────────────────────────────────────────────┼─────────┼────┼───────────┼─────────────────────────────────────────┤ │ 19 │ Ip:192.168.178.90 │ LePresidente/http-generic-403-bf │ │ │ captcha:1 │ 2025-04-07 10:49:52.793426307 +0000 UTC │ │ 18 │ Ip:192.168.178.90 │ crowdsecurity/http-cve-2021-41773 │ │ │ captcha:1 │ 2025-04-07 10:49:52.553615326 +0000 UTC │ │ 17 │ Ip:192.168.178.90 │ crowdsecurity/http-path-traversal-probing │ │ │ captcha:1 │ 2025-04-07 10:49:52.065041564 +0000 UTC │ │ 16 │ Ip:192.168.178.90 │ crowdsecurity/http-admin-interface-probing │ │ │ captcha:1 │ 2025-04-07 10:49:51.726351563 +0000 UTC │ │ 15 │ Ip:192.168.178.90 │ crowdsecurity/http-crawl-non_statics │ │ │ captcha:1 │ 2025-04-07 10:49:50.706075649 +0000 UTC │ │ 14 │ Ip:192.168.178.90 │ crowdsecurity/http-bad-user-agent │ │ │ captcha:1 │ 2025-04-07 10:49:50.706071295 +0000 UTC │ │ 13 │ Ip:192.168.178.90 │ crowdsecurity/http-xss-probbing │ │ │ captcha:1 │ 2025-04-07 10:47:26.783425774 +0000 UTC │ │ 12 │ Ip:192.168.178.90 │ crowdsecurity/http-cve-2021-41773 │ │ │ captcha:1 │ 2025-04-07 10:47:26.228992152 +0000 UTC │ │ 11 │ Ip:192.168.178.90 │ crowdsecurity/http-path-traversal-probing │ │ │ captcha:1 │ 2025-04-07 10:47:24.964628213 +0000 UTC │ │ 10 │ Ip:192.168.178.90 │ crowdsecurity/http-admin-interface-probing │ │ │ captcha:1 │ 2025-04-07 10:47:24.135101291 +0000 UTC │ │ 9 │ Ip:192.168.178.90 │ crowdsecurity/http-crawl-non_statics │ │ │ captcha:1 │ 2025-04-07 10:47:22.359760401 +0000 UTC │ │ 8 │ Ip:192.168.178.90 │ crowdsecurity/http-sensitive-files │ │ │ captcha:1 │ 2025-04-07 10:47:22.545143901 +0000 UTC │ │ 7 │ Ip:192.168.178.90 │ crowdsecurity/http-probing │ │ │ captcha:1 │ 2025-04-07 10:47:22.545076598 +0000 UTC │ │ 6 │ Ip:192.168.178.90 │ crowdsecurity/http-bad-user-agent │ │ │ captcha:1 │ 2025-04-07 10:47:22.359766995 +0000 UTC │ │ 4 │ Ip:192.168.178.90 │ crowdsecurity/ssh-slow-bf │ │ │ ban:1 │ 2025-04-07 10:10:36.680739028 +0000 UTC │ │ 3 │ Ip:192.168.178.90 │ crowdsecurity/ssh-bf │ │ │ ban:1 │ 2025-04-07 10:10:36.680724079 +0000 UTC │ │ 2 │ Ip:1.2.3.4 │ manual 'ban' from │ │ │ ban:1 │ 2025-04-07 09:33:23 +0000 UTC │ │ │ │ 'a736abd11f52406db0e02d7a3877059b33AmC8XqkH1c9aCq' │ │ │ │ │ ╰────┴───────────────────┴──────────────────────────────────────────────────────────────┴─────────┴────┴───────────┴─────────────────────────────────────────╯
- cscli decisions list
╭───────┬──────────┬───────────────────┬──────────────────────────────────┬─────────┬─────────┬────┬────────┬────────────┬──────────╮ │ ID │ Source │ Scope:Value │ Reason │ Action │ Country │ AS │ Events │ expiration │ Alert ID │ ├───────┼──────────┼───────────────────┼──────────────────────────────────┼─────────┼─────────┼────┼────────┼────────────┼──────────┤ │ 74578 │ crowdsec │ Ip:192.168.178.90 │ LePresidente/http-generic-403-bf │ captcha │ │ │ 6 │ 3h43m39s │ 19 │ ╰───────┴──────────┴───────────────────┴──────────────────────────────────┴─────────┴─────────┴────┴────────┴────────────┴──────────╯ 13 duplicated entries skipped
