-
Notifications
You must be signed in to change notification settings - Fork 198
Additional rules to support capa-scripts. #603
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: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,17 @@ | ||||||
| rule: | ||||||
| meta: | ||||||
| name: execute SQL commands | ||||||
| namespace: collection/database/sql | ||||||
| authors: | ||||||
| - adam.storek@mandiant.com | ||||||
| scope: function | ||||||
| att&ck: | ||||||
| - Collection::Data from Information Repositories [T1213] | ||||||
| examples: | ||||||
| - 6f3261eaaabf369bd928d179641b73ffd768184dfd4e00124da462a3075d4239.aspx_ | ||||||
| features: | ||||||
| - and: | ||||||
| - api: "System.Data.SqlClient.SqlConnection" | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| - api: "System.Data.SqlClient.SqlConnection::Open" | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| - api: "System.Data.SqlClient.SqlCommand" | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| - api: "System.Data.SqlClient.SqlCommand::ExecuteReader" | ||||||
|
Comment on lines
+14
to
+17
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've got questions here we can address offline.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| rule: | ||
| meta: | ||
| name: decode data using Base64 | ||
| namespace: data-manipulation/encoding/base64 | ||
| authors: | ||
| - adam.storek@mandiant.com | ||
| scope: function | ||
| att&ck: | ||
| - Defense Evasion::Deobfuscate/Decode Files or Information [T1140] | ||
| examples: | ||
| - 10162feb5f063ea09c6a3d275f31abf0fe8a9e4e36fded0053b1f8e054da8161.aspx_ | ||
| features: | ||
| - and: | ||
| - api: System.Convert::FromBase64String |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||
| rule: | ||||||
| meta: | ||||||
| name: decrypt data using AES | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to be consistent with following rule |
||||||
| namespace: data-manipulation/encryption/aes | ||||||
| authors: | ||||||
| - adam.storek@mandiant.com | ||||||
| scope: function | ||||||
| att&ck: | ||||||
| - Defense Evasion::Deobfuscate/Decode Files or Information [T1140] | ||||||
| mbc: | ||||||
| - Cryptography::Decrypt Data::AES [C0031.001] | ||||||
| examples: | ||||||
| - 1f8f4054932ed1d5d055e9a92aa1e2abba49af3370506674cb1b2c70146ae81a.aspx_ | ||||||
| features: | ||||||
| - or: | ||||||
| - and: | ||||||
| - api: System.Security.Cryptography.RijndaelManaged | ||||||
| - api: System.Security.Cryptography.RijndaelManaged::CreateDecryptor | ||||||
| - or: | ||||||
| - api: System.Security.Cryptography.Rijndael::Create | ||||||
| - and: | ||||||
| - api: System.Security.Cryptography.Rijndael | ||||||
| - api: System.Security.Cryptography.Rijndael::CreateDecryptor | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,5 @@ rule: | |
| - number: 0x8003 = CALG_MD5 | ||
| - api: advapi32.CryptCreateHash | ||
| - and: | ||
| - format: dotnet | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| - api: System.Security.Cryptography.MD5::Create | ||
| - api: System.Security.Cryptography.HashAlgorithm::ComputeHash | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,7 @@ rule: | |||||
| namespace: data-manipulation/hashing/sha1 | ||||||
| authors: | ||||||
| - moritz.raabe@mandiant.com | ||||||
| - adam.storek@mandiant.com | ||||||
| scope: function | ||||||
| mbc: | ||||||
| - Cryptography::Cryptographic Hash::SHA1 [C0029.002] | ||||||
|
|
@@ -22,3 +23,7 @@ rule: | |||||
| - and: | ||||||
| - number: 0x8004 = CALG_SHA1 | ||||||
| - api: advapi32.CryptCreateHash | ||||||
| - or: | ||||||
| - api: "System.Security.Cryptography.SHA1" | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| - api: "System.Security.Cryptography.SHA1CryptoServiceProvider" | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| - api: "System.Security.Cryptography.SHA1CryptoServiceProvider.ComputeHash" | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,13 +4,15 @@ rule: | |
| namespace: host-interaction/process/create | ||
| authors: | ||
| - moritz.raabe@mandiant.com | ||
| scope: basic block | ||
| - adam.storek@mandiant.com | ||
| scope: function | ||
| mbc: | ||
| - Process::Create Process [C0017] | ||
| examples: | ||
| - 9324D1A8AE37A36AE560C37448C9705A:0x406DB0 | ||
| - Practical Malware Analysis Lab 01-04.exe_:0x4011FC | ||
| - 692f7fd6d198e804d6af98eb9e390d61:0x6000003 | ||
| - 03bb5cab46b406bb8613ca6e32991ab3e10b5cd759d5c7813191e9e62868ea73.aspx_ | ||
| features: | ||
| - or: | ||
| - api: kernel32.WinExec | ||
|
|
@@ -29,3 +31,12 @@ rule: | |
| - api: ntdll.ZwCreateUserProcess | ||
| - api: ntdll.RtlCreateUserProcess | ||
| - api: System.Diagnostics.Process::Start | ||
| - and: | ||
| - or: | ||
| - and: | ||
| - api: System.Diagnostics.ProcessStartInfo | ||
| - property: System.Diagnostics.ProcessStartInfo::FileName | ||
| - and: | ||
| - api: System.Diagnostics.Process | ||
| - property: System.Diagnostics.Process.StartInfo::FileName | ||
| - api: System.Diagnostics.Process::Start | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,11 +4,13 @@ rule: | |
| namespace: load-code/powershell/ | ||
| authors: | ||
| - anamaria.martinezgom@mandiant.com | ||
| - adam.storek@mandiant.com | ||
| scope: function | ||
| att&ck: | ||
| - Execution::Command and Scripting Interpreter::PowerShell [T1059.001] | ||
| examples: | ||
| - 692f7fd6d198e804d6af98eb9e390d61:0x6000004 | ||
| - 4f6fa6a45017397c7e1c9cd5a17235ccb1ff0f5087dfa6b7384552bf507e7fe1.aspx_ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so cool, that this just works :) |
||
| features: | ||
| - and: | ||
| - or: | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,16 @@ rule: | |||||
| namespace: data-manipulation/encryption/rsa | ||||||
| authors: | ||||||
| - michael.hunhoff@mandiant.com | ||||||
| - adam.storek@mandiant.com | ||||||
| scope: function | ||||||
| att&ck: | ||||||
| - Defense Evasion::Obfuscated Files or Information [T1027] | ||||||
| mbc: | ||||||
| - Defense Evasion::Obfuscated Files or Information::Encryption-Standard Algorithm [E1027.m05] | ||||||
| - Cryptography::Encrypt Data::RSA [C0027.011] | ||||||
| examples: | ||||||
| - d460cae7d34c51059ef57c5aadb3de099469efbac5fffcf76d0528a511192a28.aspx_ | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ...?! |
||||||
| features: | ||||||
| - or: | ||||||
| - and: | ||||||
| - api: "System.Security.Cryptography.RSACryptoServiceProvider" | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| - api: System.Security.Cryptography.RSACryptoServiceProvider::Encrypt | ||||||
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?