Skip to content

Commit aa2ba50

Browse files
committed
update: better brand processing handling and sandboxie fix attempt
1 parent 6fb7f3a commit aa2ba50

File tree

3 files changed

+19
-30
lines changed

3 files changed

+19
-30
lines changed

.github/ISSUE_TEMPLATE/issue.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ body:
2222
- label: False positive
2323
- label: Compilation warning/error
2424
- label: Suggestion
25+
- label: Runtime error/crash
2526
- label: Other
2627
validations:
2728
required: true

src/cli.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ static void general(
10341034
std::string current_color = "";
10351035
std::string type = vm.type;
10361036

1037-
if (is_anyrun && (type == VM::brands::NULL_BRAND)) {
1037+
if (is_anyrun && (type == "Unknown")) {
10381038
type = "Sandbox";
10391039
}
10401040

src/vmaware.hpp

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4508,19 +4508,18 @@ struct VM {
45084508
// run all the techniques
45094509
const u16 score = core::run_all(flags);
45104510

4511-
brand_array_t active_brands = {};
4512-
brand_list_t brand_return = {};
4513-
brand_return.reserve(MAX_BRANDS);
4511+
brand_list_t active_brands = {};
4512+
active_brands.reserve(MAX_BRANDS);
45144513

45154514
size_t active_count = 0;
45164515

45174516
for (size_t i = 0; i < MAX_BRANDS; ++i) {
45184517
if (core::brand_scoreboard.at(i).score > 0) {
4519-
active_brands.at(i) = std::make_pair(core::brand_scoreboard.at(i).name, core::brand_scoreboard.at(i).score);
4518+
active_brands.push_back(std::make_pair(core::brand_scoreboard.at(i).name, core::brand_scoreboard.at(i).score));
45204519
active_count++;
45214520
}
45224521
}
4523-
4522+
45244523
#ifdef __VMAWARE_DEBUG__
45254524
for (const auto brand : active_brands) {
45264525
debug("pre-processed scoreboard: ", int(brand.second), " : ", brands::brand_enum_to_string(brand.first));
@@ -4539,36 +4538,25 @@ struct VM {
45394538

45404539
// if all brands have a point of 0, return "Unknown"
45414540
if (active_count == 0) {
4542-
brand_return.push_back({brand_enum::NULL_BRAND, 1});
4543-
memo::brand_list::store(brand_return);
4544-
return brand_return;
4541+
active_brands.push_back({brand_enum::NULL_BRAND, 1});
4542+
memo::brand_list::store(active_brands);
4543+
return active_brands;
45454544
}
45464545

45474546
// if there's only a single brand, return it immediately
45484547
// We skip this early return if the single brand is HYPERV_ARTIFACT,
45494548
// but we must also nullify the result if the score is above 0,
45504549
// which would most likely indicate a hardened VM instead and return "Unknown".
45514550
if (active_count == 1) {
4552-
enum brand_enum initial_brand = brand_enum::INVALID;
4553-
4554-
for (const auto brand : active_brands) {
4555-
if (brand.second == 0) {
4556-
continue;
4557-
}
4551+
const enum brand_enum brand = active_brands.front().first;
45584552

4559-
if (brand.first == brand_enum::HYPERV_ROOT && score > 0) {
4560-
brand_return.push_back({brand_enum::NULL_BRAND, 1});
4561-
memo::brand_list::store(brand_return);
4562-
return brand_return;
4563-
}
4564-
4565-
initial_brand = brand.first;
4566-
break;
4553+
if (brand == brand_enum::HYPERV_ROOT && score > 0) {
4554+
active_brands.push_back({brand_enum::NULL_BRAND, 1});
4555+
remove(brand_enum::HYPERV_ROOT);
45674556
}
45684557

4569-
brand_return.push_back({initial_brand, 1});
4570-
memo::brand_list::store(brand_return);
4571-
return brand_return;
4558+
memo::brand_list::store(active_brands);
4559+
return active_brands;
45724560
}
45734561

45744562
// remove Hyper-V artifacts and Unknown if found with other brands
@@ -4662,18 +4650,18 @@ struct VM {
46624650

46634651
for (const auto brand : active_brands) {
46644652
if (brand.second > 0) {
4665-
brand_return.push_back({brand.first, brand.second});
4653+
active_brands.push_back({brand.first, brand.second});
46664654
}
46674655
}
46684656

46694657
#ifdef __VMAWARE_DEBUG__
4670-
for (const auto brand : brand_return) {
4658+
for (const auto brand : active_brands) {
46714659
debug("post-processed scoreboard: ", brand.second, " : ", brands::brand_enum_to_string(brand.first));
46724660
}
46734661
#endif
46744662

4675-
memo::brand_list::store(brand_return);
4676-
return brand_return;
4663+
memo::brand_list::store(active_brands);
4664+
return active_brands;
46774665
}
46784666

46794667
static const char* brand_enum_to_string(const brand_enum brand) {

0 commit comments

Comments
 (0)