redballoonsecurity / redballoonsecurity/ofrak

ElfPointerArraySectionAddModifier modifications do not propogate to children view (ElfVirtualAddress)

Open
#87 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
2.1k
Forks
156
PR merge metrics
No merged PRs in 30d

Description

What is the problem? (Here is where you provide a complete Traceback.)
The following test, when added to TestElfPointerArraySectionModifier (from #71 ), fails.

    async def test_elf_pointer_array_section_modifier_virtual_address(self, elf_resource: Resource):
        """
        Test that `ElfPointerArraySectionModifier` results in updates to the children
        `ElfVirtualAddress`.
        """
        pointer_array_section = await self._unpack_and_get_first_pointer_array_section(elf_resource)
        original_values = list(await pointer_array_section.get_entries())

        await pointer_array_section.resource.run(
            ElfPointerArraySectionAddModifier,
            ElfPointerArraySectionAddModifierConfig(skip_list=(), add_value=self.add_value),
        )
        updated_pointer_array_section = await pointer_array_section.resource.view_as(
            ElfPointerArraySection
        )

        for i, entry in enumerate(await updated_pointer_array_section.get_entries()):
            assert entry.value - self.add_value == original_values[i].value

This test appears to fail because the ElfVirtualAddress.value is not updated when the section's entries are retrieved after ElfPointerArraySectionAddModifier is run.

Please provide some information about your environment.
At minimum we would like the following information on your platform and Python environment:
This was first observed when running the make image container on #71.

If you've discovered it, what is the root cause of the problem?
This could possibly be related to the way in which ElfPointerArraySectionAddModifier is implemented: it does not iterate over its children, but rather modifies its own data directly.

How often does the issue happen?
Every time the above-referenced test is run

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the failing test in TestElfPointerArraySectionModifier: test_elf_pointer_array_section_modifier_virtual_address. Read ElfPointerArraySectionAddModifier, ElfPointerArraySectionAddModifierConfig, ElfPointerArraySection, and ElfVirtualAddress to trace how entries and child values are retrieved. Done means the test passes and each updated entry value reflects add_value relative to its original value.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.