[WMI] Add defender module - #1386
Conversation
Ported from wmiexec-Pro (https://github.com/XiaoliChan/wmiexec-Pro). Supports check / disable / enable / exclude / remove actions over the smb and wmi protocols against the root/Microsoft/Windows/Defender namespace. Method invocation (disable/enable/exclude/remove) relies on kwargs-style WMI method calling - only supplied InParams are sent, unspecified ones are marked null via NdTable, preserving existing configuration. This requires the impacket wmi-Call branch (pending upstream PR). disable/enable verify the resulting state and warn when settings did not change: on some systems (e.g. Windows 11 as local admin, Tamper Protection) disable/enable is blocked while exclusions still work. Verified against Server 2019 with Cortex XDR present: all actions tested over both smb and wmi protocols, exclusions confirmed added and removed via check.
|
It looks like the PR template may not have been filled out. The following sections appear to be missing:
Please edit your PR description to include them. The template helps reviewers understand and test your changes. Thanks! |
|
Thanks for the PR, crazy that this is possible tho😅 |
System running 2022 may not work with disable/enable, but add/remove exclusion works XD |
What about 2025 and Win 10/11? |
Haven’t test it, I only have server 2019 in my ENV 🫠 |
Description
Ported from wmiexec-Pro (https://github.com/XiaoliChan/wmiexec-Pro). Supports check / disable / enable / exclude / remove actions over the smb and wmi protocols against the class
MSFT_MpPreferenceinroot/Microsoft/Windows/Defendernamespace.Method invocation (disable/enable/exclude/remove) relies on kwargs-style WMI method calling - only supplied InParams are sent, unspecified ones are marked null via NdTable, preserving existing configuration. This requires the impacket
wmi-Callbranch (pending upstream PR fortra/impacket#2272).Disable/enable verify the resulting state and warns when settings did not change: on some systems (e.g. Windows 11 as local admin, Tamper Protection), disable/enable is blocked while exclusions still work.
Verified against Server 2019 with Cortex XDR present: all actions tested over both smb and wmi protocols, exclusions confirmed added and removed via check.
Type of change
Setup guide for the review
Screenshots (if appropriate):
Target System: Server 2019
Enable/Disable
Checklist:
poetry run ruff check ., use--fixto automatically fix what it can)tests/e2e_commands.txtfile if necessary (new modules or features are required to be added to the e2e tests)