Informative Information for the Uninformed | ||||||||||||||
|
||||||||||||||
Next: Hijacking the Dynamic Loader
Up: Differences in Relocation Processing
Previous: Integer Overflows in Size
Consistent Handling of Fixup TypesApplications that process relocation fixups may also differ in their level of support for different types of fixups. While most binaries today use the HIGHLOW fixup exclusively, there are still quite a few other types of fixups that can be applied. If differences in the way relocation fixups are processed can be identified, it may be possible to create a binary that relocates correctly in one application but not in another application. The following code demonstrates an example of this type of test:
static VOID TestConsistentRelocations( __in PPE_IMAGE Image, __in PRELOC_FUZZ_CONTEXT FuzzContext) { PRELOCATION_BLOCK_CONTEXT Block = AllocateRelocationBlockContext(16); ULONG Rva = FuzzContext->BaseRelocationSection->VirtualAddress; INT Index; PrependRelocationBlockContext( FuzzContext, Block); Block->Rva = 0x1000; for (Index = 0; Index < 16; Index++) { // // Skip invalid fixup types // if ((Index >= 6 && Index <= 8) || (Index >= 0xb && Index <= 0x10)) continue; Block->Fixups[Index] = (Index << 12) | Index; } } This test works by prepending a relocation block that contains a relocation fixup for each different valid fixup type. This results in a relocation block that looks something like this:
BASE RELOCATIONS #4 1000 RVA, 28 SizeOfBlock 0 ABS 1 HIGH EC8B 2 LOW 8BEC 3 HIGHLOW 5008458B 4 HIGHADJ 0845 (5005) 0 ABS 0 ABS 0 ABS 9 IMM64 A DIR64 8000209C15FF8000 0 ABS 0 ABS 0 ABS 0 ABS 0 ABS The results for this test are shown below:
|