aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_peer
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-11-01 18:18:17 +0200
committerAnjaneedevi Kapparapu <akappa@codeaurora.org>2015-12-02 23:47:08 +0530
commit703a1fef0170857775cc2cf07617fbff838a48b8 (patch)
treebf3ffaa69e5e459457975b692897a11a5a8f2148 /src/eap_peer
parentbfaff150fb44ca3c5672fdfa10ad1e6387bce687 (diff)
downloadandroid_external_wpa_supplicant_8-703a1fef0170857775cc2cf07617fbff838a48b8.tar.gz
android_external_wpa_supplicant_8-703a1fef0170857775cc2cf07617fbff838a48b8.tar.bz2
android_external_wpa_supplicant_8-703a1fef0170857775cc2cf07617fbff838a48b8.zip
EAP-pwd peer: 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-5315) Signed-off-by: Jouni Malinen <j@w1.fi> Git-commit: 8057821706784608b828e769ccefbced95591e50 Git-repo: git://w1.fi/srv/git/hostap.git Change-Id: I565a55bd5a672be60af5b11dac4e78aa421d4772 CRs-Fixed: 937515
Diffstat (limited to 'src/eap_peer')
-rw-r--r--src/eap_peer/eap_pwd.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
index 9b3d5c49..92bafee3 100644
--- a/src/eap_peer/eap_pwd.c
+++ b/src/eap_peer/eap_pwd.c
@@ -897,7 +897,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
/*
* buffer and ACK the fragment
*/
- if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
+ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
data->in_frag_pos += len;
if (data->in_frag_pos > wpabuf_size(data->inbuf)) {
wpa_printf(MSG_INFO, "EAP-pwd: Buffer overflow attack "
@@ -910,7 +910,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
return NULL;
}
wpabuf_put_data(data->inbuf, pos, len);
-
+ }
+ if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD,
EAP_PWD_HDR_SIZE,
EAP_CODE_RESPONSE, eap_get_id(reqData));
@@ -924,10 +925,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
* we're buffering and this is the last fragment
*/
if (data->in_frag_pos) {
- wpabuf_put_data(data->inbuf, pos, len);
wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
(int) len);
- data->in_frag_pos += len;
pos = wpabuf_head_u8(data->inbuf);
len = data->in_frag_pos;
}