Harden dbgutil Windows PE export walk against corrupted or incomplete module data#131363
Open
hoyosjs wants to merge 1 commit into
Open
Harden dbgutil Windows PE export walk against corrupted or incomplete module data#131363hoyosjs wants to merge 1 commit into
hoyosjs wants to merge 1 commit into
Conversation
The Windows-host PE export-directory walk in dbgutil's `TryGetSymbol` parses an image's export table using data read from an `ICorDebugDataTarget`. All of that data must be treated as untrusted: it can come from a corrupt/unmapped data in the target process. Zero out the initial value defensively, be defensive about modules with no export directory to about interpretting data that's not present, and ensure there's enough ordinal exports to support the request.
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the Windows PE export-directory parsing in dbgutil’s TryGetSymbol when reading PE data from an ICorDebugDataTarget, to better tolerate missing/corrupt/unmapped target memory and avoid unsafe interpretation of untrusted image metadata.
Changes:
- Initializes the output address defensively and avoids walking exports when the export-directory RVA is zero.
- Adds validation that a named export’s ordinal is within the export address table bounds before using it.
- Fixes a spelling error in a comment.
Comment on lines
447
to
451
| TryGetSymbol(ICorDebugDataTarget* dataTarget, uint64_t baseAddress, const char* symbolName, uint64_t* symbolAddress) | ||
| { | ||
| *symbolAddress = 0; | ||
|
|
||
| DWORD exportTableRva; |
hoyosjs
enabled auto-merge (squash)
July 25, 2026 05:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Windows-host PE export-directory walk in dbgutil's
TryGetSymbolparses an image's export table using data read from anICorDebugDataTarget. All of that data must be treated as untrusted: it can come from a corrupt/unmapped data in the target process.Zero out the initial value defensively, be defensive about modules with no export directory to about interpretting data that's not present, and ensure there's enough ordinal exports to support the request.