fix: support 32KB page sizes in ESE parser for Windows Server 2025 - #2270
Open
juliosuas wants to merge 1 commit into
Open
fix: support 32KB page sizes in ESE parser for Windows Server 2025#2270juliosuas wants to merge 1 commit into
juliosuas wants to merge 1 commit into
Conversation
Windows Server 2025 uses 32KB (32768 byte) database pages in NTDS.dit instead of the previous 8KB (8192 byte) pages. The ESE parser's getTag() method crashed with 'IndexError: bytearray index out of range' when processing these larger pages. Root cause: For large pages (>8KB) with format revision >= 17, the page tag flags are stored in the upper 3 bits of the first 16-bit value of the entry data itself (not in the tag entry). The code accessed tmpData[1] unconditionally, but when valueSize is 0 (empty entries like leaf/branch page headers with no common key), tmpData is an empty bytearray, causing the IndexError. Fix: Add bounds checking before accessing tmpData[1]: - valueSize >= 2: extract flags from tmpData[1] as before (normal path) - valueSize == 1: set flags to 0, return single byte as-is - valueSize == 0: set flags to 0, return empty bytes (was crashing) This preserves backward compatibility with 8KB pages (the else branch is unchanged) and follows the ESE format specification from libyal. Fixes fortra#1924
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.
Summary
Fixes #1924 —
secretsdump.pycrashes withIndexError: bytearray index out of rangewhen parsing NTDS.dit files from Windows Server 2025.Root Cause
Windows Server 2025 uses 32KB (32768 byte) database pages in NTDS.dit, up from the previous 8KB (8192 byte) pages. The ESE format specification (revision 0x11+) defines a different page tag format for pages larger than 8KB:
The existing code in
getTag()correctly handles this format except whenvalueSizeis 0 (empty entries, such as leaf/branch page headers with no common key). In that case,tmpDatais an empty bytearray andtmpData[1]raisesIndexError.The Fix
Added bounds checking before accessing
tmpData[1]in the large-page code path:valueSizetmpData[1] >> 5(existing logic, unchanged)The 8KB page code path (the
elsebranch) is completely unchanged, preserving backward compatibility.References
Testing
Restored after an accidental fork deletion. Same commits as #2165.