aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-11-01 18:24:16 +0200
committerDan Pasanen <dan.pasanen@gmail.com>2015-11-11 07:49:16 -0600
commitc69b9d150fc53cd0f34279cb152ad946e93cc000 (patch)
tree0d4e03fa73fce306b014b8b0d95c845ec1f28165
parent6a51515fb0bd5da09e8865c2d9d33e4518437438 (diff)
downloadandroid_external_wpa_supplicant_8-c69b9d150fc53cd0f34279cb152ad946e93cc000.tar.gz
android_external_wpa_supplicant_8-c69b9d150fc53cd0f34279cb152ad946e93cc000.tar.bz2
android_external_wpa_supplicant_8-c69b9d150fc53cd0f34279cb152ad946e93cc000.zip
EAP-pwd server: Fix last fragment length validation
All but the last fragment had their length checked against the remaining room in the reassembly buffer. This allowed a suitably constructed last fragment frame to try to add extra data that would go beyond the buffer. The length validation code in wpabuf_put_data() prevents an actual buffer write overflow from occurring, but this results in process termination. (CVE-2015-5314) Change-Id: I84bd2c3993a88f87fba71854b37671411bc2a651 Signed-off-by: Jouni Malinen <j@w1.fi>
-rw-r--r--src/eap_server/eap_server_pwd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
index 9bb7e01d..ed3e2b08 100644
--- a/src/eap_server/eap_server_pwd.c
+++ b/src/eap_server/eap_server_pwd.c
@@ -947,7 +947,7 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
/*
* the first and all intermediate fragments have the M bit set
*/
- if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
+ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
if ((data->in_frag_pos + len) > wpabuf_size(data->inbuf)) {
wpa_printf(MSG_DEBUG, "EAP-pwd: Buffer overflow "
"attack detected! (%d+%d > %d)",
@@ -958,6 +958,8 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
}
wpabuf_put_data(data->inbuf, pos, len);
data->in_frag_pos += len;
+ }
+ if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
wpa_printf(MSG_DEBUG, "EAP-pwd: Got a %d byte fragment",
(int) len);
return;
@@ -967,8 +969,6 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
* buffering fragments so that's how we know it's the last)
*/
if (data->in_frag_pos) {
- wpabuf_put_data(data->inbuf, pos, len);
- data->in_frag_pos += len;
pos = wpabuf_head_u8(data->inbuf);
len = data->in_frag_pos;
wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",