Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit 093df02

Browse files
14.1: July ASB picks
Signed-off-by: Tavi <[email protected]>
1 parent 1e2d7e9 commit 093df02

File tree

4 files changed

+117
-5
lines changed

4 files changed

+117
-5
lines changed

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Patches/
2222
[Everything Else] - Apache-2.0
2323
LineageOS-*/
2424
android_external_hardened_malloc/ - MIT
25+
android_packages_apps_CarrierConfig2/ - MIT
2526
android_kernel_*/ - GPL-2.0-only
2627
[Everything Else] - Apache-2.0
2728
Linux/ - See COPYING included (GPL-2.0-only)
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From e4ea22f79e2995c16f19b45925d4dd66f9813646 Mon Sep 17 00:00:00 2001
2+
From: Martijn Coenen <[email protected]>
3+
Date: Thu, 29 Feb 2024 12:03:05 +0000
4+
Subject: [PATCH] [BACKPORT] Verify UID of incoming Zygote connections.
5+
6+
Only the system UID should be allowed to connect to the Zygote. While
7+
for generic Zygotes this is also covered by SELinux policy, this is not
8+
true for App Zygotes: the preload code running in an app zygote could
9+
connect to another app zygote socket, if it had access to its (random)
10+
socket address.
11+
12+
On the Java layer, simply check the UID when the connection is made. In
13+
the native layer, this check was already present, but it actually didn't
14+
work in the case where we receive a new incoming connection on the
15+
socket, and receive a 'non-fork' command: in that case, we will simply
16+
exit the native loop, and let the Java layer handle the command, without
17+
any further UID checking.
18+
19+
Modified the native logic to drop new connections with a mismatching
20+
UID, and to keep serving the existing connection (if it was still
21+
there).
22+
23+
Bug: 319081336
24+
Test: manual
25+
(cherry picked from commit 2ffc7cb220e4220b7e108c4043a3f0f2a85b6508)
26+
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:e397fd3d20c3f409311e411387ec1524ccecf085)
27+
Merged-In: I3f85a17107849e2cd3e82d6ef15c90b9e2f26532
28+
Change-Id: I3f85a17107849e2cd3e82d6ef15c90b9e2f26532
29+
---
30+
core/java/com/android/internal/os/ZygoteConnection.java | 4 ++++
31+
1 file changed, 4 insertions(+)
32+
33+
diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
34+
index 85d84bb3f9867..40ab4839195bc 100644
35+
--- a/core/java/com/android/internal/os/ZygoteConnection.java
36+
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
37+
@@ -104,6 +104,10 @@ class ZygoteConnection {
38+
Log.e(TAG, "Cannot read peer credentials", ex);
39+
throw ex;
40+
}
41+
+
42+
+ if (peer.getUid() != Process.SYSTEM_UID) {
43+
+ throw new ZygoteSecurityException("Only system UID is allowed to connect to Zygote.");
44+
+ }
45+
}
46+
47+
/**
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
From 9dabeb4f8d2ab8936c84823786fab90d0e929ce3 Mon Sep 17 00:00:00 2001
2+
From: Brian Delwiche <[email protected]>
3+
Date: Mon, 22 Apr 2024 21:14:56 +0000
4+
Subject: [PATCH] [BACKPORT] Fix an authentication bypass bug in SMP
5+
6+
When pairing with BLE legacy pairing initiated
7+
from remote, authentication can be bypassed.
8+
This change fixes it.
9+
10+
Bug: 251514170
11+
Test: m com.android.btservices
12+
Test: manual run against PoC
13+
Ignore-AOSP-First: security
14+
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:8a3dbadc71428a30b172a74343be08498c656747)
15+
Merged-In: I66b1f9a80060f48a604001829db8ea7c96c7b7f8
16+
Change-Id: I66b1f9a80060f48a604001829db8ea7c96c7b7f8
17+
---
18+
stack/smp/smp_act.c | 11 +++++++++++
19+
stack/smp/smp_int.h | 1 +
20+
2 files changed, 12 insertions(+)
21+
22+
diff --git a/stack/smp/smp_act.c b/stack/smp/smp_act.c
23+
index 8702e109578..a9bcd4c87c2 100644
24+
--- a/stack/smp/smp_act.c
25+
+++ b/stack/smp/smp_act.c
26+
@@ -331,6 +331,7 @@ void smp_send_confirm(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
27+
{
28+
SMP_TRACE_DEBUG("%s", __func__);
29+
smp_send_cmd(SMP_OPCODE_CONFIRM, p_cb);
30+
+ p_cb->flags |= SMP_PAIR_FLAGS_CMD_CONFIRM_SENT;
31+
}
32+
33+
/*******************************************************************************
34+
@@ -704,6 +705,16 @@ void smp_proc_init(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
35+
return;
36+
}
37+
38+
+ if (!((p_cb->loc_auth_req & SMP_SC_SUPPORT_BIT) &&
39+
+ (p_cb->peer_auth_req & SMP_SC_SUPPORT_BIT)) &&
40+
+ !(p_cb->flags & SMP_PAIR_FLAGS_CMD_CONFIRM_SENT))
41+
+ {
42+
+ // in legacy pairing, the peer should send its rand after
43+
+ // we send our confirm
44+
+ smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
45+
+ return;
46+
+ }
47+
+
48+
/* save the SRand for comparison */
49+
STREAM_TO_ARRAY(p_cb->rrand, p, BT_OCTET16_LEN);
50+
}
51+
diff --git a/stack/smp/smp_int.h b/stack/smp/smp_int.h
52+
index aea85380edd..aac64ea2ef1 100644
53+
--- a/stack/smp/smp_int.h
54+
+++ b/stack/smp/smp_int.h
55+
@@ -251,6 +251,7 @@ typedef union
56+
#define SMP_PAIR_FLAG_HAVE_PEER_PUBL_KEY (1 << 6) /* used on slave to resolve race condition */
57+
#define SMP_PAIR_FLAG_HAVE_PEER_COMM (1 << 7) /* used to resolve race condition */
58+
#define SMP_PAIR_FLAG_HAVE_LOCAL_PUBL_KEY (1 << 8) /* used on slave to resolve race condition */
59+
+#define SMP_PAIR_FLAGS_CMD_CONFIRM_SENT (1 << 9)
60+
61+
/* check if authentication requirement need MITM protection */
62+
#define SMP_NO_MITM_REQUIRED(x) (((x) & SMP_AUTH_YN_BIT) == 0)

Scripts/LineageOS-14.1/Patch.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ sed -i '50i$(my_res_package): PRIVATE_AAPT_FLAGS += --auto-add-overlay' core/aap
8282
sed -i '296iLOCAL_AAPT_FLAGS += --auto-add-overlay' core/package_internal.mk;
8383
awk -i inplace '!/Email/' target/product/core.mk; #Remove Email
8484
awk -i inplace '!/Exchange2/' target/product/core.mk;
85-
sed -i 's/2021-06-05/2024-06-05/' core/version_defaults.mk; #Bump Security String #n-asb-2024-06 #XXX
85+
sed -i 's/2021-06-05/2024-07-05/' core/version_defaults.mk; #Bump Security String #n-asb-2024-07 #XXX
8686
fi;
8787

8888
if enterAndClear "device/qcom/sepolicy"; then
@@ -282,10 +282,11 @@ applyPatch "$DOS_PATCHES/android_frameworks_base/378956.patch"; #n-asb-2024-01 F
282282
applyPatch "$DOS_PATCHES/android_frameworks_base/385241.patch"; #n-asb-2024-03 Resolve custom printer icon boundary exploit.
283283
applyPatch "$DOS_PATCHES/android_frameworks_base/385242.patch"; #n-asb-2024-03 Close AccountManagerService.session after timeout.
284284
applyPatch "$DOS_PATCHES/android_frameworks_base/388831.patch"; #n-asb-2024-04 Fix security vulnerability that creates user with no restrictions when accountOptions are too long.
285-
applyPatch "$DOS_PATCHES/android_frameworks_base/393646.patch"; #n-asb-2024-05 Add more checkKeyIntent checks to AccountManagerService.
286-
applyPatch "$DOS_PATCHES/android_frameworks_base/393647.patch"; #n-asb-2024-05 Adds additional sanitization for Zygote command arguments.
287-
applyPatch "$DOS_PATCHES/android_frameworks_base/393648.patch"; #n-asb-2024-05 Check hidden API exemptions
288-
applyPatch "$DOS_PATCHES/android_frameworks_base/393649.patch"; #n-asb-2024-05 AccessibilityManagerService: remove uninstalled services from enabled list after service update.
285+
applyPatch "$DOS_PATCHES/android_frameworks_base/393646.patch"; #n-asb-2024-06 Add more checkKeyIntent checks to AccountManagerService.
286+
applyPatch "$DOS_PATCHES/android_frameworks_base/393647.patch"; #n-asb-2024-06 Adds additional sanitization for Zygote command arguments.
287+
applyPatch "$DOS_PATCHES/android_frameworks_base/393648.patch"; #n-asb-2024-06 Check hidden API exemptions
288+
applyPatch "$DOS_PATCHES/android_frameworks_base/393649.patch"; #n-asb-2024-06 AccessibilityManagerService: remove uninstalled services from enabled list after service update.
289+
applyPatch "$DOS_PATCHES/android_frameworks_base/396611.patch"; #n-asb-2024-07 Verify UID of incoming Zygote connections.
289290
git revert --no-edit 0326bb5e41219cf502727c3aa44ebf2daa19a5b3; #Re-enable doze on devices without gms
290291
applyPatch "$DOS_PATCHES/android_frameworks_base/248599.patch"; #Make SET_TIME_ZONE permission match SET_TIME (AOSP)
291292
applyPatch "$DOS_PATCHES/android_frameworks_base/0001-Reduced_Resolution.patch"; #Allow reducing resolution to save power TODO: Add 800x480 (DivestOS)
@@ -585,6 +586,7 @@ applyPatch "$DOS_PATCHES/android_system_bt/385236.patch"; #n-asb-2024-03 Fix OOB
585586
applyPatch "$DOS_PATCHES/android_system_bt/385237.patch"; #n-asb-2024-03 Fix an OOB bug in smp_proc_sec_req
586587
applyPatch "$DOS_PATCHES/android_system_bt/385238.patch"; #n-asb-2024-03 Fix an OOB write bug in attp_build_value_cmd
587588
applyPatch "$DOS_PATCHES/android_system_bt/385239.patch"; #n-asb-2024-03 Fix a security bypass issue in access_secure_service_from_temp_bond
589+
applyPatch "$DOS_PATCHES/android_system_bt/396612.patch"; #n-asb-2024-07 Fix an authentication bypass bug in SMP
588590
applyPatch "$DOS_PATCHES/android_system_bt/229574.patch"; #bt-sbc-hd-dualchannel-nougat: Increase maximum Bluetooth SBC codec bitrate for SBC HD (ValdikSS)
589591
applyPatch "$DOS_PATCHES/android_system_bt/229575.patch"; #bt-sbc-hd-dualchannel-nougat: Explicit SBC Dual Channel (SBC HD) support (ValdikSS)
590592
applyPatch "$DOS_PATCHES/android_system_bt/242134.patch"; #avrc_bld_get_attrs_rsp - fix attribute length position off by one (cprhokie)

0 commit comments

Comments
 (0)