-
Notifications
You must be signed in to change notification settings - Fork 164
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
Additional rules to support capa-scripts. #603
base: master
Are you sure you want to change the base?
Conversation
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.
great, thank you! I've left comments and suggestions for your review 🚀. I'm adding a "do not merge" tag for now as we won't be able to merge these rules until after the v4.0.0 release.
- api: "System.Data.SqlClient.SqlConnection" | ||
- api: "System.Data.SqlClient.SqlConnection::Open" | ||
- api: "System.Data.SqlClient.SqlCommand" | ||
- api: "System.Data.SqlClient.SqlCommand::ExecuteReader" |
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.
I've got questions here we can address offline.
- 6f3261eaaabf369bd928d179641b73ffd768184dfd4e00124da462a3075d4239.aspx_ | ||
features: | ||
- and: | ||
- api: "System.Data.SqlClient.SqlConnection" |
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.
- api: "System.Data.SqlClient.SqlConnection" | |
- api: System.Data.SqlClient.SqlConnection |
features: | ||
- and: | ||
- api: "System.Data.SqlClient.SqlConnection" | ||
- api: "System.Data.SqlClient.SqlConnection::Open" |
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.
- api: "System.Data.SqlClient.SqlConnection::Open" | |
- api: System.Data.SqlClient.SqlConnection::Open |
- and: | ||
- api: "System.Data.SqlClient.SqlConnection" | ||
- api: "System.Data.SqlClient.SqlConnection::Open" | ||
- api: "System.Data.SqlClient.SqlCommand" |
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.
- api: "System.Data.SqlClient.SqlCommand" | |
- api: System.Data.SqlClient.SqlCommand |
- api: "System.Data.SqlClient.SqlConnection" | ||
- api: "System.Data.SqlClient.SqlConnection::Open" | ||
- api: "System.Data.SqlClient.SqlCommand" | ||
- api: "System.Data.SqlClient.SqlCommand::ExecuteReader" |
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.
- api: "System.Data.SqlClient.SqlCommand::ExecuteReader" | |
- api: System.Data.SqlClient.SqlCommand::ExecuteReader |
- Defense Evasion::Obfuscated Files or Information::Encryption-Standard Algorithm [E1027.m05] | ||
- Cryptography::Encrypt Data::RSA [C0027.011] | ||
examples: | ||
- d460cae7d34c51059ef57c5aadb3de099469efbac5fffcf76d0528a511192a28.aspx_ |
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.
We can move this out of the nursery if we have a solid example.
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.
leads to the question if we expect a test case for binary and script and ...?!
- and: | ||
- api: System.Diagnostics.Process | ||
- property: System.Diagnostics.Process.StartInfo::FileName | ||
- api: System.Diagnostics.Process::Start |
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.
Need to add empty line at end of rule - be sure to run the rule linter to ensure formatting is correct.
@@ -22,3 +23,7 @@ rule: | |||
- and: | |||
- number: 0x8004 = CALG_SHA1 | |||
- api: advapi32.CryptCreateHash | |||
- or: | |||
- api: "System.Security.Cryptography.SHA1" |
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.
- api: "System.Security.Cryptography.SHA1" | |
- api: System.Security.Cryptography.SHA1 |
@@ -22,3 +23,7 @@ rule: | |||
- and: | |||
- number: 0x8004 = CALG_SHA1 | |||
- api: advapi32.CryptCreateHash | |||
- or: | |||
- api: "System.Security.Cryptography.SHA1" | |||
- api: "System.Security.Cryptography.SHA1CryptoServiceProvider" |
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.
- api: "System.Security.Cryptography.SHA1CryptoServiceProvider" | |
- api: System.Security.Cryptography.SHA1CryptoServiceProvider |
- or: | ||
- api: "System.Security.Cryptography.SHA1" | ||
- api: "System.Security.Cryptography.SHA1CryptoServiceProvider" | ||
- api: "System.Security.Cryptography.SHA1CryptoServiceProvider.ComputeHash" |
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.
- api: "System.Security.Cryptography.SHA1CryptoServiceProvider.ComputeHash" | |
- api: System.Security.Cryptography.SHA1CryptoServiceProvider.ComputeHash |
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.
great, please see my comments for further improvements
- and: | ||
- match: create process on Windows | ||
- or: | ||
- substring: "cmd.exe" | ||
- substring: "powershell.exe" |
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.
is this sufficient to identify a reverse shell?
@@ -0,0 +1,23 @@ | |||
rule: | |||
meta: | |||
name: decrypt data using AES |
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.
name: decrypt data using AES | |
name: decrypt data using AES via .NET |
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.
to be consistent with following rule
@@ -32,6 +32,5 @@ rule: | |||
- number: 0x8003 = CALG_MD5 | |||
- api: advapi32.CryptCreateHash | |||
- and: | |||
- format: dotnet |
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.
need to find a good solution for this, see mandiant/capa#1106 (reply in thread) and #601
scope: function | ||
att&ck: | ||
- Execution::Command and Scripting Interpreter::PowerShell [T1059.001] | ||
examples: | ||
- 692f7fd6d198e804d6af98eb9e390d61:0x6000004 | ||
- 4f6fa6a45017397c7e1c9cd5a17235ccb1ff0f5087dfa6b7384552bf507e7fe1.aspx_ |
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.
so cool, that this just works :)
- Defense Evasion::Obfuscated Files or Information::Encryption-Standard Algorithm [E1027.m05] | ||
- Cryptography::Encrypt Data::RSA [C0027.011] | ||
examples: | ||
- d460cae7d34c51059ef57c5aadb3de099469efbac5fffcf76d0528a511192a28.aspx_ |
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.
leads to the question if we expect a test case for binary and script and ...?!
I noticed that the current .NET rules missed a lot of functionality/API calls that the aspx test malware includes. I therefore modified the currently available rules and created new ones to fully leverage the capa-scripts extraction capabilities.