MemProcFS icon indicating copy to clipboard operation
MemProcFS copied to clipboard

Committed memory not present in PTE?

Open wilhelmw201 opened this issue 2 years ago • 11 comments

Hi, I am trying to read something on 0x16a1cedeac8 which should be located on this heap 0x16a1ce64000 - 0x16a1cfd0000. Looking at the region in VMMap: VMMap But my read failed. I think it is because pte does not have this entry? Loading memprocfs gives

snippet of memmap/pte.txt

0078   7544     1760 0000016a1aea0000-0000016a1c5fffff -r--                                                                    
0079   7544      148 0000016a1d800000-0000016a1d947fff -r--  

snippet of memmap/vad.txt

0047   7544 ffffaa810e2dd2c0      171      16c 1 0000016a1ce60000-0000016a1cfd0fff       p-rw--                                                                 

I am using the livecloudkd plugin to read hyperv vm memory. However, dumping whole linear memory with livecloud and reading the resulted memory dump file does not work either. Other programs, which I assume use readprocessmemory, work fine. BTW i tried disabling pagefiles, the problem seems to persist.

Is there anything I should do? Maybe try leechagent first?

wilhelmw201 avatar Jul 26 '22 15:07 wilhelmw201

The PTE map is derived from hardware PTE entries that the CPU sees.

In this case there is probably no memory mapped at that virtual address. When the program reads it the kernel will page fault and dynamically add it (and update the non existing PTE entry) on the fly transparently.

You can check this more in detail in the VAD map and also the extended VAD map. Especially the extended VAD info in MemProcFS may contain interesting info about the state of the actual memory address.

You can try to read the specific memory. It may be that it's compressed by the Windows memory manager and MemProcFS will recover it. It may also be that it's paged out to disk in which case MemProcFS won't be able to read it.

In essence, Windows memory manager is really complex. I'm unable to say for sure whats the issue with your memory here. But check the vad-v info files. Also, it's not always Windows is very good at caring about the disabled page file, sometimes it seems to be used anyway.

Please let me know how it goes.

ufrisk avatar Jul 28 '22 15:07 ufrisk

The vad-d txt file of the corresponding address range is empty, also I tried pmem, it is also not reading the area. creating a dump via taskmgr, then reading the address range with memprocfs reads 0 length. using rpm to read address range (this yields data, not zeros), then reading the address range with memprocfs reads 0 length too :(

BTW i tried pmem, mostly same results it seems I can add a memory dump, but only if it is really something interesting

wilhelmw201 avatar Jul 28 '22 17:07 wilhelmw201

what happens if you use rpm to read the address range and then start memprocfs to read the range afterwards?

ufrisk avatar Jul 28 '22 17:07 ufrisk

I used this pymem package to read around a bit and started memprocfs, still the same, addresss range only shows up in vad and not in the vad-v or pte

wilhelmw201 avatar Jul 28 '22 19:07 wilhelmw201

Are you able to send me a full physical memory dump which contains this issue so that I may take a look?

The memory dump may contain sensitive information though, so don't send it if it belongs to some corporate computers and such.

ufrisk avatar Jul 28 '22 19:07 ufrisk

This should hopefully be fixed in the upcoming version that I plan to publish in the not too distant future. Huge thanks for your help on this one. I hope it will work, otherwise please let me know.

ufrisk avatar Aug 02 '22 19:08 ufrisk

Can you please check out it's working in the new version?

NB! The API has changed to this major release so if using it, it will requite some work adapting.

ufrisk avatar Aug 04 '22 06:08 ufrisk

Since I use the python api I guess I will have to wait until that is updated, currently I overwrite the vmmpyd.pyd along with the others in the old package, and it seems to stop working altogether :/

wilhelmw201 avatar Aug 04 '22 17:08 wilhelmw201

I'm sorry about that. I actually forgot about the Python packages this morning. They should be updated now. You may need to update both the memprocfs and leechcorepyc packages.

Please let me know how it goes.

ufrisk avatar Aug 04 '22 20:08 ufrisk

looks like this problem does not exist with the new version anymore. thank you again for the great project❤️

wilhelmw201 avatar Aug 04 '22 23:08 wilhelmw201

The same issue seems to still exist but only very rarely, I finally caught it in action and made another memory dump for you to take a look (if you would 😄), but i use significantly less memory in the VM environment now, with pagefile and memory compress and whatnot activated, so it could be something else, I guess?

wilhelmw201 avatar Sep 07 '22 14:09 wilhelmw201

Was this issue resolved? Or did I somehow miss it? Please let me know.

ufrisk avatar Apr 15 '23 18:04 ufrisk