From 896258ca1d06d5fe39014f2dcd7e87465aa1b0d6 Mon Sep 17 00:00:00 2001 From: Bjarke Istrup Pedersen Date: Fri, 8 May 2015 18:15:00 +0000 Subject: [PATCH] Removing old version and fixing bug #548744 Package-Manager: portage-2.2.18/cvs/Linux x86_64 Manifest-Sign-Key: 0x15AE484C --- net-wireless/hostapd/ChangeLog | 17 ++++- net-wireless/hostapd/Manifest | 15 ++-- ...-payload-length-validation-for-Commi.patch | 73 +++++++++++++++++++ ...ix-payload-length-validation-for-Com.patch | 66 +++++++++++++++++ ...-Total-Length-parsing-for-fragment-r.patch | 52 +++++++++++++ ...ix-Total-Length-parsing-for-fragment.patch | 50 +++++++++++++ ...ix-asymmetric-fragmentation-behavior.patch | 32 ++++++++ ...stapd-2.4.ebuild => hostapd-2.4-r1.ebuild} | 13 +++- 8 files changed, 311 insertions(+), 7 deletions(-) create mode 100644 net-wireless/hostapd/files/2015-4/0001-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch create mode 100644 net-wireless/hostapd/files/2015-4/0002-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch create mode 100644 net-wireless/hostapd/files/2015-4/0003-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch create mode 100644 net-wireless/hostapd/files/2015-4/0004-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch create mode 100644 net-wireless/hostapd/files/2015-4/0005-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch rename net-wireless/hostapd/{hostapd-2.4.ebuild => hostapd-2.4-r1.ebuild} (90%) diff --git a/net-wireless/hostapd/ChangeLog b/net-wireless/hostapd/ChangeLog index fc54ff766f40..34e9edf6d40f 100644 --- a/net-wireless/hostapd/ChangeLog +++ b/net-wireless/hostapd/ChangeLog @@ -1,6 +1,21 @@ # ChangeLog for net-wireless/hostapd # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-wireless/hostapd/ChangeLog,v 1.154 2015/03/21 13:19:27 gurligebis Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-wireless/hostapd/ChangeLog,v 1.155 2015/05/08 18:14:59 gurligebis Exp $ + +*hostapd-2.4-r1 (08 May 2015) + + 08 May 2015; -hostapd-2.4.ebuild, + +hostapd-2.4-r1.ebuild, + +files/2015-4/0001-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch + , + +files/2015-4/0002-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch + , + +files/2015-4/0003-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch + , + +files/2015-4/0004-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch + , + +files/2015-4/0005-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch: + Removing old version and fixing #548744 *hostapd-2.4 (21 Mar 2015) diff --git a/net-wireless/hostapd/Manifest b/net-wireless/hostapd/Manifest index f37ff2627c42..e3d414382f91 100644 --- a/net-wireless/hostapd/Manifest +++ b/net-wireless/hostapd/Manifest @@ -1,6 +1,11 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 +AUX 2015-4/0001-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch 2410 SHA256 a204bc37f52e5346780a306c01706689eb46263dedcdcb1eb2f4c0b291a0db93 SHA512 9440f8d9d18d20b95d236c1a4467d86dfbbc17d8f26b0caa48d6737c6231d1ff14793c6fc8a1e4508f3ad38c9a5d710fd49b85c7de16634dbe6685af05f44f7c WHIRLPOOL 815f07465f0bab5a0de6e1e91dd2c54062d5501f1657b06142936bbdbdf57103932e896f3fe659aa2ee20fe0f2659736273a5e9e19ac9d4028306c6f23dd37cb +AUX 2015-4/0002-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch 2359 SHA256 298fc3b89f987922fb2600d0c95e8c868d6da30d24643748afd47bcd30da7b44 SHA512 0887017bfdb4632baa49bb849b732eed7eec9a498247fdd5ef8448e4a6df10380c06d68fa706e0b2624c04eb6f5a327cdb71c5c71c3476dc383f889ee7372702 WHIRLPOOL 057d7d38734cd323bb0df957ff7bb719ba8b7ccd885bbb85114bfa348363a3e7f752e3b652e22969616ae812444edbe8fceb7b62bd500d69d3bcb44d146a10a4 +AUX 2015-4/0003-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch 1859 SHA256 2fd42fb53be793c54343aa18a84afebe4603aa6ce8b6969ad6b3a8d327c6b142 SHA512 341901aa94c44ae725b6d4dddac2a52b6457234189554fc282c9cf5fa0254125d7323553a7b8118f9a3e2020f039267ed4c912f84ac6f2cb12670b40c28ac652 WHIRLPOOL 3e3b4cab765f373713fc41448ef65e8931a83449438fb7a8e3ab0a34c728a4a5772f996a04ee4b747b292044b1452a0821609e419a15dd681c70c063a125dcc0 +AUX 2015-4/0004-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch 1806 SHA256 c28ca6303a562809dfd1812f9b918808b3b0f0c52cc43070fd1777e1cfc88f18 SHA512 b752f91c3d6dcf0784d9cb20a0c7f8de6c837c38ff62cf77b136d9b818890b13f55eeed1d6097f244181b480be953e1bdfb5651116dc5d62a2d02c018e19042a WHIRLPOOL 069602c36d30afb3df5d9a722da680a9e5450e2272c84776076ef16a6d871397741b51a0460eca5dd7355d06e2f8b8e9adfb03e8caa7e58cde3c4b2a019df48b +AUX 2015-4/0005-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch 1207 SHA256 04ef66fbd5b2167274cd7123d7f7252963b9a9c1ec2f5edf6558a6ad92d47689 SHA512 07a21f0cc7d00e17bed8ef5ced36159020a410a4606aa0ca24e47223835ab0cc5fbeed3075c4f17d2ce1aee437eedf9fea8f4b95252b2fa255d54a195637cb6f WHIRLPOOL b61d0065dea90cb2234d621b7ecd6e6f9cf29e21b2b7011b275ea25f75a9e7a68c3be53f8cd8a47fb6340567d630d7d0843178a12660f9942f6c7769f2f237b8 AUX hostapd-2.0-tls_length_fix.patch 1859 SHA256 bbca0422a0babbf9d7fad2b758ecddaae45624db1b2db6d7663292548e25906a SHA512 e354e9352605003101cba296735232d11ac685f1db8718e5d59b55de1b86b55144e4871afe85cae4374f52af1b42df3ebd4747e109c86e0750ef9eb5345453d7 WHIRLPOOL 6a9379b09ffb73d13ea813952e2b39b5ab90ec98a27ed211ff2904d52e346c9e6273fe99e8ae6509773597afa352d9e77f3081103c5e5c55c86e12f8176a5419 AUX hostapd-conf.d 245 SHA256 916f4b14095ee4ec8a510391c883e9f01868e18d79a3d5cbeb13a104a793d45d SHA512 f07a6cd209eca351b8545017c5f025282c3fdea838ca3df49e362571ded43973281ce4ff83984b1299db15ea9b5c21a42cbda91432220af9146bf034e2265c30 WHIRLPOOL 0ab1dbd8e04df9e7b8ae875dfdfdcdd770e4fcb62197bb81e47588a9ecf0b8bb715adbde34f2be82d630fdd536e9f888f463dd12cab0c06220c345b0093a3dd5 AUX hostapd-hlr_auc_gw-openssl.patch 1232 SHA256 4c5b17af2825611ae479b7037b0dcdf19eab49f97c2191a3cfda709befd3ca30 SHA512 53f5dbcd03d3c824c13c02f69680cd581cb1107e48b8e63a281cef1339ff0303cbcb91e9b46640b28daec4252d7aa6069ea541a260900201a00e1d484a6b7a7e WHIRLPOOL 8eda4cbf0a80a5386d3599a1e5753b17038c34568823c14e12ed56af0da1f98a1a712a1f5ab930e98b67bf73704f3225771c6d60ba5ffb8de3a02f49564c4f6b @@ -9,13 +14,13 @@ AUX hostapd.service 213 SHA256 16f0612c192fb5d7e7de716f25fdfc2ccecc35a00ff745ae6 DIST hostapd-2.0.tar.gz 1376203 SHA256 262ce394b930bccc3d65fb99ee380f28d36444978f524c845a98e8e29f4e9d35 SHA512 25fddaaddb22903078cfaae29a1e955b60955f9f5542b52962a6a8d4c65146ca102e9ac085118ce422843c55349a74a019220dfd4926895e301d506dbc97b967 WHIRLPOOL e5ae2e760770d2f307b1c4235c9b0c9d25e1719a1d174efa30ce6bbbc07b5c46d5f7babc087b8f450f3b485fb640728ddd23761fb292bcd535ef38dc10ac1d45 DIST hostapd-2.4.tar.gz 1658872 SHA256 6fe0eb6bd1c9cbd24952ece8586b6f7bd14ab358edfda99794e79b9b9dbd657f SHA512 37e648fe9cce92923ab1d1e23a4267e274c988785d7be5610f1affca425ffa86b438de81e37446926a0f9158d6b67ee83e6396c3f81d571545c973dddbf1ffe3 WHIRLPOOL 78484c7e09725ba967c8815c3d8b0ffcc0c56daaec4acc79bc15c7392084c8642a2b41156b2c6a6360badb7e9d23792699d452fe600b56e3d62dd569188b6c2c EBUILD hostapd-2.0-r1.ebuild 5283 SHA256 91a76c256b5b27043f159cbe40534e6b487751bc63c593aca55a298088541836 SHA512 ac30eaeb3754e77916a0f7f75124324f2e424af3e0e50ea1381ce0c9e2127d568f040f14dce21b877840721d12dae20e42119b26d3cce847976c41c48286a484 WHIRLPOOL afcdc6ce3ed32b1223716fea94b04f4ac6a18c6a1bacbfb1b92f2bcf9e733584454fa27b20287faf9d7a5fb70f0c9e988924d9c20608c763dff01ad2870ef7d5 -EBUILD hostapd-2.4.ebuild 5439 SHA256 42032a3f74cc6f5f1aae25d1a77b11593b03c3602331a8656b2baf2f3bbe1cee SHA512 7e3600827d8b5473241f1475b6b59df6ca7bbaf4909402fda87136a4e757235681e60f475dda358722f1d4e0c9e88c0e9019f3beed1e3557a2f664993756e8c3 WHIRLPOOL 0dc79373db08e74fc19a3eb9bed0092397256aa4a0a949333c79def1a327a7ccb1cb6927f9c040dc402e956db1bfc7849e98cae7d75f55b94395b1fc51ddf664 -MISC ChangeLog 26899 SHA256 b0a74ef59a8a87a39531a74f0547c79f3c28d054c9bb8667c338c90d29ce915e SHA512 47ca5fecd0dc5f70486310864bf4b3edac4e62cadfd32ce192dd44380127bdf7793f628fcfcd09d6d5218c16bd6b8752f52e20359df8f7db6b901ed69c43204d WHIRLPOOL a0b772a58210dd823619dd719e2b4746dbb12369dd4ec65ff1bccb6c5ba5f063af0496838991587f1eeb15cb353015fc0cfa70a891043c20844b52f8200cfff8 +EBUILD hostapd-2.4-r1.ebuild 5943 SHA256 1b6ee3baf7a763722b61770dbcb8419a13a3769db3de8ecef970be5c0f5b43a4 SHA512 3e30931168475137475b44f73fa2fc9671da7c3dd7f798a9a43b1ebfa3fe3d58cd345082a1a284be5ceb88da867799c26cbd1dda8d1ccbf19cb5f73fc76d1fe3 WHIRLPOOL 303da4b98fb3b2ebe3af341c93de8f3291e18fa65283938884dca90257f2ed3557b195033aa8817825ec31a9f0d56671e15b09566808fb34b6eb6d7a33c5dc2c +MISC ChangeLog 27474 SHA256 f6559ea5c626a3b05100832dd5f438ccbc025dd15736104dffcd84cd6c4e0259 SHA512 2e1cf8b3935283550925f9af9164b0aea430c10f15b32420bdb9335351c800af05416b210a16e730e816c6317d75e44092461c05475845677fbe5fd656ba3d24 WHIRLPOOL cfd89e501dd8437b4472c970c7da00b3c23b65ea880513baad4fa70b5303125a2e54a61d4647f3775c06259e8ec74475991a49f0aa321ffd7a4d2648b2ec4476 MISC metadata.xml 860 SHA256 61963f6bf5911c90a644c8fd09477b1ceb5f7617e2f9521517d88b899e0021f0 SHA512 6706de2fdcadc5f7619cf2a42d349a5061a8fa1c7fa00c05bac0fe14583d6b5d99211e697c5255957f315c0de66dd10fbff6e450516321511e3fa7c9e4439d6b WHIRLPOOL dcdf07c188a486c59edd7d055f446575cf5162b06dc83a99fc60f2d261532a3f3e0438dbe9b8c3213913bef443898f79a5b61022fe6d6a9cd6d360bab2057fd4 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 -iEYEAREIAAYFAlUNb+AACgkQsR7PQhRXYEmpewCfcRHN4nT+qga00WEFp2Z6MVD/ -JqUAmwVqgJkNcm4mUPoa4jHKEFoROaRX -=KLcN +iEYEAREIAAYFAlVM/SQACgkQsR7PQhRXYEnv0ACeJTlrkOz/7b7fCZX6acjgDjdH +z28An1iYzWfBUCtPAor7oEseFlEQcUAN +=rImv -----END PGP SIGNATURE----- diff --git a/net-wireless/hostapd/files/2015-4/0001-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch b/net-wireless/hostapd/files/2015-4/0001-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch new file mode 100644 index 000000000000..91627fb7b7f6 --- /dev/null +++ b/net-wireless/hostapd/files/2015-4/0001-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch @@ -0,0 +1,73 @@ +From dd2f043c9c43d156494e33d7ce22db96e6ef42c7 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Fri, 1 May 2015 16:37:45 +0300 +Subject: [PATCH 1/5] EAP-pwd peer: Fix payload length validation for Commit + and Confirm + +The length of the received Commit and Confirm message payloads was not +checked before reading them. This could result in a buffer read +overflow when processing an invalid message. + +Fix this by verifying that the payload is of expected length before +processing it. In addition, enforce correct state transition sequence to +make sure there is no unexpected behavior if receiving a Commit/Confirm +message before the previous exchanges have been completed. + +Thanks to Kostya Kortchinsky of Google security team for discovering and +reporting this issue. + +Signed-off-by: Jouni Malinen +--- + src/eap_peer/eap_pwd.c | 29 +++++++++++++++++++++++++++++ + 1 file changed, 29 insertions(+) + +diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c +index f2b0926..a629437 100644 +--- a/src/eap_peer/eap_pwd.c ++++ b/src/eap_peer/eap_pwd.c +@@ -355,6 +355,23 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data, + BIGNUM *mask = NULL, *x = NULL, *y = NULL, *cofactor = NULL; + u16 offset; + u8 *ptr, *scalar = NULL, *element = NULL; ++ size_t prime_len, order_len; ++ ++ if (data->state != PWD_Commit_Req) { ++ ret->ignore = TRUE; ++ goto fin; ++ } ++ ++ prime_len = BN_num_bytes(data->grp->prime); ++ order_len = BN_num_bytes(data->grp->order); ++ ++ if (payload_len != 2 * prime_len + order_len) { ++ wpa_printf(MSG_INFO, ++ "EAP-pwd: Unexpected Commit payload length %u (expected %u)", ++ (unsigned int) payload_len, ++ (unsigned int) (2 * prime_len + order_len)); ++ goto fin; ++ } + + if (((data->private_value = BN_new()) == NULL) || + ((data->my_element = EC_POINT_new(data->grp->group)) == NULL) || +@@ -554,6 +571,18 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data, + u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr; + int offset; + ++ if (data->state != PWD_Confirm_Req) { ++ ret->ignore = TRUE; ++ goto fin; ++ } ++ ++ if (payload_len != SHA256_MAC_LEN) { ++ wpa_printf(MSG_INFO, ++ "EAP-pwd: Unexpected Confirm payload length %u (expected %u)", ++ (unsigned int) payload_len, SHA256_MAC_LEN); ++ goto fin; ++ } ++ + /* + * first build up the ciphersuite which is group | random_function | + * prf +-- +1.9.1 + diff --git a/net-wireless/hostapd/files/2015-4/0002-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch b/net-wireless/hostapd/files/2015-4/0002-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch new file mode 100644 index 000000000000..5dca20b2771b --- /dev/null +++ b/net-wireless/hostapd/files/2015-4/0002-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch @@ -0,0 +1,66 @@ +From e28a58be26184c2a23f80b410e0997ef1bd5d578 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Fri, 1 May 2015 16:40:44 +0300 +Subject: [PATCH 2/5] EAP-pwd server: Fix payload length validation for Commit + and Confirm + +The length of the received Commit and Confirm message payloads was not +checked before reading them. This could result in a buffer read +overflow when processing an invalid message. + +Fix this by verifying that the payload is of expected length before +processing it. In addition, enforce correct state transition sequence to +make sure there is no unexpected behavior if receiving a Commit/Confirm +message before the previous exchanges have been completed. + +Thanks to Kostya Kortchinsky of Google security team for discovering and +reporting this issue. + +Signed-off-by: Jouni Malinen +--- + src/eap_server/eap_server_pwd.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c +index 66bd5d2..3189105 100644 +--- a/src/eap_server/eap_server_pwd.c ++++ b/src/eap_server/eap_server_pwd.c +@@ -656,9 +656,21 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data, + BIGNUM *x = NULL, *y = NULL, *cofactor = NULL; + EC_POINT *K = NULL, *point = NULL; + int res = 0; ++ size_t prime_len, order_len; + + wpa_printf(MSG_DEBUG, "EAP-pwd: Received commit response"); + ++ prime_len = BN_num_bytes(data->grp->prime); ++ order_len = BN_num_bytes(data->grp->order); ++ ++ if (payload_len != 2 * prime_len + order_len) { ++ wpa_printf(MSG_INFO, ++ "EAP-pwd: Unexpected Commit payload length %u (expected %u)", ++ (unsigned int) payload_len, ++ (unsigned int) (2 * prime_len + order_len)); ++ goto fin; ++ } ++ + if (((data->peer_scalar = BN_new()) == NULL) || + ((data->k = BN_new()) == NULL) || + ((cofactor = BN_new()) == NULL) || +@@ -774,6 +786,13 @@ eap_pwd_process_confirm_resp(struct eap_sm *sm, struct eap_pwd_data *data, + u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr; + int offset; + ++ if (payload_len != SHA256_MAC_LEN) { ++ wpa_printf(MSG_INFO, ++ "EAP-pwd: Unexpected Confirm payload length %u (expected %u)", ++ (unsigned int) payload_len, SHA256_MAC_LEN); ++ goto fin; ++ } ++ + /* build up the ciphersuite: group | random_function | prf */ + grp = htons(data->group_num); + ptr = (u8 *) &cs; +-- +1.9.1 + diff --git a/net-wireless/hostapd/files/2015-4/0003-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch b/net-wireless/hostapd/files/2015-4/0003-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch new file mode 100644 index 000000000000..4d2f9d8aefeb --- /dev/null +++ b/net-wireless/hostapd/files/2015-4/0003-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch @@ -0,0 +1,52 @@ +From 477c74395acd0123340457ba6f15ab345d42016e Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sat, 2 May 2015 19:23:04 +0300 +Subject: [PATCH 3/5] EAP-pwd peer: Fix Total-Length parsing for fragment + reassembly + +The remaining number of bytes in the message could be smaller than the +Total-Length field size, so the length needs to be explicitly checked +prior to reading the field and decrementing the len variable. This could +have resulted in the remaining length becoming negative and interpreted +as a huge positive integer. + +In addition, check that there is no already started fragment in progress +before allocating a new buffer for reassembling fragments. This avoid a +potential memory leak when processing invalid message. + +Signed-off-by: Jouni Malinen +--- + src/eap_peer/eap_pwd.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c +index a629437..1d2079b 100644 +--- a/src/eap_peer/eap_pwd.c ++++ b/src/eap_peer/eap_pwd.c +@@ -866,11 +866,23 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret, + * if it's the first fragment there'll be a length field + */ + if (EAP_PWD_GET_LENGTH_BIT(lm_exch)) { ++ if (len < 2) { ++ wpa_printf(MSG_DEBUG, ++ "EAP-pwd: Frame too short to contain Total-Length field"); ++ ret->ignore = TRUE; ++ return NULL; ++ } + tot_len = WPA_GET_BE16(pos); + wpa_printf(MSG_DEBUG, "EAP-pwd: Incoming fragments whose " + "total length = %d", tot_len); + if (tot_len > 15000) + return NULL; ++ if (data->inbuf) { ++ wpa_printf(MSG_DEBUG, ++ "EAP-pwd: Unexpected new fragment start when previous fragment is still in use"); ++ ret->ignore = TRUE; ++ return NULL; ++ } + data->inbuf = wpabuf_alloc(tot_len); + if (data->inbuf == NULL) { + wpa_printf(MSG_INFO, "Out of memory to buffer " +-- +1.9.1 + diff --git a/net-wireless/hostapd/files/2015-4/0004-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch b/net-wireless/hostapd/files/2015-4/0004-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch new file mode 100644 index 000000000000..7edef099eb59 --- /dev/null +++ b/net-wireless/hostapd/files/2015-4/0004-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch @@ -0,0 +1,50 @@ +From 3035cc2894e08319b905bd6561e8bddc8c2db9fa Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sat, 2 May 2015 19:26:06 +0300 +Subject: [PATCH 4/5] EAP-pwd server: Fix Total-Length parsing for fragment + reassembly + +The remaining number of bytes in the message could be smaller than the +Total-Length field size, so the length needs to be explicitly checked +prior to reading the field and decrementing the len variable. This could +have resulted in the remaining length becoming negative and interpreted +as a huge positive integer. + +In addition, check that there is no already started fragment in progress +before allocating a new buffer for reassembling fragments. This avoid a +potential memory leak when processing invalid message. + +Signed-off-by: Jouni Malinen +--- + src/eap_server/eap_server_pwd.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c +index 3189105..2bfc3c2 100644 +--- a/src/eap_server/eap_server_pwd.c ++++ b/src/eap_server/eap_server_pwd.c +@@ -942,11 +942,21 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv, + * the first fragment has a total length + */ + if (EAP_PWD_GET_LENGTH_BIT(lm_exch)) { ++ if (len < 2) { ++ wpa_printf(MSG_DEBUG, ++ "EAP-pwd: Frame too short to contain Total-Length field"); ++ return; ++ } + tot_len = WPA_GET_BE16(pos); + wpa_printf(MSG_DEBUG, "EAP-pwd: Incoming fragments, total " + "length = %d", tot_len); + if (tot_len > 15000) + return; ++ if (data->inbuf) { ++ wpa_printf(MSG_DEBUG, ++ "EAP-pwd: Unexpected new fragment start when previous fragment is still in use"); ++ return; ++ } + data->inbuf = wpabuf_alloc(tot_len); + if (data->inbuf == NULL) { + wpa_printf(MSG_INFO, "EAP-pwd: Out of memory to " +-- +1.9.1 + diff --git a/net-wireless/hostapd/files/2015-4/0005-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch b/net-wireless/hostapd/files/2015-4/0005-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch new file mode 100644 index 000000000000..a601323f14da --- /dev/null +++ b/net-wireless/hostapd/files/2015-4/0005-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch @@ -0,0 +1,32 @@ +From 28a069a545b06b99eb55ad53f63f2c99e65a98f6 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sat, 2 May 2015 19:26:28 +0300 +Subject: [PATCH 5/5] EAP-pwd peer: Fix asymmetric fragmentation behavior + +The L (Length) and M (More) flags needs to be cleared before deciding +whether the locally generated response requires fragmentation. This +fixes an issue where these flags from the server could have been invalid +for the following message. In some cases, this could have resulted in +triggering the wpabuf security check that would terminate the process +due to invalid buffer allocation. + +Signed-off-by: Jouni Malinen +--- + src/eap_peer/eap_pwd.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c +index 1d2079b..e58b13a 100644 +--- a/src/eap_peer/eap_pwd.c ++++ b/src/eap_peer/eap_pwd.c +@@ -968,6 +968,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret, + /* + * we have output! Do we need to fragment it? + */ ++ lm_exch = EAP_PWD_GET_EXCHANGE(lm_exch); + len = wpabuf_len(data->outbuf); + if ((len + EAP_PWD_HDR_SIZE) > data->mtu) { + resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD, data->mtu, +-- +1.9.1 + diff --git a/net-wireless/hostapd/hostapd-2.4.ebuild b/net-wireless/hostapd/hostapd-2.4-r1.ebuild similarity index 90% rename from net-wireless/hostapd/hostapd-2.4.ebuild rename to net-wireless/hostapd/hostapd-2.4-r1.ebuild index f1ecb4ef15c9..f8ff714f196f 100644 --- a/net-wireless/hostapd/hostapd-2.4.ebuild +++ b/net-wireless/hostapd/hostapd-2.4-r1.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-wireless/hostapd/hostapd-2.4.ebuild,v 1.1 2015/03/21 13:19:27 gurligebis Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-wireless/hostapd/hostapd-2.4-r1.ebuild,v 1.1 2015/05/08 18:14:59 gurligebis Exp $ EAPI="4" @@ -28,6 +28,17 @@ RDEPEND="${DEPEND}" S="${S}/${PN}" src_prepare() { + cd .. + + # bug (548744) + epatch "${FILESDIR}/2015-4/0001-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch" + epatch "${FILESDIR}/2015-4/0002-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch" + epatch "${FILESDIR}/2015-4/0003-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch" + epatch "${FILESDIR}/2015-4/0004-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch" + epatch "${FILESDIR}/2015-4/0005-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch" + + cd "${PN}" + epatch "${FILESDIR}/${PN}-hlr_auc_gw-openssl.patch" sed -i -e "s:/etc/hostapd:/etc/hostapd/hostapd:g" \ -- 2.26.2