Vector35 / Vector35/binaryninja-api

Type propagation for partial registers needs to be improved.

Offen
#3,975 7 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Core: MLIL Effort: Medium Impact: Low
Vorherrschende Sprache
C++
Sterne
1.3k
Forks
298
Ø Merge
5 T. 5 Std.
Gemergte PRs (30 T.)
19

Beschreibung

Hello,

What is the feature you'd like to have?
Binary ninja cannot detect/parse doubles in HLIL/PseudoC view if the binary is an ARM binary

Additional Information:

I want to report a decompilation incapability. I have realized this while solving a challenge from r0. Mirror download link

In this situation we have a 32 bit ARM binary. Anyone can run binary in Raspbian.

This binary has been initializing some doubles. Then uses them. I have realized that Binary Ninja HLIL and Pseudo C views cannot decompile the doubles in exact values:

Disassembly:

00008624  e13f8fe2   adr     r3, data_89b0
00008628  d020c3e1   ldrd    r2, r3, [r3]  {data_89b0}  {0x400921cac083126f}
0000862c  f4214be1   strd    r2, r3, [r11,  #-0x14] {var_18}
00008630  0e3d8fe2   adr     r3, data_89b8

Pseudo C

00008628      int32_t r2;
00008628      int32_t r3;
00008628      r3 = HIGHW(0x400921cac083126f);
00008628      r2 = LOWW(0x400921cac083126f);

Let's cross check this binary in IDA Pro:

Disassembly:

.text:00008624 ADR     R3, dword_89B0
.text:00008628 LDRD    R2, R3, [R3]
.text:0000862C STRD    R2, R3, [R11,#f1]
.text:00008630 ADR     R3, dword_89B8

Pseudo C

  double v20; // [sp+68h] [bp-1Ch]
  double v21; // [sp+70h] [bp-14h]
  int i; // [sp+7Ch] [bp-8h]

  v21 = 3.1415;
  v20 = 6.283;

BTW, I have extracted the pseudo c code and recompiled as x86, then check it through Binary Ninja:

Pseudo C

00001243      double var_58 = ((double)((long double)3.1415000000000002));
00001263      double var_48 = ((double)((long double)9.9000000000000004));
.
.
.
snip code
.
.
.
((long double)((double)((long double)6.2830000000000004)))

Final words

Binary Ninja have problems detecting/parsing doubles if the binary is an ARM binary, but can decompile/detect doubles if the binary is x86 binary

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Start by reproducing the reported ARM case from the linked r0 challenge binary and compare the shown LDRD/STRD disassembly with its HLIL and Pseudo C output. Done means the partial-register type propagation represents the initialized values as doubles with their exact values, rather than separate int32_t HIGHW/LOWW values.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp
Bereich
reverse-engineering
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.