Open joente opened 2 years ago
It seems that some negotiation need to take place to get a SmartEnum:
For some reason I don't get this to work by using the impacket library but I did work on an isolated library: aiowmi which can make both standard and optimized queries.
If you want to fix this in the impacket library, some fix is required to make the negotiation work and also it will require a way to handle the IWbemWCOSmartEnum::Next protocol which only send the class part once and needs to be re-used for the other items.
Configuration
impacket version: v0.9.24 (same error in v0.9.25) Python version: 3.8.12 Target OS: Linux
Debug Output With Command String
i.e.
wmiquery domain/user:password@192.168.56.101
Note that the exception above is not relevant for this issue
PCAP
Part of the HEAP:
In the capture above, you can see a lot of "zero" data is transferred across the network. When executing the same query using for example
wmic
, we see much less data. Somehow the wmic library manages to get a smaller heap with only the relevant data while impacket received a heap with all "missing" properties as zero values. Is their a way to exclude the zero values and reduce the network traffic?This happens for example with a query like:
SELECT Name FROM Win32_OperatingSystem
. The size of the resulting network package is equal to the querySELECT * FROM Win32_OperatingSystem