Skip to content
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

Update WMIC Discovery Rule + New System Discovery Rules For MacOS #4615

Merged
merged 52 commits into from
Dec 21, 2023

Conversation

jstnk9
Copy link
Contributor

@jstnk9 jstnk9 commented Dec 5, 2023

Summary of the Pull Request

I have been doing some research through VT corpus identifying WMIC executions. I have identified that this rule is not working correctly on some occasions due to the use of upper or lower case on the command line and the order of the attributes :)

I haven't worked much with the "re" module. Please, if you think it is not necessary to do so, no problem, but I think that something similar even without using "re" could be interesting.

See this example: https://www.virustotal.com/gui/file/2de5f5fd4fc61f049f1227b65fd17b5fd480b79d3e55aec8c790717b39dd17a7/behavior

I have the following command line

C:\Windows\System32\wbem\WMIC.exe wmic os get Version

That command wasn't identified because the logic of the rule includes the following

- 'OS get Caption,OSArchitecture,Version'

In this case, is looking for a specific set of attributes followed Caption,OSArchitecture,Version. Sometimes threat actors just want to discover version for example.


Also added new MAC rules related to potential information discovery using utilities such as sw_vers and ioreg as well as a generic rule for detection base64 encoded content inside of images being decoded on the fly

Changelog

new: System Information Discovery Using Ioreg
new: System Information Discovery Using sw_vers
new: Potential Base64 Decoded From Images
new: System Information Discovery Via Wmic.EXE
update: Uncommon System Information Discovery Via Wmic.EXE - Updated logic to focus on more specific WMIC query sequence to increase the level and added a related rule to cover the missing gaps in d85ecdd7-b855-4e6e-af59-d9c78b5b861e

jstnk9 and others added 30 commits November 18, 2022 15:10
File and Directory Discovery title modified with sufix
UAC Bypass via Event Viewer title modified
Titles modified
Update title
@github-actions github-actions bot added Rules Windows Pull request add/update windows related rules labels Dec 5, 2023
@nasbench nasbench self-requested a review December 5, 2023 11:11
@nasbench
Copy link
Member

nasbench commented Dec 5, 2023

Hey @jstnk9 thanks for this update.

A little bit of history regarding this rule. As discussed here, here and here the strict order was known to produce blindspots but was used in fear of FPs as while this is used for recon its wasn't going to warrant a medium if used in a non strict manner (without correlation at least).

What I suggest since you found this in the wild abuse. Is to keep your update as a low version rule and keep the old one with other variation that are more common now we have a little bit more data.

As a side note in sigma we assume the backend is case insensitive so a contains with a list like this

CommandLine|contains:
    - Example1
    - Example2
    - Example3
    ....

Would do the trick.

I will apply the update and you can check it out for additional comments or if you have feedback on this please let me know.

@nasbench nasbench added the Work In Progress Some changes are needed label Dec 5, 2023
@nasbench nasbench self-assigned this Dec 5, 2023
@jstnk9
Copy link
Contributor Author

jstnk9 commented Dec 5, 2023

Thank you @nasbench for your comments! I will add the variation to the sigma rule that was already created.

On the other hand, I think that I have accidentally added three sigma rules for MacOS in this same pull request, I wanted to do it in a different one but everything went the same way xDD

@nasbench
Copy link
Member

nasbench commented Dec 5, 2023

No worries man. Thanks for the updates, i'll check em in a bit

@nasbench nasbench added the MacOS Pull request add/update macos related rules label Dec 5, 2023
@jstnk9
Copy link
Contributor Author

jstnk9 commented Dec 5, 2023

Let me know if you need any specific examples or samples. I have tried to be as descriptive as possible and add samples in the references that have the described behaviors :)

@nasbench nasbench removed the Work In Progress Some changes are needed label Dec 20, 2023
@nasbench
Copy link
Member

Thanks once again for the submission @jstnk9

Made a couple of changes that i'll explain below.

  • I split the WMIC rule as discussed. I refocused the old one on "specific" query sequence and added your version as a low level for now but has all variations that are interesting. So it should provide some neat results on VT (for hunting).
  • I made some changes to the ioreg focused rule. I removed the grep and other flags to make it more generic. Imo this doesn't affect the quality as it still a medium one but now it'll find more stuff that perhaps use different shells or commands and flags (let me know if you disagree)
  • I added some extra image extensions to the Potential Base64 Decoded From Images rule for increased coverage.

Cheers

@nasbench nasbench added the 2nd Review Needed PR need a second approval label Dec 20, 2023
@nasbench nasbench requested a review from phantinuss December 20, 2023 11:23
@nasbench nasbench changed the title Potential System Information Discovery Via Wmic.EXE update Update WMIC Discovery Rule + New System Discovery Rules For MacOS Dec 20, 2023
@jstnk9
Copy link
Contributor Author

jstnk9 commented Dec 20, 2023

Everything looks good for me man. Appreciate your time reviewing it. I have extra rules that I'll send next days/weeks.

Have a nice day dude!

@nasbench nasbench removed the 2nd Review Needed PR need a second approval label Dec 21, 2023
@nasbench nasbench merged commit 3bb3b9c into SigmaHQ:master Dec 21, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MacOS Pull request add/update macos related rules Rules Windows Pull request add/update windows related rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants