159 Commits

Author SHA1 Message Date
Franck Joncourt
1a8520d659 Fixed gcc warning for the md5 driver.
md5.c: In function 'MD5Final':
md5.c:166:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
md5.c:167:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

Debian Gnu/Linux on i386 build against 2.0.4 :

https://buildd.debian.org/status/fetch.php?pkg=fwknop&arch=i386&ver=2.0.4-1&stamp=1358610541
2013-01-26 22:23:18 +01:00
Michael Rash
1d35c33d52 [test suite] added --enable-openssl-checks
Added --enable-openssl-checks to send all SPA packets encrypted via libfko
through the OpenSSL library to ensure that the libfko usage of AES is always
compatible with OpenSSL.  This ensures that the fwknop usage of AES is properly
implemented as verified by the OpenSSL library, which is a frequently audited
high profile crypto engine.  If a vulnerability is discovered in OpenSSL and a
change is made, then the --enable-openssl-checks mode will allow the test suite
to discover this in a automated fashion for fwknop.
2013-01-25 21:44:24 -05:00
Michael Rash
fbbcae3a0d [libfko] Don't trundate > 16 byte Rijndael keys
Significant bug fix to honor the full encryption key length for
user-supplied Rijndael keys > 16 bytes long.  Previous to this bug fix,
only the first 16 bytes of a key were actually used in the encryption/
decryption process even if the supplied key was longer.  The result was
a weakening of expected security for users that had keys > 16 bytes,
although this is probably not too common.  Note that "passphrase" is
perhaps technically a better word for "user-supplied key" in this
context since Rijndael in CBC mode derives a real encryption/decryption
key from the passphrase through a series of applications of md5 against
the passphrase and a random salt.  This issue was reported by Michael T.
Dean.  Closes issue #18 on github.
2013-01-22 22:20:54 -05:00
Michael Rash
160a9e5565 perl FKO module HMAC compatibility 2013-01-20 14:27:27 -05:00
Michael Rash
47f20ea30c merged in the fixes_for_2.0.4 branch 2013-01-19 18:36:52 -05:00
Michael Rash
47ea800889 merged in fwknop-2.0.4 changes 2013-01-18 17:25:16 -05:00
Damien Stuart
10c19063df Fixed parallel build issue
Added explicit dependency directives to Makefile.am to address errors
when running a parallel build.
2012-12-23 10:28:30 -05:00
Damien Stuart
10f2d295be Have libfko link strlxxx objects directly instead of libfko_util. 2012-12-08 15:40:40 -05:00
Damien Stuart
39410044c5 Set new libfko version. Client: allow dot (.) in validate_username, and display version and exit without creating an fko context. 2012-12-07 11:38:31 -05:00
Michael Rash
88c66f647f Revert "added got_allow_ip() wrapper around have_allow_ip() to fix an exported symbol issue noticed by Franck"
This reverts commit e57cfa2e235261b960986ecae0c7e86307159529.  This is done
because libfko now restricts the symbols it exports to only those functions
that should be visible when making use of the library - internal libfko
functions should not be exported.
2012-12-03 22:45:39 -05:00
Damien Stuart
7df9edc1db Merge branch 'master' of github.com:mrash/fwknop 2012-12-02 09:59:48 -05:00
Damien Stuart
bcea440b87 Limited exported symbols in libfko to only the public (fko_) functions. Moved strlcat/cpy to a separate libfko_util lib. 2012-12-02 09:56:57 -05:00
Michael Rash
e57cfa2e23 added got_allow_ip() wrapper around have_allow_ip() to fix an exported symbol issue noticed by Franck 2012-12-01 22:45:55 -05:00
Damien Stuart
e3c4c045c6 Changes to address header references, platform support, error messages, and the perl module test suite.
Rearranged headers to reduce duplication and remove local header
references from fko.h.
Removed references to headers that did not need to be explicitly set.
Moved the MAX_PROTO_STR_LEN and MAX_PORT_STR_LEN definitions to the
fko_limits.h file.
Fixed bug where invalid nat_access or command messages were returning
FKO_ERROR_INVALID_SPA_ACCESS_MSG error code instead of the one
appropriate to the message type.
Fixed bad nat_access_msg test in Perl module test suite (caught by new
validation code).
2012-12-01 11:06:41 -05:00
Damien Stuart
1ec9f4ae94 Re-tweaks for accommodating the windows build and systems that do not have strnlen 2012-11-30 23:40:24 -05:00
Michael Rash
eaba5813f3 Bug fix for perl FKO compilation
This commit removes lib/ includes of common/ header files that was breaking
the perl FKO module compilation.
2012-11-28 22:39:07 -05:00
Damien Stuart
617305504a Revert "Tweaks to EXTRA_DIST. Added one missing and removed one invalid entry under the test directory."
This reverts commit 556ca2c146a598cddada4dd8cdf3f9b12f32f202.
2012-11-19 12:19:12 -05:00
Damien Stuart
556ca2c146 Tweaks to EXTRA_DIST. Added one missing and removed one invalid entry under the test directory. 2012-11-19 09:30:15 -05:00
Damien Stuart
f499e30900 Tweaks to fix issues with building the lib and client under Windows. Added .fwknop.last support on Windows. Bumped the lib version to 0.0.4. Fixed bug in username detection code. Removed -Werror from AM_INIT_AUTOMAKE which prevented setting of CPPFLAG for the lib build in some circumstances. 2012-11-19 08:43:14 -05:00
Michael Rash
517f447028 bumped version to 2.0.4 2012-11-14 23:45:43 -05:00
Michael Rash
02790628d4 additional SPA validation check to ensure no non-ascii printable chars in decoded message 2012-11-13 21:16:27 -05:00
Michael Rash
70afd9c2d4 minor spacing fix 2012-11-13 21:12:41 -05:00
Michael Rash
7afe5b28b7 minor update to use explicit FKO_SUCCESS value in if() result check 2012-11-08 21:03:45 -05:00
Michael Rash
2ae1449122 allow '_' chars in usernames provided to libfko 2012-11-08 21:02:44 -05:00
Tomoyuki Kano
cf783e075e add missing include files to lib/Makefile.am 2012-11-03 19:03:48 +09:00
Michael Rash
ac38f8d993 [libfko] bug fix to check b64_decode() return value
Bug fix to check b64_decode() return value to ensure that
non-base64 encoded data is never used.  Even though other validation
routines checked decoded results, it is important to discard invalid
data as early as possible.  Note too that such invalid data would only
be provided to b64_decode() after proper decryption, so the client must
provide authentic SPA data.
2012-10-26 15:36:08 -04:00
Michael Rash
52d023ec60 added validate_username() call to SPA packet encoding routine 2012-10-22 20:31:31 -04:00
Michael Rash
3eaa7dcb5f added libfko validate_username() for decrypted SPA data 2012-10-18 23:01:54 -04:00
Michael Rash
e0d86f9a33 [libfko] validation of NAT access strings
Added validation of NAT access strings in the various NAT modes in libfko.
This applies to both the client and server, and test suite support was added
as well.
2012-10-15 20:52:23 -04:00
Michael Rash
402c7033d5 force usernames to be alpha numeric chars and dashes 2012-10-12 23:51:28 -04:00
Michael Rash
e4751d1c20 added icmp type/code blurb 2012-10-11 23:40:04 -04:00
Michael Rash
f8374c8aef [server] (Vlad Glagolev) Submitted a patch to fix command exec mode
(Vlad Glagolev) Submitted a patch to fix command exec mode
under SPA message type validity test.  Support for command exec mode was
also added to the test suite.
2012-09-11 21:54:26 -04:00
Michael Rash
55fa4841f2 another merge from master 2012-09-03 22:32:44 -04:00
Michael Rash
40ac28df21 bump version to 2.0.3 2012-09-03 22:23:48 -04:00
Michael Rash
8d26cc90ee include file compilation fix for OpenBSD relative to inet_aton() IP verification 2012-09-03 22:18:59 -04:00
Michael Rash
b05d229bb1 sprintf() -> snprintf() calls 2012-09-03 09:09:35 -04:00
Michael Rash
263fa01f2a added inet_aton() call for IP strong IP validation (credit: Fernando Arnaboldi) 2012-09-03 00:21:32 -04:00
Michael Rash
1548cbafc8 get MAX_PORT_STR_LEN constant from fko_message.h 2012-08-31 23:05:05 -04:00
Michael Rash
b567514a6c Added fko_context.h file to lib/Makefile.am 2012-08-31 22:59:44 -04:00
Michael Rash
5daaca01ea merged master 2.0.3 changes 2012-08-31 21:43:55 -04:00
Michael Rash
f4c16bc47f [server] Stronger IP validation based on a bug found by Fernando Arnaboldi from IOActive
This commit fixes a condition in which the server did not properly validate
allow IP addresses from malicious authenticated clients.  This has been fixed
with stronger allow IP validation.
2012-08-25 23:08:55 -04:00
Michael Rash
d46ba1c027 (Fernando Arnaboldi, IOActive) Found and fixed several DoS/code execution vulns for authenticated clients
- [server] Fernando Arnaboldi from IOActive found several DoS/code
execution vulnerabilities for malicious fwknop clients that manage to
get past the authentication stage (so a such a client must be in
possession of a valid access.conf encryption key).  These vulnerbilities
manifested themselves in the handling of malformed access requests, and
both the fwknopd server code along with libfko now perform stronger input
validation of access request data.  These vulnerabilities affect
pre-2.0.3 fwknop releases.
- [test suite] Added a new fuzzing capability to ensure proper server-side
input validation.  Fuzzing data is constructed with modified fwknop
client code that is designed to emulate malicious behavior.
2012-08-24 22:12:19 -04:00
Michael Rash
e80a6de5f7 Memory leak bug fix discovered through the "altered HMAC test"
This commit fixes a memory leak caught with valgrind in the "altered HMAC
test":

 [+] fwknop functions (unique view):
-        9 : ???
-        4 : main
-        4 : pcap_capture
-        2 : incoming_spa
-        2 : fko_new_with_data
-        2 : fko_verify_hmac
+        7 : ???
+        2 : pcap_capture
+        2 : main
         1 : pcap_compile
-        1 : strdup
-        1 : fko_calculate_hmac
-        1 : add_salted_str

 [+] fwknop functions (with call line numbers):
-        9 : ??? (in /usr/lib/x86_64-linux-gnu/libpcap.so.1.1.1)
-        4 : main (fwknopd.c:299)
-        2 : fko_new_with_data (fko_funcs.c:220)
-        2 : pcap_capture (pcap_capture.c:226)
-        2 : incoming_spa (incoming_spa.c:378)
-        1 : add_salted_str (cipher_funcs.c:298)
-        1 : strdup (strdup.c:43)
-        1 : fko_verify_hmac (fko_hmac.c:78)
-        1 : fko_verify_hmac (fko_hmac.c:92)
-        1 : pcap_capture (pcap_capture.c:105)
+        7 : ??? (in /usr/lib/x86_64-linux-gnu/libpcap.so.1.1.1)
+        2 : main (fwknopd.c:299)
         1 : pcap_compile (in /usr/lib/x86_64-linux-gnu/libpcap.so.1.1.1)
         1 : pcap_capture (pcap_capture.c:97)
-        1 : fko_calculate_hmac (fko_hmac.c:169)
+        1 : pcap_capture (pcap_capture.c:105)
2012-08-19 10:43:30 -04:00
Michael Rash
c374a7df27 Merge branch 'master' into hmac_support 2012-08-05 13:26:43 -04:00
Michael Rash
4cde31584f bumped version to 2.0.2-pre1 2012-08-03 22:16:22 -04:00
Michael Rash
30acf93b72 Memory leak fix for HMAC verification
This commit commit fixes a memory leak in the HMAC verification code found with
the test suite running in valgrind mode.  Here is the './test-fwknop.pl --diff'
output showing fko_verify_hmac() removed from the flagged functions list:

 [+] fwknop functions (unique view):
-        8 : ???
-        3 : main
-        3 : pcap_capture
-        1 : incoming_spa
+        7 : ???
+        2 : pcap_capture
+        2 : main
         1 : pcap_compile
-        1 : fko_new_with_data
-        1 : strndup
-        1 : fko_verify_hmac

 [+] fwknop functions (with call line numbers):
-        8 : ??? (in /usr/lib/x86_64-linux-gnu/libpcap.so.1.1.1)
-        3 : main (fwknopd.c:299)
-        1 : fko_new_with_data (fko_funcs.c:220)
-        1 : pcap_capture (pcap_capture.c:105)
-        1 : incoming_spa (incoming_spa.c:376)
-        1 : strndup (strndup.c:46)
+        7 : ??? (in /usr/lib/x86_64-linux-gnu/libpcap.so.1.1.1)
+        2 : main (fwknopd.c:299)
         1 : pcap_compile (in /usr/lib/x86_64-linux-gnu/libpcap.so.1.1.1)
-        1 : pcap_capture (pcap_capture.c:226)
         1 : pcap_capture (pcap_capture.c:97)
-        1 : fko_verify_hmac (fko_hmac.c:54)
+        1 : pcap_capture (pcap_capture.c:105)
2012-08-02 22:55:54 -04:00
Michael Rash
3d9e96af56 Memory leak fix in client test mode
This commit fixes the following memory leak found with the test suite running
in valgrind mode:

HEAP SUMMARY:
    in use at exit: 217 bytes in 3 blocks
  total heap usage: 27 allocs, 24 frees, 5,260 bytes allocated

44 bytes in 1 blocks are definitely lost in loss record 1 of 3
   at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x50CB861: strndup (strndup.c:46)
   by 0x4E3A4D4: fko_verify_hmac (fko_hmac.c:54)
   by 0x4E394DD: fko_new_with_data (fko_funcs.c:220)
   by 0x10B3A7: main (fwknop.c:408)

44 bytes in 1 blocks are definitely lost in loss record 2 of 3
   at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x50CB801: strdup (strdup.c:43)
   by 0x4E3A3FC: fko_calculate_hmac (fko_hmac.c:162)
   by 0x4E3A552: fko_verify_hmac (fko_hmac.c:86)
   by 0x4E394DD: fko_new_with_data (fko_funcs.c:220)
   by 0x10B3A7: main (fwknop.c:408)

129 bytes in 1 blocks are definitely lost in loss record 3 of 3
   at 0x4C2B7B2: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x4E36A03: add_salted_str (cipher_funcs.c:298)
   by 0x4E3A587: fko_verify_hmac (fko_hmac.c:75)
   by 0x4E394DD: fko_new_with_data (fko_funcs.c:220)
   by 0x10B3A7: main (fwknop.c:408)

LEAK SUMMARY:
   definitely lost: 217 bytes in 3 blocks
   indirectly lost: 0 bytes in 0 blocks
     possibly lost: 0 bytes in 0 blocks
   still reachable: 0 bytes in 0 blocks
        suppressed: 0 bytes in 0 blocks
2012-08-02 22:46:52 -04:00
Michael Rash
1528697aaa merged replay prefix and IP resolve tests 2012-08-01 23:05:51 -04:00
Michael Rash
016098a254 Replay attack bug fix (encryption prefixes)
Ensure that an attacker cannot force a replay attack by intercepting an
SPA packet and the replaying it with the base64 version of "Salted__"
(for Rindael) or the "hQ" prefix (for GnuPG).  This is an important fix.
The following comment was added into the fwknopd code:

/* Ignore any SPA packets that contain the Rijndael or GnuPG prefixes
 * since an attacker might have tacked them on to a previously seen
 * SPA packet in an attempt to get past the replay check.  And, we're
 * no worse off since a legitimate SPA packet that happens to include
 * a prefix after the outer one is stripped off won't decrypt properly
 * anyway because libfko would not add a new one.
*/

Conflicts:

	lib/cipher_funcs.h
2012-08-01 21:52:56 -04:00
Michael Rash
c0e53482fa [libfko] minor memory leak fix for user detection (corner case) 2012-07-30 22:34:15 -04:00