fix: add Windows Server 2025 32KiB ESE page support#27
Open
takker-hero-se wants to merge 1 commit intosunsetkookaburra:mainfrom
Open
fix: add Windows Server 2025 32KiB ESE page support#27takker-hero-se wants to merge 1 commit intosunsetkookaburra:mainfrom
takker-hero-se wants to merge 1 commit intosunsetkookaburra:mainfrom
Conversation
Windows Server 2025 introduced 32KiB ESE database pages for Active Directory (NTDS.dit). This breaks libesedb parsing due to two issues: 1. Page tag count (itagState): In the 32KiB page format, the upper 4 bits of available_page_tag are reserved (ctagReserved) and only the lower 12 bits contain the actual tag count. libesedb reads all 16 bits, inflating the count and causing garbage offsets. 2. B-tree leaf page walk: Some pages in the leaf page chain may not actually be leaf pages (e.g. zeroed pages). The backward and forward walk functions do not validate the IS_LEAF flag, leading to errors. Patches follow libyal coding conventions. Tested with both 8KiB (WS2019) and 32KiB (WS2025) NTDS.dit databases.
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
Windows Server 2025 introduced optional 32KiB ESE database pages for Active Directory (
NTDS.dit). The current libesedb vendored source fails to parse these databases due to two issues in the C library. This PR adds two downstream patches to fix them.Patch 1:
fix-ws2025-itag-state.patch(libesedb_page_header.c)In the 32KiB page format, the
available_page_tagfield (uint16) has a new layout:ctagReserved(reserved, should be ignored)libesedb reads all 16 bits as the tag count, inflating the value and causing out-of-bounds reads / garbage data.
Fix: Mask with
& 0x0fffwhenpage_size >= 32768.Patch 2:
zzz-fix-ws2025-btree.patch(libesedb_page_tree.c)The B-tree leaf page walk (both backward in
get_get_first_leaf_page_numberand forward inget_number_of_leaf_values) does not validate theIS_LEAFpage flag. In 32KiB databases, some pages in the leaf chain may not be actual leaf pages (e.g. zeroed/reallocated pages), causing "not a leaf page" errors or incorrect record counts.Fix: Check
LIBESEDB_PAGE_FLAG_IS_LEAFbefore processing each page in both walk directions. Added variable declaration at function scope (C89) and properlibcerror_error_set()error handling.Testing
Tested with real Active Directory databases:
Notes
libcerror_error_set()error handling, C89 variable declarations)zzz-prefix on the B-tree patch ensures it applies afterqol-leaf_pages.patchReferences