mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2025-01-08 06:08:01 -05:00
af360bc9ea
wgetc873988898
.patch -O telecomm-01.patch wget0fb5786dbf
.patch -O mediaprovider-01.patch wget1a4b9ef510
.patch -O wifi-01.patch wget364a1d9962
.patch -O bluetooth-01.patch wget87a06448b9
.patch -O settings-01.patch wgetaaba724a68
.patch -O settings-02.patch wget507304e1f5
.patch -O native-01.patch wget89489ff5dd
.patch -O base-01.patch wgetd1765c4715
.patch -O base-02.patch wgetcbb1a0ecd6
.patch -O base-03.patch wget4725772c0b
.patch -O base-04.patch wget19747f6923
.patch -O base-05.patch wgete7a1aa9ed0
.patch -O base-06.patch wget922a7860b1
.patch -O base-07.patch wgeted183ed912
.patch -O base-08.patch wgetc6fbe1330a
.patch -O base-09.patch wget9141cac175
.patch -O base-10.patch wget41235bcc67
.patch -O av-01.patch wgeta89f704701
.patch -O av-02.patch wget6d7cd80d77
.patch -O av-03.patch wget75fc175a08
.patch -O av-04.patch wgetb023ec300f
.patch -O av-05.patch wgetc8117d1539
.patch -O av-06.patch wgetf06d23d824
.patch -O av-07.patch wget9c7408ab07
.patch -O av-08.patch wgetcfbfcefb3c
.patch -O launcher-01.patch wget4a27a7f162
.patch -O libxml-01.patch Signed-off-by: Tad <tad@spotco.us>
97 lines
5.0 KiB
Diff
97 lines
5.0 KiB
Diff
From 1a4b9ef510410a8d8c90e80352357f08c49f10c5 Mon Sep 17 00:00:00 2001
|
|
From: Oscar Shu <xshu@google.com>
|
|
Date: Fri, 7 Jul 2023 02:21:41 +0000
|
|
Subject: [PATCH] Update password check for WAPI
|
|
|
|
Do not allow arbitrarily large passwords.
|
|
|
|
Bug: 275339978
|
|
|
|
Test: compile
|
|
(cherry picked from commit 38707fb4ff1405663cc24affc95244f4cc830499)
|
|
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:36deae20de1a8905e6cc72764e449b2d6e469f9e)
|
|
Merged-In: I15f3aff373af56c253a50c308d886a7acf661e59
|
|
Change-Id: I15f3aff373af56c253a50c308d886a7acf661e59
|
|
---
|
|
.../server/wifi/WifiConfigurationUtil.java | 22 +++++++++++++------
|
|
.../wifi/WifiConfigurationUtilTest.java | 3 ++-
|
|
2 files changed, 17 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/service/java/com/android/server/wifi/WifiConfigurationUtil.java b/service/java/com/android/server/wifi/WifiConfigurationUtil.java
|
|
index 9e8b660374..40837ff703 100644
|
|
--- a/service/java/com/android/server/wifi/WifiConfigurationUtil.java
|
|
+++ b/service/java/com/android/server/wifi/WifiConfigurationUtil.java
|
|
@@ -467,7 +467,8 @@ private static boolean validateBssid(String bssid) {
|
|
return true;
|
|
}
|
|
|
|
- private static boolean validatePassword(String password, boolean isAdd, boolean isSae) {
|
|
+ private static boolean validatePassword(String password, boolean isAdd, boolean isSae,
|
|
+ boolean isWapi) {
|
|
if (isAdd) {
|
|
if (password == null) {
|
|
Log.e(TAG, "validatePassword: null string");
|
|
@@ -509,7 +510,14 @@ private static boolean validatePassword(String password, boolean isAdd, boolean
|
|
}
|
|
} else {
|
|
// HEX PSK string
|
|
- if (password.length() != PSK_SAE_HEX_LEN) {
|
|
+ if (isWapi) {
|
|
+ // Protect system against malicious actors injecting arbitrarily large passwords.
|
|
+ if (password.length() > 100) {
|
|
+ Log.e(TAG, "validatePassword failed: WAPI hex string too long: "
|
|
+ + password.length());
|
|
+ return false;
|
|
+ }
|
|
+ } else if (password.length() != PSK_SAE_HEX_LEN) {
|
|
Log.e(TAG, "validatePassword failed: hex string size mismatch: "
|
|
+ password.length());
|
|
return false;
|
|
@@ -713,15 +721,15 @@ public static boolean validate(WifiConfiguration config, long supportedFeatureSe
|
|
return false;
|
|
}
|
|
if (config.isSecurityType(WifiConfiguration.SECURITY_TYPE_PSK)
|
|
- && !validatePassword(config.preSharedKey, isAdd, false)) {
|
|
+ && !validatePassword(config.preSharedKey, isAdd, false, false)) {
|
|
return false;
|
|
}
|
|
if (config.isSecurityType(WifiConfiguration.SECURITY_TYPE_SAE)
|
|
- && !validatePassword(config.preSharedKey, isAdd, true)) {
|
|
+ && !validatePassword(config.preSharedKey, isAdd, true, false)) {
|
|
return false;
|
|
}
|
|
if (config.isSecurityType(WifiConfiguration.SECURITY_TYPE_WAPI_PSK)
|
|
- && !validatePassword(config.preSharedKey, isAdd, false)) {
|
|
+ && !validatePassword(config.preSharedKey, isAdd, false, true)) {
|
|
return false;
|
|
}
|
|
if (config.isSecurityType(WifiConfiguration.SECURITY_TYPE_DPP)
|
|
@@ -880,11 +888,11 @@ public static boolean validateNetworkSpecifier(WifiNetworkSpecifier specifier) {
|
|
return false;
|
|
}
|
|
if (config.isSecurityType(WifiConfiguration.SECURITY_TYPE_PSK)
|
|
- && !validatePassword(config.preSharedKey, true, false)) {
|
|
+ && !validatePassword(config.preSharedKey, true, false, false)) {
|
|
return false;
|
|
}
|
|
if (config.isSecurityType(WifiConfiguration.SECURITY_TYPE_SAE)
|
|
- && !validatePassword(config.preSharedKey, true, true)) {
|
|
+ && !validatePassword(config.preSharedKey, true, true, false)) {
|
|
return false;
|
|
}
|
|
// TBD: Validate some enterprise params as well in the future here.
|
|
diff --git a/service/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java b/service/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
|
|
index 7cabcd873a..b505c0c0d3 100644
|
|
--- a/service/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
|
|
+++ b/service/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
|
|
@@ -466,7 +466,8 @@ public void testValidateNegativeCases_BadHexPskLengthWapi() {
|
|
assertTrue(WifiConfigurationUtil.validate(config, SUPPORTED_FEATURES_ALL,
|
|
WifiConfigurationUtil.VALIDATE_FOR_ADD));
|
|
|
|
- config.preSharedKey = "abcd123456788990013453445345465465476546";
|
|
+ config.preSharedKey = "01234567890123456789012345678901234567890123456789012345678901234567"
|
|
+ + "890123456789012345678901234567890";
|
|
assertFalse(WifiConfigurationUtil.validate(config, SUPPORTED_FEATURES_ALL,
|
|
WifiConfigurationUtil.VALIDATE_FOR_ADD));
|
|
config.preSharedKey = "";
|