Binja incorrectly translating ILP32 tailcall pattern
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- cpp
- Ambito
- reverse-engineering
Direzione di ricerca
Start in arch/arm64/il.cpp at LoadStoreOperand and inspect how the AArch64 IL handles the 32-bit load into w17 followed by a jump through x17. Reproduce with the attached binary in Binja, navigate to strtoul in .plt, and confirm the 0x401dcc jump is translated with x17 as a resolved constant rather than an incorrect tag.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug Description:
Binja incorrectly translating AArch64 ILP32 tailcall pattern as a result of 32-bit load into w17 and jump through x17.
00401dc0 uint32_t strtoul(char const* str, char** endptr, int32_t base)
00401dc0 adrp x16, getspnam
00401dc4 ldr w17, [x16, #0x10c] {strtoul}
00401dc8 add w16, w16, #0x10c {strtoul}
❓00401dcc br x17
Steps To Reproduce:
Please provide all steps required to reproduce the behavior:
- Open the attached binary in Binja 5.3.9025 or later
- Navigate to
strtoulin.plt - Observe the tag at
0x401dccon thejump(zx.q(*getaddrinfo))
Expected Behavior:
Translate correctly resulting in x17 being a resolved constant value
Binary:
victory spring enters valuably
Additional Information:
This hack allows the PLT branches to the extern region to work fine, but this isn't a good solution and I think we need to fix this in core.
diff --git a/arch/arm64/il.cpp b/arch/arm64/il.cpp
index f02cdd2d..ab6ff084 100644
--- a/arch/arm64/il.cpp
+++ b/arch/arm64/il.cpp
@@ -905,8 +905,11 @@ static void LoadStoreOperand(LowLevelILFunction& il, bool load,
ILSETREG_O(operand1, il.Operand(1, il.Load(load_store_sz, ILREG_O(operand2)))));
break;
case MEM_OFFSET:
- if (!load_store_sz)
- load_store_sz = REGSZ_O(operand1);
+ if ((operand1.reg[0] >= REG_W0 && operand1.reg[0] <= REG_WSP) || (operand1.reg[0] >= REG_S0 && operand1.reg[0] <= REG_S31))
+ {
+ BNRegisterInfo regInfo = il.GetArchitecture()->GetRegisterInfo(operand1.reg[0]);
+ operand1.reg[0] = (Register)regInfo.fullWidthRegister;
+ }
// operand1.reg = [operand2.reg + operand2.imm]
if (IMM_O(operand2) == 0)
- Lingua principale
- C++
- Stelle
- 1.3k
- Fork
- 298
- Merge medio
- 5g 5h
- PR unite (30g)
- 19
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Vector35/binaryninja-api
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
Vector35/binaryninja-api#8540 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
Vector35/binaryninja-api#8516 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
Vector35/binaryninja-api#8503 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
Vector35/binaryninja-api#8446 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
Vector35/binaryninja-api#8444 ·
Tutte le issue di Vector35/binaryninja-api
Issue simili
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 92/100
autowarefoundation/autoware_universe#13413 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
automated-analysis bug memory-safety
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
gazebosim/gz-sensors#662 · 1 commento ·