Repository navigation
Closed
Labels
Description
Describe the bug
openvpn server crashes with message Floating point exception on Debian Bookworm 12:
2023-09-26 03:11:53 us=211476 TLS: Initial packet from [AF_INET]94.102.61.34:42523, sid=12121212 12121212
2023-09-26 03:11:53 us=211574 TLS Error: Early negotiation malformed packet
2023-09-26 03:11:53 us=211594 TLS Error: TLS handshake failed
Program received signal SIGFPE, Arithmetic exception.
0x000055555557b698 in optimal_fragment_size (max_frag_size=0, len=156) at ./src/openvpn/fragment.c:307
307 ./src/openvpn/fragment.c: No such file or directory.
(gdb) backtrace
#0 0x000055555557b698 in optimal_fragment_size (max_frag_size=0, len=156) at ./src/openvpn/fragment.c:307
#1 fragment_outgoing (f=0x5555556941e0, buf=buf@entry=0x7fffffffe458, frame=frame@entry=0x7fffffffe1c0) at ./src/openvpn/fragment.c:340
#2 0x0000555555576e5a in encrypt_sign (c=c@entry=0x7fffffffd350, comp_frag=comp_frag@entry=true) at ./src/openvpn/forward.c:641
#3 0x0000555555578355 in process_incoming_tun (c=c@entry=0x7fffffffd350) at ./src/openvpn/forward.c:1462
#4 0x000055555557ab21 in process_io (c=c@entry=0x7fffffffd350) at ./src/openvpn/forward.c:2277
#5 0x00005555555a434c in tunnel_point_to_point (c=0x7fffffffd350) at ./src/openvpn/openvpn.c:94
#6 openvpn_main (argc=2, argv=0x7fffffffe748) at ./src/openvpn/openvpn.c:315
#7 0x00007ffff77531ca in __libc_start_call_main (main=main@entry=0x555555561da0 <main>, argc=argc@entry=2, argv=argv@entry=0x7fffffffe748) at ../sysdeps/nptl/libc_start_call_main.h:58
#8 0x00007ffff7753285 in __libc_start_main_impl (main=0x555555561da0 <main>, argc=2, argv=0x7fffffffe748, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe738) at ../csu/libc-start.c:360
#9 0x0000555555561dd1 in _start ()
Package source code: https://packages.debian.org/source/bookworm/openvpn
To Reproduce
Server config:
fragment 1300
mssfix
port 1194
proto udp
dev tapvpn
ca /etc/openvpn/server/ca.crt
cert /etc/openvpn/server/server.crt
key /etc/openvpn/server/server.key # This file should be kept secret
dh none
keepalive 10 120
tls-server
tls-version-min 1.2
tls-cipher TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384
cipher AES-256-CBC
persist-key
persist-tun
status /var/log/openvpn/openvpn-status.log
verb 4
explicit-exit-notify 1
Client config:
fragment 1300
mssfix
client
dev tapvpn
proto udp
remote SERVER_IP 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca /etc/openvpn/client/ca.crt
cert /etc/openvpn/client/niko-casa.crt
key /etc/openvpn/client/niko-casa.key
remote-cert-tls server
cipher AES-256-CBC
verb 4
Expected behavior
Should not crash.
Version information (please complete the following information):
- OS: Debian Bookworm 12
- OpenVPN server version: 2.6.3-1+deb12u1
- OpenVPN client version: 2.6.6-1 (Arch Linux)
Additional context
Happens VERY often.
Activity
darkbasic commentedon Sep 26, 2023
I would like to clarify that
94.102.61.34is NOT an IP of any authorized client I've created a certificate for. In fact I've issued only a single client certificate and its IP is static. I do not recognize this IP.darkbasic commentedon Sep 26, 2023
Since we're at it I also find this warning confusing:
schwabe commentedon Sep 26, 2023
The warning is valid. the mtu keyword is default when you use mssfix without options but is not for fragment.
darkbasic commentedon Sep 26, 2023
@schwabe too bad that I cannot set the mtu parameter for fragment in NetworkManager :(
[-]openvpn 2.6.3-1+deb12u1: Floating point exception[/-][+]openvpn 2.6.3-1+deb12u1: Arithmetic exception[/+][-]openvpn 2.6.3-1+deb12u1: Arithmetic exception[/-][+]openvpn 2.6.3-1+deb12u1: Arithmetic exception when unsing --fragment[/+][-]openvpn 2.6.3-1+deb12u1: Arithmetic exception when unsing --fragment[/-][+]openvpn 2.6.3-1+deb12u1: Arithmetic exception when using --fragment[/+]schwabe commentedon Sep 27, 2023
This not trivial to reproduce. Could you try to reproduce the crash with a higher verboisity? Like with
verb 4? I wonder if that is something that is trigger by us getting a PMTU value of zero.darkbasic commentedon Sep 27, 2023
As you can see from my configs I'm already using
verb 4. If you want I can try to dump the rogue packet which triggers theEarly negotiation malformed packetso you can use it to reproduce the issue.schwabe commentedon Sep 28, 2023
Can you provide full logs that contain the crash? It seems to be quite easy for you to reproduce while I cannot reproduce it at all. I still stumble quite in the dark what is happening here. Maybe even with do logs with
verb 7. You can also provide them to me via email or similar if you don't want to post them on Github.darkbasic commentedon Sep 28, 2023
I already did: everything else was minutes prior to the crash and completely unrelated.
I will try with
verb 7to see if things improve. I can also provide the full log since the server has been started, but it will be easier to mail it because I can't bother removing all personal data. I will also provide a dump of the rogue packet which triggers the issue, I think that will be key to reproduce it. My email address is niccolo.belli at linuxsystems.it, ping me there.schwabe commentedon Oct 13, 2023
@darkbasic have a you received my ping to your email address? It should have come from my arne@rfc2549.org addresss
darkbasic commentedon Oct 14, 2023
@schwabe I'm sorry but I had completely missed your email. I've sent you all the logs with verb 7 and a dump of the packet which triggers the floating point exception.
schwabe commentedon Oct 16, 2023
Thanks for sending hte log with verb 7. That helps to figure out in what state OpenVPN is when the crash happens. This part of the log is interesting:
Somehow after receiving the malformed TLS_RESET_V2 we send a broken packet of 26 bytes.
flichtenheld commentedon Feb 19, 2024
This was fixed in 2.6.7 but not closed
fragment: avoid division by zero in optimal_fragment_size()