HexHive / HexHive/retrowrite

[BUG] RetroWrite omits data sections

Open
#38 0 comments 0 reactions 0 assignees View on GitHub
analysis-needed bug
Dominant language
Python
Stars
750
Forks
87
PR merge metrics
No merged PRs in 30d

Description

Description:
RetroWrite did not create data sections, like .data.rel.ro.local, .fini.array
As a result, RetroWrite not only recover certain relocation information,
but also emit incorrect assembly code.

My test program has relocation information in .data.rel.ro.local
```bash
$ readelf -r hello | grep .data.rel.ro.local -A 20
Relocation section '.rela.data.rel.ro.local' at offset 0x9a3d8 contains 165 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000020360 000100000001 R_X86_64_64 0000000000003c90 .text + 26a0
000000020368 000100000001 R_X86_64_64 0000000000003c90 .text + 2d60
000000020370 000100000001 R_X86_64_64 0000000000003c90 .text + 26b0
000000020378 000100000001 R_X86_64_64 0000000000003c90 .text + 2e20
...
```

Its binary code refers .data.rel.ro.local section.

- Disassembly code
```
61ec: 48 8d 05 6d a1 01 00 lea 0x1a16d(%rip),%rax # 20360
```

However, RetroWrite emited weird assembly code.

- Reassembled code
```
.LC61ec:
leaq 41984+.LC15f60(%rip), %rax
```

I examined the reassembly file and found that RetroWrite did not create .data.rel.ro.local section.

I hope to fix the errors.

Thanks.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the provided hello binary and run readelf -r hello, focusing on the .rela.data.rel.ro.local relocation section and the shown disassembly. Inspect the reassembly file to trace how .data.rel.ro.local and related data sections are represented; done means those sections are created and the resulting assembly preserves the referenced relocation data.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
reverse-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.