Skip to content

Commit ec7e09f

Browse files
author
Jake Smith
authored
Merge pull request #259 from ION28/develop
Merge Develop to Master for v0.4.2-alpha
2 parents 14f81da + 4645db2 commit ec7e09f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1592
-906
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,22 @@ jobs:
2020
runs-on: windows-latest
2121

2222
steps:
23-
- uses: actions/checkout@v1
23+
- uses: actions/checkout@v2
2424

2525
- name: Setup NuGet.exe
2626
uses: warrenbuckley/Setup-Nuget@v1
2727

2828
- name: Update submodules
29-
run: git submodule update --init --recursive --remote
29+
run: git submodule update --init --recursive
30+
31+
- name: Install vcpkg
32+
shell: powershell
33+
run: |
34+
cd vcpkg
35+
.\bootstrap-vcpkg.bat
36+
.\vcpkg.exe install yara:${{ matrix.buildarch }}-windows-static
37+
.\vcpkg.exe integrate install
38+
cd ..
3039
3140
- name: Download NuGet packages
3241
run: nuget restore BLUESPAWN.sln
@@ -40,14 +49,6 @@ jobs:
4049
run: powershell set-executionpolicy Unrestricted
4150
shell: powershell
4251

43-
- name: Run Atomic Red Team Prep Script
44-
run: testing\run-atomic-prep.ps1
45-
shell: powershell
46-
47-
- name: Run Atomic Red Team Tests
48-
run: testing\run-atomic-tests.ps1
49-
shell: powershell
50-
5152
- name: Run BLUESPAWN Hunt
5253
run: artifacts\${{ matrix.buildarch }}\${{ matrix.buildtype }}\BLUESPAWN-client.exe --hunt -l Normal --log=xml --reaction=log
5354
shell: cmd
@@ -56,20 +57,11 @@ jobs:
5657
run: Get-ChildItem "bluespawn*.xml" | Rename-Item -NewName BLUESPAWNHuntResults.xml
5758
shell: powershell
5859

59-
- name: TESTS - Check BLUESPAWN Hunt Results against Atomic Red Team Results
60-
run: testing\run-hunt-results-comparison.ps1
61-
shell: powershell
62-
6360
- uses: actions/upload-artifact@master
6461
with:
6562
name: BLUESPAWN-client-${{ matrix.buildarch }}-${{ matrix.buildtype }}
6663
path: artifacts\${{ matrix.buildarch }}\${{ matrix.buildtype }}\BLUESPAWN-client.exe
6764

68-
- uses: actions/upload-artifact@master
69-
with:
70-
name: AtomicTestsResults-${{ matrix.buildarch }}-${{ matrix.buildtype }}.csv
71-
path: AtomicTestsResults.csv
72-
7365
- uses: actions/upload-artifact@master
7466
with:
7567
name: BLUESPAWNHuntResults-${{ matrix.buildarch }}-${{ matrix.buildtype }}.xml

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
build/
33
artifacts/
44
packages/
5+
vcpkg/
56
BLUESPAWN-client/external/
67
BLUESPAWN-client/resources/severe
78
BLUESPAWN-client/resources/indicators

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616
[submodule "BLUESPAWN-client/external/tinyxml2"]
1717
path = BLUESPAWN-client/external/tinyxml2
1818
url = https://github.com/leethomason/tinyxml2
19+
[submodule "vcpkg"]
20+
path = vcpkg
21+
url = https://github.com/Microsoft/vcpkg.git

BLUESPAWN-client/BLUESPAWN-client.vcxproj

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,6 @@
261261
<ProjectReference Include="..\BLUESPAWN-common\CommonLib.vcxproj">
262262
<Project>{25ae1d80-3e17-4e1d-bfb4-8afb375ebaf1}</Project>
263263
</ProjectReference>
264-
<ProjectReference Include="libyara.vcxproj">
265-
<Project>{e236ce39-d8f3-4db6-985c-f2794ff17746}</Project>
266-
</ProjectReference>
267264
<ProjectReference Include="pe-sieve.vcxproj">
268265
<Project>{bec01f8e-5892-3f6f-a741-5bbd1d0f4ef9}</Project>
269266
</ProjectReference>
@@ -280,16 +277,22 @@
280277
<Path>$(SolutionDir)build\$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName).log</Path>
281278
</BuildLog>
282279
<ClCompile>
283-
<AdditionalIncludeDirectories>$(SolutionDir)BLUESPAWN-client\external\yara\libyara\include;$(SolutionDir)BLUESPAWN-client\external\pe-sieve\include;$(SolutionDir)BLUESPAWN-client\external\krabsetw\krabs;$(SolutionDir)BLUESPAWN-client\external\cxxopts\include;$(SolutionDir)BLUESPAWN-client\external\boost;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
280+
<AdditionalIncludeDirectories>$(SolutionDir)BLUESPAWN-client\external\pe-sieve\include;$(SolutionDir)BLUESPAWN-client\external\cxxopts\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
281+
<RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MultiThreaded</RuntimeLibrary>
282+
<RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MultiThreaded</RuntimeLibrary>
283+
<RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MultiThreadedDebug</RuntimeLibrary>
284+
<RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">MultiThreadedDebug</RuntimeLibrary>
284285
</ClCompile>
285286
<Link>
286-
<AdditionalDependencies>Secur32.lib;DbgHelp.lib;Wintrust.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
287+
<AdditionalDependencies>Secur32.lib;DbgHelp.lib;Wintrust.lib;ws2_32.lib;Crypt32.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
287288
</Link>
288289
</ItemDefinitionGroup>
289290
<PropertyGroup Label="Globals">
290291
<ProjectGuid>{159B2E72-9553-4E17-9BEC-CB92FCA8D0B0}</ProjectGuid>
291292
<RootNamespace>CommonLib</RootNamespace>
292293
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
294+
<VcpkgTriplet Condition="'$(Platform)'=='Win32'">x86-windows-static</VcpkgTriplet>
295+
<VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows-static</VcpkgTriplet>
293296
</PropertyGroup>
294297
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
295298
<PropertyGroup Label="Configuration">

BLUESPAWN-client/external/yara

Submodule yara updated 105 files

BLUESPAWN-client/headers/hunt/RegistryHunt.h

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,35 +37,70 @@ namespace Registry {
3737

3838
extern REG_MULTI_SZ_CHECK CheckMultiSzSubset;
3939
extern REG_MULTI_SZ_CHECK CheckMultiSzExclusion;
40-
extern REG_MULTI_SZ_CHECK CheckMultiSzEmpty;
40+
extern REG_MULTI_SZ_CHECK CheckMultiSzEmpty;
4141

4242
/**
4343
* A container class for registry values and associated data.
4444
*/
4545
struct RegistryCheck {
46-
RegistryValue value;
47-
bool MissingBad;
46+
std::wstring name;
47+
48+
RegistryType type;
49+
RegistryData value;
50+
std::variant<REG_SZ_CHECK, REG_DWORD_CHECK, REG_BINARY_CHECK, REG_MULTI_SZ_CHECK> check;
4851

49-
REG_SZ_CHECK wCheck;
50-
REG_DWORD_CHECK dwCheck;
51-
REG_BINARY_CHECK lpCheck;
52-
REG_MULTI_SZ_CHECK vCheck;
52+
bool MissingBad;
5353

54-
RegistryCheck(const std::wstring& wValueName, RegistryType type, const std::wstring& wData, bool MissingBad = false,
55-
const REG_SZ_CHECK& check = CheckSzEqual);
56-
RegistryCheck(const std::wstring& wValueName, RegistryType type, const DWORD dwData, bool MissingBad = false,
57-
const REG_DWORD_CHECK& check = CheckDwordEqual);
58-
RegistryCheck(const std::wstring& wValueName, RegistryType type, const AllocationWrapper& lpData, bool MissingBad = false,
59-
const REG_BINARY_CHECK& check = CheckBinaryEqual);
60-
RegistryCheck(const std::wstring& wValueName, RegistryType type, const std::vector<std::wstring>& wData, bool MissingBad = false,
54+
RegistryCheck(std::wstring&& wValueName, std::wstring&& wData, bool MissingBad = false, const REG_SZ_CHECK& check = CheckSzEqual);
55+
RegistryCheck(std::wstring&& wValueName, DWORD&& dwData, bool MissingBad = false, const REG_DWORD_CHECK& check = CheckDwordEqual);
56+
RegistryCheck(std::wstring&& wValueName, AllocationWrapper&& lpData, bool MissingBad = false, const REG_BINARY_CHECK& check = CheckBinaryEqual);
57+
RegistryCheck(std::wstring&& wValueName, std::vector<std::wstring>&& wData, bool MissingBad = false,
6158
const REG_MULTI_SZ_CHECK& check = CheckMultiSzSubset);
6259

6360
RegistryType GetType() const;
61+
62+
bool operator()(const RegistryData& data) const;
6463
};
6564

66-
std::vector<RegistryValue> CheckValues(const RegistryKey& key, const std::vector<RegistryCheck>& values);
65+
/**
66+
* Checks the values under a certain key using the RegistryCheck class. if CheckWow64 is true, this will attempt to automatically redirect to the WoW64 version
67+
* of the key in addition to the 64-bit one. If CheckUsers is true, this will attempt to automatically check the same key under each user in addition to under
68+
* HKLM.
69+
*
70+
* @param hkHive The registry hive under which the path lies.
71+
* @param path The path to the specified key under the given hive. If CheckUsers is true, this will will also check the path under each user's account.
72+
* @param CheckWow64 If true, this will also check the wow64 version of the key, if one exists
73+
* @param CheckUsers If true, this will check for the path under all users' hives in addition to the given one
74+
*
75+
* @return A vector containing a RegistryValue object for each RegistryCheck that didn't match its valid conditions
76+
*/
77+
std::vector<RegistryValue> CheckValues(const HKEY& hkHive, const std::wstring& path, const std::vector<RegistryCheck>& values, bool CheckWow64 = true, bool CheckUsers = true);
6778

68-
std::vector<RegistryValue> CheckKeyValues(const RegistryKey& key);
79+
/**
80+
* Checks for any values under a certain key. if CheckWow64 is true, this will attempt to automatically redirect to the WoW64 version of the key
81+
* in addition to the 64-bit one. If CheckUsers is true, this will attempt to automatically check the same key under each user in addition to under
82+
* HKLM.
83+
*
84+
* @param hkHive The registry hive under which the path lies.
85+
* @param path The path to the specified key under the given hive. If CheckUsers is true, this will will also check the path under each user's account.
86+
* @param CheckWow64 If true, this will also check the wow64 version of the key, if one exists
87+
* @param CheckUsers If true, this will check for the path under all users' hives in addition to the given one
88+
*
89+
* @return A vector containing a RegistryValue object for each RegistryCheck that didn't match its valid conditions
90+
*/
91+
std::vector<RegistryValue> CheckKeyValues(const HKEY& hkHive, const std::wstring& path, bool CheckWow64 = true, bool CheckUsers = true);
6992

70-
std::vector<RegistryKey> CheckSubkeys(const RegistryKey& key);
93+
/**
94+
* Checks for any values under a certain key. if CheckWow64 is true, this will attempt to automatically redirect to the WoW64 version of the key
95+
* in addition to the 64-bit one. If CheckUsers is true, this will attempt to automatically check the same key under each user in addition to under
96+
* HKLM.
97+
*
98+
* @param hkHive The registry hive under which the path lies.
99+
* @param path The path to the specified key under the given hive. If CheckUsers is true, this will will also check the path under each user's account.
100+
* @param CheckWow64 If true, this will also check the wow64 version of the key, if one exists
101+
* @param CheckUsers If true, this will check for the path under all users' hives in addition to the given one
102+
*
103+
* @return A vector containing a RegistryValue object for each RegistryCheck that didn't match its valid conditions
104+
*/
105+
std::vector<RegistryKey> CheckSubkeys(const HKEY& hkHive, const std::wstring& path, bool CheckWow64 = true, bool CheckUsers = true);
71106
}

BLUESPAWN-client/headers/hunt/hunts/HuntT1015.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ namespace Hunts {
2020
std::wstring wsIFEO = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\";
2121
std::wstring wsIFEOWow64 = L"SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\";
2222

23-
int HuntT1015::EvaluateRegistry(Reaction reaction);
24-
int HuntT1015::EvaluateFiles(Reaction reaction);
23+
int HuntT1015::EvaluateRegistry(Reaction& reaction);
24+
int HuntT1015::EvaluateFiles(Reaction& reaction);
2525
public:
2626
HuntT1015();
2727

0 commit comments

Comments
 (0)