Fixed parsing of 32KiB page ESE databases from Windows Server 2025#79
Open
takker-hero-se wants to merge 1 commit intolibyal:mainfrom
Open
Fixed parsing of 32KiB page ESE databases from Windows Server 2025#79takker-hero-se wants to merge 1 commit intolibyal:mainfrom
takker-hero-se wants to merge 1 commit intolibyal:mainfrom
Conversation
Windows Server 2025 introduced optional 32KiB ESE database pages. This fixes two issues that prevented libesedb from parsing such databases: 1. 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 number of page tags. Masked the reserved bits when page_size >= 32768. 2. The leaf page backward and forward walk functions did not validate the IS_LEAF page flag. In 32KiB databases some pages in the leaf chain may not be actual leaf pages. Added IS_LEAF check with proper error handling.
Author
CI failure analysisThe 2 failed jobs ( Both fail with: This is a shared library path issue in the CI environment, not an API incompatibility. This PR only modifies internal page parsing logic in Additionally, The remaining 21/23 jobs (including all C compilation and test jobs) pass successfully. |
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.
Fixes #78
Summary
Windows Server 2025 introduced optional 32KiB ESE database pages for Active Directory (NTDS.dit). This PR fixes two issues that prevented libesedb from parsing such databases.
Changes
1. Page tag count mask (
libesedb_page_header.c, +9 lines)In the 32KiB page format, the
available_page_tagfield (uint16) uses a new layout:ctagReserved(reserved, must be masked out)Without masking, libesedb reads all 16 bits as the tag count, inflating the value and causing out-of-bounds page tag reads.
Fix:
page_header->available_page_tag &= 0x0fffwhenio_handle->page_size >= 32768.2. Leaf page validation in B-tree walk (
libesedb_page_tree.c, +45 lines)The backward walk in
libesedb_page_tree_get_get_first_leaf_page_number()and forward walk inlibesedb_page_tree_get_number_of_leaf_values()did not check whether each page in the leaf chain is actually a leaf page. In 32KiB databases, some pages referenced in the chain may be zeroed or non-leaf pages, causing errors or incorrect record counts.Fix: Check
LIBESEDB_PAGE_FLAG_IS_LEAFbefore processing each page. Added properlibcerror_error_set()error handling for thelibesedb_page_get_flags()calls.Testing
Tested with real Active Directory NTDS.dit databases:
No regression on 8KiB page databases.
References