Package: openvpn
Severity: normal
Tags: security
When running openvpn compiled with ASAN, an exception appears:
$ /home/fmunozs/openvpn/openvpn-2.3.2/src/openvpn/openvpn --genkey
--secret key.$$
=================================================================
==31351==ERROR: AddressSanitizer: heap-use-after-free on address
0xb5118174 at pc 0xb74ea8f9 bp 0xbfa4faf8 sp 0xbfa4fae8
READ of size 4 at 0xb5118174 thread T0
#0 0xb74ea8f8 in env_set_destroy
/home/fmunozs/openvpn/openvpn-2.3.2/src/openvpn/misc.c:582
#1 0xb755cb34 in openvpn_main
/home/fmunozs/openvpn/openvpn-2.3.2/src/openvpn/openvpn.c:280
#2 0xb741848a in main
/home/fmunozs/openvpn/openvpn-2.3.2/src/openvpn/openvpn.c:324
#3 0xb6a6872d in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x1872d)
#4 0xb7419009
(/home/fmunozs/openvpn/openvpn-2.3.2/src/openvpn/openvpn+0x29009)
0xb5118174 is located 4 bytes inside of 12-byte region [0xb5118170,0xb511817c)
freed by thread T0 here:
#0 0xb6ef6f06 in __interceptor_free
(/usr/lib/i386-linux-gnu/libasan.so.1+0x50f06)
#1 0xb741fd18 in x_gc_free
/home/fmunozs/openvpn/openvpn-2.3.2/src/openvpn/buffer.c:360
previously allocated by thread T0 here:
#0 0xb6ef718c in __interceptor_malloc
(/usr/lib/i386-linux-gnu/libasan.so.1+0x5118c)
#1 0xb741fa77 in gc_malloc
/home/fmunozs/openvpn/openvpn-2.3.2/src/openvpn/buffer.c:336
SUMMARY: AddressSanitizer: heap-use-after-free
/home/fmunozs/openvpn/openvpn-2.3.2/src/openvpn/misc.c:582
env_set_destroy
Shadow bytes around the buggy address:
0x36a22fd0: fa fa 00 00 fa fa 00 04 fa fa 00 00 fa fa 00 04
0x36a22fe0: fa fa 00 00 fa fa 00 04 fa fa 00 00 fa fa 00 04
0x36a22ff0: fa fa 00 00 fa fa 00 04 fa fa 00 00 fa fa 00 04
0x36a23000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x36a23010: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x36a23020: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa[fd]fd
0x36a23030: fa fa 00 04 fa fa 00 00 fa fa 00 04 fa fa 00 00
0x36a23040: fa fa 00 04 fa fa fd fd fa fa 00 00 fa fa 00 00
0x36a23050: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
0x36a23060: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
0x36a23070: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Contiguous container OOB:fc
ASan internal: fe
==31351==ABORTING
This is the output when running the standard build under valgrind,
which also shows the invalid read:
$ valgrind "openvpn" --genkey --secret key.$$
==31096== Memcheck, a memory error detector
==31096== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==31096== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==31096== Command: openvpn --genkey --secret key.31069
==31096==
==31096== Invalid read of size 4
==31096== at 0x1303CA: ??? (in /usr/sbin/openvpn)
==31096== by 0x141975: ??? (in /usr/sbin/openvpn)
==31096== by 0x10FAEA: main (in /usr/sbin/openvpn)
==31096== Address 0x4ce5a14 is 4 bytes inside a block of size 12 free'd
==31096== at 0x482D358: free (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==31096== by 0x1108EA: ??? (in /usr/sbin/openvpn)
==31096== by 0x122E1A: ??? (in /usr/sbin/openvpn)
==31096== by 0x141968: ??? (in /usr/sbin/openvpn)
==31096== by 0x10FAEA: main (in /usr/sbin/openvpn)
==31096==
==31096==
==31096== HEAP SUMMARY:
==31096== in use at exit: 276 bytes in 9 blocks
==31096== total heap usage: 3,216 allocs, 3,207 frees, 89,032 bytes allocated
==31096==
==31096== LEAK SUMMARY:
==31096== definitely lost: 0 bytes in 0 blocks
==31096== indirectly lost: 0 bytes in 0 blocks
==31096== possibly lost: 0 bytes in 0 blocks
==31096== still reachable: 276 bytes in 9 blocks
==31096== suppressed: 0 bytes in 0 blocks
==31096== Rerun with --leak-check=full to see details of leaked memory
==31096==
==31096== For counts of detected and suppressed errors, rerun with: -v
==31096== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)