-
Notifications
You must be signed in to change notification settings - Fork 71
cim: Fix: Search all namespaces for WMI consumer bindings and filters #1383
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
base: main
Are you sure you want to change the base?
Conversation
Modify CimPlugin.consumerbindings() to search all CIM namespaces instead of only the 'subscription' namespace for __FilterToConsumerBinding and __EventFilter classes. This allows detection of WMI persistence mechanisms created in non-default namespaces. - Remove hardcoded subscription namespace reference - Add unit tests with mocks and integration test with real CIM sample - Include test data with real CIM sample containing non-default namespace persistence This change ensures comprehensive detection of WMI event subscriptions across the entire CIM database.
| for binding in ns.class_("__filtertoconsumerbinding").instances: | ||
| yield ( | ||
| ns.query(binding.properties["Consumer"].value), | ||
| get_filter_name(binding), | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either GitHub is showing it weirdly or there's too much indentation here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put these in tests/plugins/os/windows/test_cim.py?
|
|
||
|
|
||
| @pytest.fixture | ||
| def real_sample_cim(tmp_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use a similar method to how the current test uses test data, instead of using a zip file? Feel free to move the existing test data to e.g. tests/_data/plugins/os/windows/cim/default and put yours in tests/_data/plugins/os/windows/cim/other_namespaces or something.
Remove the Zip file to have raw files on disk directly available.
|
Hello @Schamper, your comments have been applied and pushed. Thanks for your feedback! |
|
@nbareil thank you for your contribution! As this is your first code contribution, please read the following Contributor License Agreement (CLA). If you agree with the CLA, please reply with the following information:
Contributor License Agreement
Contribution License AgreementThis Contribution License Agreement ("Agreement") governs your Contribution(s) (as defined below) and conveys certain license rights to Fox-IT B.V. ("Fox-IT") for your Contribution(s) to Fox-IT"s open source Dissect project. This Agreement covers any and all Contributions that you ("You" or "Your"), now or in the future, Submit (as defined below) to this project. This Agreement is between Fox-IT B.V. and You and takes effect when you click an “I Accept” button, check box presented with these terms, otherwise accept these terms or, if earlier, when You Submit a Contribution.
|
Modify CimPlugin.consumerbindings() to search all CIM namespaces instead of only the 'subscription' namespace for __FilterToConsumerBinding and __EventFilter classes. This allows detection of WMI persistence mechanisms created in non-default namespaces.
This change ensures comprehensive detection of WMI event subscriptions.
Closes #1382