Import scanners read resolved addresses as names when the import name table is missing
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 62/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- cpp
- Domain
- desktop-dev, reverse-engineering
Research direction
Start with the import walk in clean/rr_f/proxy/src/hook_dll.cpp around lines 849-861, where names come from OriginalFirstThunk with a FirstThunk fallback, then check the same pattern in clean/rr_f/proxy/src/setupapi_identity.cpp near line 390. The proposed fix is to skip a descriptor whose OriginalFirstThunk is zero and log once. Done means a synthetic PE64 test with a zero OriginalFirstThunk asserts nothing is patched and nothing faults, and the scanner must first be exported or compiled into the test.
Written by the indexing model from the issue text.
Description
This was found by reading the code. It has not been reproduced.
What happens
The import scanner in clean/rr_f/proxy/src/hook_dll.cpp:853-861 reads names from OriginalFirstThunk, and falls back to FirstThunk when it is zero. It then dereferences base + names->u1.AddressOfData as an IMAGE_IMPORT_BY_NAME. At run time FirstThunk holds resolved absolute addresses. The ordinal check passes (the top bit is clear for user-mode addresses). The result is base + address, which is unmapped, so the read faults.
The scanner runs on every loaded module (hook_dll.cpp:1105-1115). Only descriptors whose DLL name equals the interface file name reach the walk (hook_dll.cpp:849). There is no __try around do_hook.
The same fallback and interpretation is in clean/rr_f/proxy/src/setupapi_identity.cpp:390. That scanner only runs for Spider-Man2.exe.
When it can happen
Only for a module that imports the game interface (or, for the SetupAPI scanner, a Spider-Man2.exe that imports SetupAPI) and was linked or packed without an import name table. Current MSVC and LLVM x64 linkers always emit one. This is old-Borland or packer territory. No known RR game qualifies. Low severity: a crash at load if it ever occurs.
To do
- In both scanners:
if (!OriginalFirstThunk) { log once; continue; }. - Optionally bounds-check each name RVA against
SizeOfImage. - Caution: none in practice. A module without an import name table is simply not patched, and that is logged.
Test
CPU-only. Build a synthetic in-memory PE64 image: DOS and NT headers, one import descriptor naming the interface, OriginalFirstThunk = 0, FirstThunk filled with a real function address. Call the scanner (it needs to be exported to the test or compiled into it). Assert nothing is patched and nothing crashes.
- Dominant language
- C++
- Stars
- 12
- Forks
- 2
- Avg merge
- 3h 10m
- Merged PRs (30d)
- 171
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
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.
More from phantoslayer21/wronggpu
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
phantoslayer21/wronggpu#275 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
phantoslayer21/wronggpu#274 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
phantoslayer21/wronggpu#241 ·
Maintainers usually reply within 1 day
-
bug build
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
phantoslayer21/wronggpu#234 ·
Maintainers usually reply within 1 day
-
bug build
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
phantoslayer21/wronggpu#233 ·
Maintainers usually reply within 1 day
All issues in phantoslayer21/wronggpu
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
ReyeMe/SaturnRingLib#155 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Nheko-Reborn/nheko#2092 ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
isocpp/CppCoreGuidelines#2345 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 71/100
ROCm/rocm-libraries#16108 ·
Maintainers usually reply within 2 days