Giter VIP home page Giter VIP logo

Comments (7)

joshfinley avatar joshfinley commented on May 12, 2024

I'm still experiencing issues with the PE parser on Syzygy Instrumenter 0.8.32.0 (190dbfe):

[1018/110110:ERROR:pe_file_parser.cc(1175)] Unknown version of the IMAGE_LOAD_CONFIG_DIRECTORY structure (160 bytes), might be because you're using a new version of the Windows SDK.
[1018/110110:ERROR:pe_file_parser.cc(381)] Failed to parse data directory load config.
[1018/110110:ERROR:decomposer.cc(1084)] Unable to parse PE image.

I've attempted retargeting to older SDK versions but without success.

from syzygy.

randomascii avatar randomascii commented on May 12, 2024

It is the C runtime which determines the size of the IMAGE_LOAD_CONFIG_DIRECTORY object. Chrome used to override this by declaring an object of the right size and type, but it no longer does (I removed that a few months ago).

You could use Chrome's hack of defining _load_config_used to specify a custom IMAGE_LOAD_CONFIG_DIRECTORY object. See crrev.com/c/1575870 for the change that removed it.

I did a verbose build of a test project and searched the output for _load_config_used and confirmed that this variable comes from the CRT:

1> Searching C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.23.28105\lib\x64\MSVCRTD.lib:
1> Found _load_config_used
1> Loaded MSVCRTD.lib(loadcfg.obj)

from syzygy.

joshfinley avatar joshfinley commented on May 12, 2024

Great, thank you!

Adding the custom IMAGE_LOAD_CONFIG_DIRECTORY object and adding the /SAFESEH linker option did the trick.

from syzygy.

joshfinley avatar joshfinley commented on May 12, 2024

Back again with another issue related to this structure. I ran into the same issue attempting to instrument a DLL. But after adding the custom IMAGE_LOAD_CONFIG_DIRECTORY structure this time the instrumenter is throwing a different error:

[1022/101414:INFO:pe_relinker.cc(57)] Decomposing module: C:\...\ChakraCore.dll
[1022/101419:ERROR:decomposer.cc(1825)] Received data symbol "_load_config_used" that extends past its parent block "Load Config Directory".
[1022/101419:ERROR:pe_relinker.cc(66)] Unable to decompose module: C:\Users\rtadmin\projects\fuzzing\targets\jscript\ChakraCore.dll
[1022/101419:ERROR:instrumenter_with_relinker.cc(124)] Failed to initialize relinker.

The structure looks like this:

Microsoft (R) COFF/PE Dumper Version 14.16.27034.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file ChakraCore.dll

File Type: DLL

  Section contains the following load config:

            00000048 size
                   0 time date stamp
                0.00 Version
                   0 GlobalFlags Clear
                   0 GlobalFlags Set
                   0 Critical Section Default Timeout
                   0 Decommit Free Block Threshold
              200000 Decommit Total Free Threshold
            00000000 Lock Prefix Table
                   0 Maximum Allocation Size
                   0 Virtual Memory Threshold
                   0 Process Heap Flags
                   0 Process Affinity Mask
                   0 CSD Version
                0000 Dependent Load Flag
            00000000 Edit List
            1055A004 Security Cookie
            1053BD60 Safe Exception Handler Table
                 444 Safe Exception Handler Count

    Safe Exception Handler Table

          Address
          --------
          10446895  __CatchGuardHandler
          1044692F  __TranslatorGuardHandler
          10446FB0  __except_handler4
          10448350
          10448E31
          10467798
          104677C8
          104677F8
          10467830
          10467850
          10467870
          10467890
          104678B0
          104678D8
          10467908
          10467938
          10467968
          ...
          10474470
          10474490
          104744B0
          104744D0
          104744F0
          10474510
          10474530
          10474558
          10474588
          104745B0
          104745D0
          104745F0
          10474618
          104746DA
          10474708
          10474740
          1047475B
          10474776

  Summary

      116000 .data
        1000 .didat
        1000 .mrdata
       E5000 .rdata
       35000 .reloc
       1C000 .rsrc
      474000 .text

Any insight on this would be much appreciated.

from syzygy.

randomascii avatar randomascii commented on May 12, 2024

Thanks for editing the output - 1,100 lines was a bit much.

Ultimately syzygy will need to support the new load config structures. I'm not sure what has gone wrong in this case - it sounds like your override of the symbol didn't work, or ??? I'm not sure anybody else is working on this but updating the load-config parser to handle the new fields seems like the right direction to go in.

from syzygy.

chhamilton avatar chhamilton commented on May 12, 2024

I would strongly suspect we're incorrectly parsing the load config directory. It changes with different compiler/linker version numbers, as can be seen with the parsing code here:

BlockGraph::Block* PEFileParser::ParseLoadConfigDir(

As Bruce points it, it should be updated to handle the new fields that have been added.

from syzygy.

sigurasg avatar sigurasg commented on May 12, 2024

from syzygy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.