Baruch Siach | f6c2e55 | 2016-05-03 09:40:19 +0300 | [diff] [blame] | 1 | From 73e4abb24a936014727924d8b0b2965edfc117dd Mon Sep 17 00:00:00 2001 |
| 2 | From: Jouni Malinen <jouni@qca.qualcomm.com> |
| 3 | Date: Fri, 4 Mar 2016 18:46:41 +0200 |
| 4 | Subject: [PATCH] Reject psk parameter set with invalid passphrase character |
| 5 | |
| 6 | WPA/WPA2-Personal passphrase is not allowed to include control |
| 7 | characters. Reject a passphrase configuration attempt if that passphrase |
| 8 | includes an invalid passphrase. |
| 9 | |
| 10 | This fixes an issue where wpa_supplicant could have updated the |
| 11 | configuration file psk parameter with arbitrary data from the control |
| 12 | interface or D-Bus interface. While those interfaces are supposed to be |
| 13 | accessible only for trusted users/applications, it may be possible that |
| 14 | an untrusted user has access to a management software component that |
| 15 | does not validate the passphrase value before passing it to |
| 16 | wpa_supplicant. |
| 17 | |
| 18 | This could allow such an untrusted user to inject up to 63 characters of |
| 19 | almost arbitrary data into the configuration file. Such configuration |
| 20 | file could result in wpa_supplicant trying to load a library (e.g., |
| 21 | opensc_engine_path, pkcs11_engine_path, pkcs11_module_path, |
| 22 | load_dynamic_eap) from user controlled location when starting again. |
| 23 | This would allow code from that library to be executed under the |
| 24 | wpa_supplicant process privileges. |
| 25 | |
| 26 | Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> |
| 27 | Signed-off-by: Baruch Siach <baruch@tkos.co.il> |
| 28 | --- |
| 29 | Patch status: upstream (73e4abb24a936014727924d8b0b2965edfc117dd) |
| 30 | |
| 31 | wpa_supplicant/config.c | 6 ++++++ |
| 32 | 1 file changed, 6 insertions(+) |
| 33 | |
| 34 | diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c |
| 35 | index b1c7870dafe0..fdd964356afa 100644 |
| 36 | --- a/wpa_supplicant/config.c |
| 37 | +++ b/wpa_supplicant/config.c |
| 38 | @@ -478,6 +478,12 @@ static int wpa_config_parse_psk(const struct parse_data *data, |
| 39 | } |
| 40 | wpa_hexdump_ascii_key(MSG_MSGDUMP, "PSK (ASCII passphrase)", |
| 41 | (u8 *) value, len); |
| 42 | + if (has_ctrl_char((u8 *) value, len)) { |
| 43 | + wpa_printf(MSG_ERROR, |
| 44 | + "Line %d: Invalid passphrase character", |
| 45 | + line); |
| 46 | + return -1; |
| 47 | + } |
| 48 | if (ssid->passphrase && os_strlen(ssid->passphrase) == len && |
| 49 | os_memcmp(ssid->passphrase, value, len) == 0) { |
| 50 | /* No change to the previously configured value */ |
| 51 | -- |
| 52 | 2.8.1 |
| 53 | |