Files cached as either ImageSectionObject or DataSectionObject can be dumped in the same way using the _CONTROL_AREA structure. However, we've found that when iterating through the _SUBSECTION values of the _CONTROL_AREA, the sector size for these is different. The current code uses a sector size of 0x200. This works for ImageSectionObjects as the subsections in the control area correspond to PE file sections that are then mapped into different sections in memory. For DataSectionObjects, this generally works as most files mapped as data use only one subsection. In cases where a DataSectionObject has more than one subsection, this sector size needs to be 0x1000. Info on subsections: https://www.linkedin.com/pulse/dissecting-windows-section-objects-artem-baranov/#:~:text=few%20words%20about-,Subsections,-Subsection%20(_SUBSECTION)%20is
As seen in the output below, this doesn't generally affect many files across a sample. The example surge_collect.exe file from the output shows the size of the output DataSectionObject file with the new sector_size more closely matches the ImageSectionObject file sizes. The difference in data between the two files also starts at a much later offset with the new sector_size and is really only different at the very end when comparing to the ImageSectionObject output.
To Reproduce
Just run dumpfiles on a Windows sample.
Example output
Here are the results of running dumpfiles before and after the change.
Describe the bug
Files cached as either ImageSectionObject or DataSectionObject can be dumped in the same way using the _CONTROL_AREA structure. However, we've found that when iterating through the _SUBSECTION values of the _CONTROL_AREA, the sector size for these is different. The current code uses a sector size of 0x200. This works for ImageSectionObjects as the subsections in the control area correspond to PE file sections that are then mapped into different sections in memory. For DataSectionObjects, this generally works as most files mapped as data use only one subsection. In cases where a DataSectionObject has more than one subsection, this sector size needs to be 0x1000. Info on subsections: https://www.linkedin.com/pulse/dissecting-windows-section-objects-artem-baranov/#:~:text=few%20words%20about-,Subsections,-Subsection%20(_SUBSECTION)%20is
As seen in the output below, this doesn't generally affect many files across a sample. The example surge_collect.exe file from the output shows the size of the output DataSectionObject file with the new sector_size more closely matches the ImageSectionObject file sizes. The difference in data between the two files also starts at a much later offset with the new sector_size and is really only different at the very end when comparing to the ImageSectionObject output.
To Reproduce Just run dumpfiles on a Windows sample.
Example output
Here are the results of running dumpfiles before and after the change.
Sample 1
Sample 2