Vector35 / Vector35/binaryninja-api
Type propagation for partial registers needs to be improved.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
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.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- reverse-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100