Issue #1020
charon segfault with incomplete strongswan.conf file
Description
Strongswan 5.1.2 and 5.1.3 (and maybe lower) are affected by a small bug which causes charon to segfault.
This has been indirectly fixed in 5.2.0 when the strongswan.conf parser was rewritten to flex/bison.
The issue appears with an "incomplete" strongswan.conf file. Using the load_modular=yes feature without setting a plugins list has the following effect:
Jul 6 11:47:54 ubuntu kernel: [ 483.067585] charon[4954]: segfault at 0 ip 00007f59e14b2aea sp 00007ffd31d88508 error 4 in libc-2.19.so[7f59e142a000+1bb000]
Using gdb:
Starting program: /usr/lib/ipsec/charon
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/x86_64/strlen.S:106
106 ../sysdeps/x86_64/strlen.S: Aucun fichier ou dossier de ce type.
#0 strlen () at ../sysdeps/x86_64/strlen.S:106
#1 0x00007ffff71b482e in __GI___strdup (s=0x0) at strdup.c:41
#2 0x00007ffff7b9c3ad in enumerator_create_token (string=string@entry=0x0, sep=sep@entry=0x7ffff7bc4bb0 " ", trim=trim@entry=0x7ffff7bc4bb0 " ")
at collections/enumerator.c:304
#3 0x00007ffff7bb0121 in load_plugins (this=<optimized out>,
list=0x5555555567a0 "test-vectors curl soup unbound ldap mysql sqlite pkcs11 aes rc2 sha1 sha2 md4 md5 rdrand random nonce x509 revocation constraints pubkey pkcs1 pkcs7 pkcs8 pkcs12 pgp dnskey sshkey dnscert ipseckey pem"...) at plugins/plugin_loader.c:1079
#4 0x00007ffff771f96d in initialize (this=0x555555760e40,
plugins=0x5555555567a0 "test-vectors curl soup unbound ldap mysql sqlite pkcs11 aes rc2 sha1 sha2 md4 md5 rdrand random nonce x509 revocation constraints pubkey pkcs1 pkcs7 pkcs8 pkcs12 pgp dnskey sshkey dnscert ipseckey pem"...) at daemon.c:531
#5 0x0000555555555acd in main (argc=<optimized out>, argv=<optimized out>) at charon.c:406
A debugging session is active.
Inferior 1 [process 5066] will be killed.
Starting from 5.2.0, charon has a more acceptable way of dealing with that (is stops itself properly):
Jul 6 11:55:46 00[DMN] Starting IKE charon daemon (strongSwan 5.3.2, Linux 3.13.0-55-generic, x86_64) Jul 6 11:55:46 00[LIB] loading feature CUSTOM:libcharon in plugin 'charon' Jul 6 11:55:46 00[LIB] feature CUSTOM:libcharon in critical plugin 'charon' has unmet dependency: NONCE_GEN Jul 6 11:55:46 00[LIB] loading feature CUSTOM:libcharon-receiver in plugin 'charon' Jul 6 11:55:46 00[LIB] feature CUSTOM:libcharon-receiver in critical plugin 'charon' has unmet dependency: HASHER:HASH_SHA1 Jul 6 11:55:46 00[LIB] failed to load 2 critical plugin features Jul 6 11:55:46 00[LIB] unloading plugin 'charon' without loaded features Jul 6 11:55:46 00[DMN] initialization failed - aborting charon@
The bug is fixed in the current version so I am only opening this thread for reference.
However it is still present in the Ubuntu repository packages (5.1.2 Trusty for example).
History
#1 Updated by Tobias Brunner over 2 years ago
- Description updated (diff)
- Status changed from New to Feedback
Thanks for the report. This is actually not related to the parser, but was fixed with 0ab7d5f1f9 (which is included in 5.1.3).
#2 Updated by Jacques Henry over 2 years ago
Yes, you're absolutely right, this has been fixed in 5.1.3
#3 Updated by Tobias Brunner over 2 years ago
- Status changed from Feedback to Closed
- Assignee set to Tobias Brunner
- Resolution set to Fixed