TLS: Reaktionen auf den ALPACA Attackvector

Vor ein paar Tagen wurde eine Cross-Protokoll-Attacke mit TLS bekannt, bei der auch bekannte OpenSource-Dienste wie Exim, Dovecot, Proftpd, Courier, Sendmail usw. usw. als „Bande“ beteiligt sind.

TLS: Reaktionen auf den ALPACA Attackvector

Wer die Attacke verstehen möchte, oder ganz genau hinsehen will, findet hier alles nötige: https://alpaca-attack.com/

Alle, die sich mit einem kleinen Beispiel begnügen können, hier ein Beispiel wie die Attacke ablaufen soll:

Angreifer baut eine Webseite.
Opfer besucht Webseite.
Angreifer erzeugt einen AJAX Request zu einer Opfer-Domain
Angreifer fügt einen oder mehrere spezielle Headerzeilen in den AJAX hinzu
Opferbrowser sendet Ajax an Zielserver
Angreifer lenkt ( als Man-in-the-Middle-Angriff ) Datenpaket auf einen anderen Dienst mit dem gleichen TLS-Zertifikat um
Dienst nimmt den HTTP Request zeilenweise an
Dienst reagiert auf die speziellen Headerzeilen

Was dann passiert hängt vom Dienst ab, der als Bande missbraucht wurde. Es sind Reflectionattacks möglich, bei dem dem Browser des Opfers über den Dienst als Bande z.b. Javascript untergejubelt werden soll, oder es in sehr speziellen Fällen Zugriffe auf den zweiten Dienst gibt ( zb. wenn die Benutzervalidierung nach IP und TLS-Cert geht ).

Das sieht dann in etwa so aus:

# nc testserver 25
220 testserver.de ESMTP Exim 4.94.2 Fri, 11 Jun 2021 09:45:34 +0200
GET / HTTP/1.1
500 unrecognized command
Host: target.domain
500 unrecognized command
HELO opfer.server
250 testserver.de Hello opfer.server [x.x.x.x]
MAIL FROM: <script>Alert()</script>
501-<script>Alert()</script>: malformed address: Alert()</script> may not follow <script>
501 Too many syntax or protocol errors

Um die markierte Zeile geht es meistens, denn wenn der Browser das Ergebnis jetzt im Context der Webseite anzeigt, dann wird das ungefilterte Javascript ausgeführt.

Bitte habt ihm Hinterkopf, das dies hier nur ein simplifiziertes Beispiel ist, um sich den Vorgang vorzustellen. In der Realität ist der Angriff ungleich komplexer, weil der Browser mitspielen muß, es einen Man-in-the-Middle-Angriff geben muß, es möglich sein muß, die Antwort im Context einer Webseite auszuführen, die nicht unter Kontrolle des Angreifer steht usw. usw. Trivial geht anders!

OpenSource-Dienste reagieren

Obwohl Dovecot als POP3/IMAP Server eigentlich gar nicht betroffen ist, hat das Dovecot Security Team um Timo Sirainen gestern bereits reagiert und angekündigt, die Fehlertoleranzgrenze zu erniedrigen und beim Vorfinden eines HTTP Headers sofort die Verbindung zu terminieren.

Auf der Eximmailingliste fand gestern eine ähnliche Diskussion statt, nur das Exim bereits lange über eine Runtime-Konfigurationsoption verfügt, die jeder Serveradmin jetzt einsetzen sollte:

smtp_max_synprot_errors = 0

In weniger als 18h kamen auf einem System ohne relevanten Mailverkehr folgende HTTP-Anfragen auf dem Mailserver zusammen:

2021-06-10 17:09:54 SMTP call from [134.122.7.20] dropped: too many syntax or protocol errors (last command was „HEAD / HTTP/1.0“, NULL)
2021-06-10 17:09:55 SMTP call from [134.122.7.20] dropped: too many syntax or protocol errors (last command was „GET /system_api.php HTTP/1.1“, NULL)
2021-06-10 17:09:56 SMTP call from [134.122.7.20] dropped: too many syntax or protocol errors (last command was „GET /c/version.js HTTP/1.1“, NULL)
2021-06-10 17:09:58 SMTP call from [134.122.7.20] dropped: too many syntax or protocol errors (last command was „GET /streaming/clients_live.php HTTP/1.1“, NULL)
2021-06-10 17:09:59 SMTP call from [134.122.7.20] dropped: too many syntax or protocol errors (last command was „GET /stalker_portal/c/version.js HTTP/1.1“, NULL)
2021-06-10 17:10:01 SMTP call from [134.122.7.20] dropped: too many syntax or protocol errors (last command was „GET /stream/live.php HTTP/1.1“, NULL)
2021-06-10 17:17:30 SMTP call from [138.197.154.233] dropped: too many syntax or protocol errors (last command was „HEAD / HTTP/1.0“, NULL)
2021-06-10 17:17:31 SMTP call from [138.197.154.233] dropped: too many syntax or protocol errors (last command was „GET /system_api.php HTTP/1.1“, NULL)
2021-06-10 17:17:32 SMTP call from [138.197.154.233] dropped: too many syntax or protocol errors (last command was „GET /system_api.php HTTP/1.1“, NULL)
2021-06-10 17:17:34 SMTP call from [138.197.154.233] dropped: too many syntax or protocol errors (last command was „GET /c/version.js HTTP/1.1“, NULL)
2021-06-10 17:17:35 SMTP call from [138.197.154.233] dropped: too many syntax or protocol errors (last command was „GET /streaming/clients_live.php HTTP/1.1“, NULL)
2021-06-10 17:17:37 SMTP call from [138.197.154.233] dropped: too many syntax or protocol errors (last command was „GET /stalker_portal/c/version.js HTTP/1.1“, NULL)
2021-06-10 17:17:39 SMTP call from [138.197.154.233] dropped: too many syntax or protocol errors (last command was „GET /client_area/ HTTP/1.1“, NULL)
2021-06-10 17:17:40 SMTP call from [138.197.154.233] dropped: too many syntax or protocol errors (last command was „GET /stalker_portal/c/ HTTP/1.1“, NULL)
2021-06-10 17:17:42 SMTP call from [138.197.154.233] dropped: too many syntax or protocol errors (last command was „GET /stream/live.php HTTP/1.1“, NULL)
2021-06-10 19:08:50 SMTP call from [46.101.86.104] dropped: too many syntax or protocol errors (last command was „HEAD / HTTP/1.0“, NULL)
2021-06-10 19:08:51 SMTP call from [46.101.86.104] dropped: too many syntax or protocol errors (last command was „GET /system_api.php HTTP/1.1“, NULL)
2021-06-10 19:08:51 SMTP call from [46.101.86.104] dropped: too many syntax or protocol errors (last command was „GET /system_api.php HTTP/1.1“, NULL)
2021-06-10 19:08:51 SMTP call from [46.101.86.104] dropped: too many syntax or protocol errors (last command was „GET /c/version.js HTTP/1.1“, NULL)
2021-06-10 19:08:52 SMTP call from [46.101.86.104] dropped: too many syntax or protocol errors (last command was „GET /streaming/clients_live.php HTTP/1.1“, NULL)
2021-06-10 19:08:52 SMTP call from [46.101.86.104] dropped: too many syntax or protocol errors (last command was „GET /stalker_portal/c/version.js HTTP/1.1“, NULL)
2021-06-10 19:08:53 SMTP call from [46.101.86.104] dropped: too many syntax or protocol errors (last command was „GET /client_area/ HTTP/1.1“, NULL)
2021-06-10 19:08:53 SMTP call from [46.101.86.104] dropped: too many syntax or protocol errors (last command was „GET /stalker_portal/c/ HTTP/1.1“, NULL)
2021-06-10 19:08:53 SMTP call from [46.101.86.104] dropped: too many syntax or protocol errors (last command was „GET /stream/live.php HTTP/1.1“, NULL)
2021-06-10 19:54:12 SMTP call from [134.122.5.182] dropped: too many syntax or protocol errors (last command was „HEAD / HTTP/1.0“, NULL)
2021-06-10 19:54:13 SMTP call from [134.122.5.182] dropped: too many syntax or protocol errors (last command was „GET /system_api.php HTTP/1.1“, NULL)
2021-06-10 19:54:14 SMTP call from [134.122.5.182] dropped: too many syntax or protocol errors (last command was „GET /c/version.js HTTP/1.1“, NULL)
2021-06-10 19:54:15 SMTP call from [134.122.5.182] dropped: too many syntax or protocol errors (last command was „GET /streaming/clients_live.php HTTP/1.1“, NULL)
2021-06-10 19:54:17 SMTP call from [134.122.5.182] dropped: too many syntax or protocol errors (last command was „GET /stalker_portal/c/version.js HTTP/1.1“, NULL)
2021-06-10 19:54:18 SMTP call from [134.122.5.182] dropped: too many syntax or protocol errors (last command was „GET /stream/live.php HTTP/1.1“, NULL)
2021-06-10 20:21:18 SMTP call from [64.225.63.33] dropped: too many syntax or protocol errors (last command was „HEAD / HTTP/1.0“, NULL)
2021-06-10 20:21:19 SMTP call from [64.225.63.33] dropped: too many syntax or protocol errors (last command was „GET /system_api.php HTTP/1.1“, NULL)
2021-06-10 20:21:20 SMTP call from [64.225.63.33] dropped: too many syntax or protocol errors (last command was „GET /c/version.js HTTP/1.1“, NULL)
2021-06-10 20:21:21 SMTP call from [64.225.63.33] dropped: too many syntax or protocol errors (last command was „GET /streaming/clients_live.php HTTP/1.1“, NULL)
2021-06-10 20:21:23 SMTP call from [64.225.63.33] dropped: too many syntax or protocol errors (last command was „GET /stalker_portal/c/version.js HTTP/1.1“, NULL)
2021-06-10 20:21:24 SMTP call from [64.225.63.33] dropped: too many syntax or protocol errors (last command was „GET /stream/live.php HTTP/1.1“, NULL)
2021-06-11 02:27:28 SMTP call from [192.241.214.95] dropped: too many syntax or protocol errors (last command was „GET / HTTP/1.1“, NULL)
2021-06-11 02:27:30 SMTP call from [192.241.214.95] dropped: too many syntax or protocol errors (last command was „GET / HTTP/1.1“, NULL)
2021-06-11 02:27:30 SMTP call from [192.241.214.95] dropped: too many syntax or protocol errors (last command was „GET / HTTP/1.1“, NULL)
2021-06-11 02:27:30 SMTP call from [192.241.214.95] dropped: too many syntax or protocol errors (last command was „GET / HTTP/1.1“, NULL)
2021-06-11 04:46:17 SMTP call from 92.118.160.1.netsystemsresearch.com [92.118.160.1] dropped: too many syntax or protocol errors (last command was „GET / HTTP/1.1“, NULL)
2021-06-11 08:34:31 SMTP call from scanner-21.ch1.censys-scanner.com [162.142.125.128] dropped: too many syntax or protocol errors (last command was „GET / HTTP/1.1“, NULL)
2021-06-11 08:34:36 SMTP call from scanner-21.ch1.censys-scanner.com [162.142.125.128] dropped: too many syntax or protocol errors (last command was „GET / HTTP/1.1“, NULL)
2021-06-11 08:34:49 SMTP call from scanner-21.ch1.censys-scanner.com [162.142.125.128] dropped: too many syntax or protocol errors (last command was „GET / HTTP/1.1“, NULL)
2021-06-11 08:34:50 SMTP call from scanner-21.ch1.censys-scanner.com [162.142.125.128] dropped: too many syntax or protocol errors (last command was „GET / HTTP/1.1“, NULL)
2021-06-11 08:47:19 SMTP call from [45.113.70.146] dropped: too many syntax or protocol errors (last command was „GET / HTTP/1.1“, NULL)

Dies sind noch keine ALPACA Angriffe, das ist nur der alltägliche Wahnsinn mit dem man sich als Server so rumschlagen muß.

Proftpd hat bereits vorher reagiert und ist ab Version ProFTPD ≥1.3.5e stärker gegen den Angriff abgehärtet, aber noch nicht 100% immun.

Chromium und Firefox werden Ihre Browser auch abhärten, so daß es schwieriger wird, per Ajax andere Dienste zu kontaktieren. Da aber viele Firmenserver HTTP Dienste auf nicht Standardports anbieten , könnte das im Detail schwierig werden.

Verbesserungsvorschläge zur Absicherung von hauseigenen Pakete für Exim, Dovecot und Co. liegen bei Fedora/Red Hat bereits vor, müssen aber noch diskuttiert werden.

UPDATE

Wer sich die ALPACA Exploits mal ansehen will, bitte schön: https://github.com/RUB-NDS/alpaca-code/tree/master/exploits

Linux am Dienstag: Programm für den 15.6.

Ich wußte ja, früher geht immer, aber diesmal .. wow 😀 Von mir jetzt schon einmal einen recht herzlichen Dank an alle, die nächsten Dienstag Vorträge halten werden.

Linux am Dienstag: Programm für den 15.6.

Und dabei ist das nur ein Ausschnitt des Programms, wir haben noch mehr in Petto 😀

u.a. im Programm am 15.6., ab 19 Uhr:

  • Firefox 89 – Layoutupdate doch nicht so tragisch?
  • Blender Einführung – Teil 2/6 – Wir modellieren: Einen Baum
  • OpenSuse – Schwere Fehler nach Update von Leap 15.3
  • DNF – Wie man es benutzt
  • Backups mit ZFS – Teil 1/2: Einführung in ZFS
  • 30 Jahre PGP – Glückwünsche an Phil Zimmermann
  • 8.4 Milliarden – Passwort Leak 2021
  • Linux Foundation – Das Covid-Zertifikate-Netzwerk
  • Bitcoin – erstes Land erklärt Bitcoin zum Zahlungsmittel

Wie immer jeden Dienstag, ab 19 Uhr auf https://meet.cloud-foo.de/Linux .

Wine: Appcrashe führen zu Datenverlusten

Wine 6.9-1 für Fedora hat hier im exessiven Test zu Datenverlusten auf der Festplatte geführt, einer war so schwer, daß das System nur durch Zufall gerettet werden konnte.

Wine: Appcrashe führen zu Datenverlusten

Eigentlich wollte ich Euch ja die gute Nachricht mitteilen, daß einige Spiele, die eine Weile nicht mehr funktioniert haben, jetzt wieder laufen so z.B. Runes of Magic. Leider gab es schwere Kernel-Crashe mit Wine 6.9 wenn Runes of Magic lief, was zu mehreren Datenverlusten führte. Der jüngste Crash zerstörte Daten in der librpmio.so die von RPM benötigt wird und ohne die, kann man sein System weder updaten noch durch Reinstall retten. Da hier SSH noch lief, konnte die defekte Lib von einem anderen Fedora System kopiert werden, was den Fehler dann behoben hat.

Hier ein Beispiel:

Jun 6 14:23:58 eve kernel: general protection fault, probably for non-canonical address 0xdfff920ad662d0c8: 0000 [#1] SMP NOPTI
Jun 6 14:23:58 eve kernel: CPU: 1 PID: 12432 Comm: Client.exe Tainted: P OE 5.12.8-200.fc33.x86_64 #1
Jun 6 14:23:58 eve kernel: Hardware name: To be filled by O.E.M. To be filled by O.E.M./M5A97 R2.0, BIOS 2201 12/10/2013
Jun 6 14:23:58 eve kernel: RIP: 0010:__vma_unlink_list+0x1b/0x30
Jun 6 14:23:58 eve kernel: Code: 70 18 c3 48 8b 07 48 89 37 eb ea 0f 1f 40 00 0f 1f 44 00 00 48 8b 56 18 48 8b 46 10 48 85 d2 74 0e 48 89 42 10 48 85 c0 74 04 <48> 89 50 18 c3 48 89 07 eb f1 66 66 2e 0f 1f 84 00 00 00 00 00 0f
Jun 6 14:23:58 eve kernel: RSP: 0018:ffff9dff070b3ce0 EFLAGS: 00010282
Jun 6 14:23:58 eve kernel: RAX: dfff920ad662d0c8 RBX: 0000000000000000 RCX: 0000000000000000
Jun 6 14:23:58 eve kernel: RDX: ffff920aeb7a30c8 RSI: ffff920ad673e320 RDI: ffff920ac0a450c0
Jun 6 14:23:58 eve kernel: RBP: ffff920ad673e320 R08: ffff920ac0a450c8 R09: 0000000010099000
Jun 6 14:23:58 eve kernel: R10: 0000000000100000 R11: 0000000000000000 R12: ffff920aeb7a30c8
Jun 6 14:23:58 eve kernel: R13: 0000000000000000 R14: ffff920ac0a450c0 R15: 0000000000200070
Jun 6 14:23:58 eve kernel: FS: 00000000003e2000(0063) GS:ffff920deec40000(006b) knlGS:00000000f7fc7880
Jun 6 14:23:58 eve kernel: CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033
Jun 6 14:23:58 eve kernel: CR2: 0000000025c7a004 CR3: 00000000264a0000 CR4: 00000000000406e0
Jun 6 14:23:58 eve kernel: Call Trace:
Jun 6 14:23:58 eve kernel: __vma_adjust+0x283/0xbf0
Jun 6 14:23:58 eve kernel: vma_merge+0x370/0x3c0
Jun 6 14:23:58 eve kernel: ? __do_munmap+0x319/0x510
Jun 6 14:23:58 eve kernel: mmap_region+0x171/0x720
Jun 6 14:23:58 eve kernel: do_mmap+0x433/0x540
Jun 6 14:23:58 eve kernel: ? security_mmap_file+0x81/0xd0
Jun 6 14:23:58 eve kernel: vm_mmap_pgoff+0xb8/0x160
Jun 6 14:23:58 eve kernel: ? __set_current_blocked+0x36/0x50
Jun 6 14:23:58 eve kernel: __do_fast_syscall_32+0x5c/0x90
Jun 6 14:23:58 eve kernel: do_fast_syscall_32+0x2f/0x70
Jun 6 14:23:58 eve kernel: entry_SYSCALL_compat_after_hwframe+0x45/0x4d
Jun 6 14:23:58 eve kernel: RIP: 0023:0xf7fcc559
Jun 6 14:23:58 eve kernel: Code: 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 51 52 55 89 cd 0f 05 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00
Jun 6 14:23:58 eve kernel: RSP: 002b:0000000000c4d200 EFLAGS: 00000256 ORIG_RAX: 00000000000000c0
Jun 6 14:23:58 eve kernel: RAX: ffffffffffffffda RBX: 000000001ae90000 RCX: 000000000000e000
Jun 6 14:23:58 eve kernel: RDX: 0000000000000000 RSI: 0000000000004032 RDI: 00000000ffffffff
Jun 6 14:23:58 eve kernel: RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
Jun 6 14:23:58 eve kernel: R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
Jun 6 14:23:58 eve kernel: R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
Jun 6 14:23:58 eve kernel: Modules linked in: xt_multiport twofish_generic twofish_avx_x86_64 twofish_x86_64_3way twofish_x86_64 twofish_common xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_reject_ipv4 ip6table_mangle ip6table_nat iptable_mangle iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter tun bridge stp llc vboxnetadp(OE) vboxnetflt(OE) vboxdrv(OE) it87 hwmon_vid nvidia_drm(POE) nvidia_modeset(POE) nvidia_uvm(POE) uvcvideo videobuf2_vmalloc videobuf2_memops snd_usb_audio videobuf2_v4l2 videobuf2_common videodev snd_usbmidi_lib snd_rawmidi mc snd_hda_codec_realtek edac_mce_amd snd_hda_codec_hdmi snd_hda_codec_generic ledtrig_audio kvm_amd ccp snd_hda_intel snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec nvidia(POE) kvm snd_hda_core snd_hwdep eeepc_wmi asus_wmi irqbypass sparse_keymap snd_seq rfkill snd_seq_device wmi_bmof snd_pcm video k10temp fam15h_power snd_timer drm_kms_helper sp5100_tco snd i2c_piix4 cec
Jun 6 14:23:58 eve kernel: soundcore acpi_cpufreq binfmt_misc drm fuse zram ip_tables dm_crypt trusted mxm_wmi crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel serio_raw r8169 wmi
Jun 6 14:23:58 eve kernel: —[ end trace dfa7f7887fe5aab0 ]—
Jun 6 14:23:58 eve kernel: RIP: 0010:__vma_unlink_list+0x1b/0x30
Jun 6 14:23:58 eve kernel: Code: 70 18 c3 48 8b 07 48 89 37 eb ea 0f 1f 40 00 0f 1f 44 00 00 48 8b 56 18 48 8b 46 10 48 85 d2 74 0e 48 89 42 10 48 85 c0 74 04 <48> 89 50 18 c3 48 89 07 eb f1 66 66 2e 0f 1f 84 00 00 00 00 00 0f
Jun 6 14:23:58 eve kernel: RSP: 0018:ffff9dff070b3ce0 EFLAGS: 00010282
Jun 6 14:23:58 eve kernel: RAX: dfff920ad662d0c8 RBX: 0000000000000000 RCX: 0000000000000000
Jun 6 14:23:58 eve kernel: RDX: ffff920aeb7a30c8 RSI: ffff920ad673e320 RDI: ffff920ac0a450c0
Jun 6 14:23:58 eve kernel: RBP: ffff920ad673e320 R08: ffff920ac0a450c8 R09: 0000000010099000
Jun 6 14:23:58 eve kernel: R10: 0000000000100000 R11: 0000000000000000 R12: ffff920aeb7a30c8
Jun 6 14:23:58 eve kernel: R13: 0000000000000000 R14: ffff920ac0a450c0 R15: 0000000000200070
Jun 6 14:23:58 eve kernel: FS: 00000000003e2000(0063) GS:ffff920deec40000(006b) knlGS:00000000f7fc7880
Jun 6 14:23:58 eve kernel: CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033
Jun 6 14:23:58 eve kernel: CR2: 0000000025c7a004 CR3: 00000000264a0000 CR4: 00000000000406e0
Jun 6 14:23:59 eve abrt-dump-journal-oops[1733]: abrt-dump-journal-oops: Found oopses: 1
Jun 6 14:23:59 eve abrt-dump-journal-oops[1733]: abrt-dump-journal-oops: Creating problem directories
Jun 6 14:24:00 eve abrt-dump-journal-oops[1733]: Reported 1 kernel oopses to Abrt

Das ist ein Crash, der glimpflich für das System abgelaufen ist, oder?

Leider nicht:

Jun 06 23:57:47 eve.resellerdesktop.de systemd-cryptsetup[11292]: Device luks-ffbd61f2-4c1e-4dc8-b12b-c89e9f69c9fa is still in use.
Jun 06 23:57:47 eve.resellerdesktop.de systemd-cryptsetup[11292]: Failed to deactivate: Device or resource busy

Die Luks-Partition konnte also beim Shutdown nicht geschlossen werden, weil da noch ein Prozess drauf zugriff, was Ihr im Log nicht sehen werdet, aber beim Runterfahren des PCs am Ende zum Umstand führt, daß der Rechner nicht, oder nur nach einer sehr langen Zeit abschaltet. Wer dann den Plymouth Schleier hebt und sich die Meldungen vom Systemd-Shutdown ansieht, der wird feststellen, daß ein Prozess nicht beendet werden kann.

Welcher war das wohl? Dreimal dürft Ihr raten.

Der Crash stört also den Datenzugriff auf die Platte, weil dabei der Kernel crasht kann es zum unkontrollierten Schreibzugriff auf den Datenträger kommen und der kann dann Dateien zerstören.

Natürlich ist hier nicht nur Wine Schuld, der Kernel darf auch nicht gleich mitcrashen. Ergo gibt es jetrzt einen Bugreport an Fedora und hoffenlich fixt das bald einer, weil mir langsam die gesunden Daten ausgehen 🙁