-
Notifications
You must be signed in to change notification settings - Fork 441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with querying virtual memory of vmmem #68
Comments
I think this is the main issue to solve here:
Unfortunately nowadays I am extremely busy (working almost non-stop to meet some close deadlines) and I cannot dedicate much time to this. Also I cannot reproduce it in my current environment. Is it something very urgent for you? Can you provide more details, including screenshots, that could help me in troubleshooting? As much details as possible, but mostly I am interested in:
I believe there will be some possibility to determine that we cannot read the workingset at all, and this is the direction of bugfixing here. |
I went with a check for whether the process name is vmmem. It's not an ideal solution, but at least it's not an urgent issue. I can try to see if I can diagnose the issue. I'll add more info as I find it |
ok, as a temporary workaround - maybe not the name of the process, because it can be spoofed. but the path to the image that is mapped. |
The error being returned by My access mask on the handle is 0x1410 (corresponding to Query information and VM read). Using process hacker's kernel driver, I was able to peek at the memory of As a side note, vmmem appears to be a process that mostly is used for representing the resources used by Hyper-V in running other VMs. I'm wondering if this is a result of the WinAPI not interacting well with virtualization yet... Also - https://devblogs.microsoft.com/oldnewthing/20180717-00/?p=99265 |
hmm, it seems a tough case, and it will need time and many tests to find a proper solution, which will not break other things at the same time. Maybe some redesigning of the workingset scan will be required. I will take care of this after I am done with my deadlines, but for now it unfortunately has to wait. |
Basing on what you wrote, and assuming things are the way I understood, I tried to make a workaround in a new branch: Please let me know if it works. You said:
Which error message is printed then? Isn't it this one? pe-sieve/utils/workingset_enum.cpp Lines 37 to 41 in a7bfff9
So, if as you said |
Oh, my bad, I saw that was the error message being issued, and my brain went The handle lying about its access may also have been a premature assumption I made. I'd seen it before when something I'd written was trying to read lsaiso, so I jumped to conclusions a bit here. After playing around a bit with the debugger, it looks like the
to
Sorry about the confusion! |
ok, maybe this will help then: |
That works! Thank you for fixing it so quickly! |
oh, no. I merged a wrong branch... just a moment... |
ok, should be fine now. I reworked some things, so please let me know if everything works fine. and feel free to close the issue after the passed tests. |
All good now! |
When scanning the vmmem process, it appears a valid handle is being granted, even though the handle doesn't have the access requested.
In
workingset_enum.cpp
, this is extremely problematic, since the entire usermode address space is enumerated. If theVirtualQuery
fails (and it does), thestart_va
is incremented by one page size and an error message is printed. While adequate for expected scenarios, this process of iterating the entire address space one page at a time, printing out an error with each page is extremely slow. For all intents and purposes, this is a scan that will never actually finish.Unfortunately, I don't think the trivial check of "is the process named vmmem" is a viable solution; what's to stop a piece of malware from calling itself vmmem?
While this is not specifically related to the problem here, it appears that this is also writing to standard error even in quiet mode rather than just reporting an error in the scan report.
The text was updated successfully, but these errors were encountered: