Vector35 / Vector35/binaryninja-api
Too liberal array access simplification
Nessuno ha ancora preso questa issue.
- Lingua principale
- C++
- Stelle
- 1.3k
- Fork
- 298
- Merge medio
- 5g 5h
- PR unite (30g)
- 19
Descrizione
From a user report:
Here is one sample that BN might having trouble to understand.
Binary Ninja 5.3:
9b02fe74 char const (*)[0x5] mcp_xorshift_prng_core()
9b02fe74 {
9b02fe74 int32_t r0 = sub_9b032194();
9b02fe90 char const (* result)[0x5] = 0xbec1b ^ r0 << 0xd ^ r0 >> 9;
9b02fe94 data_10000ac8 = result;
9b02fe96 return result;
9b02fe74 }
IDA:
unsigned int sub_9B02FE74()
{
unsigned int v0; // r0
unsigned int result; // r0
v0 = sub_9B032194();
result = (dword_10000AC8 << 7) & 0x3F807F80 ^ ((unsigned int)dword_10000AC8 >> 8) & 0xF80FF ^ (v0 << 13) ^ (v0 >> 9);
dword_10000AC8 = result;
return result;
}
Reference code:
static int _freertos_arc4random(void)
{
#if defined(CONFIG_PLATFORM_8721D)
int value = (int)Rand();
return value;
#else
u32 res = xTaskGetTickCount();
static unsigned long seed = 0xDEADB00B;
#if defined(CONFIG_PLATFORM_8711B)
if(random_seed){
seed = random_seed;
random_seed = 0;
}
#endif
seed = ((seed & 0x007F00FF) << 7) ^
((seed & 0x0F80FF00) >> 8) ^ // be sure to stir those low bits
(res << 13) ^ (res >> 9); // using the clock too!
return (int)seed;
#endif
}
Version and Platform (required):
- Binary Ninja Version: 5.3.9434, f7cf98e7
- OS: macos
- OS Version: 15.7.5
- CPU Architecture: arm64
File: thermal ice switches helpfully
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.
Direzione di ricerca
Start by reproducing the decompilation for the sample in thermal ice switches helpfully, then compare Binary Ninja's output with the reference _freertos_arc4random code and the IDA result. Trace the array-access simplification involved in the shown function; done means scalar bitwise operations are not over-simplified into an incorrect array-based expression.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- c, cpp
- Ambito
- compilers, reverse-engineering
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 45/100