Skip to content

Commit

Permalink
Merge pull request #87 from center-for-threat-informed-defense/af150-…
Browse files Browse the repository at this point in the history
…malware-analysis

Af150 malware analysis
  • Loading branch information
mikecarenzo committed Jul 24, 2023
2 parents dc9448c + 9f57441 commit f2bb214
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
20 changes: 20 additions & 0 deletions src/attack_flow_builder/src/assets/builder.config.publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ class AttackFlowPublisher extends DiagramPublisher {
case "grouping":
this.tryEmbedInNote(parent, c.obj);
break;
case "malware-analysis":
this.tryEmbedInMalwareAnalysis(parent, c.obj);
break;
case "network-traffic":
sro = this.tryEmbedInNetworkTraffic(parent, c.obj);
break;
Expand Down Expand Up @@ -540,6 +543,23 @@ class AttackFlowPublisher extends DiagramPublisher {
parent.object_refs.push(child.id);
}

/**
* Embed a reference to the child in the malware analysis. If the child cannot be
* embedded, return a new SRO.
* @param parent
* A STIX malware analysis node.
* @param child
* A STIX child node.
* @returns
* An SRO, if one was created.
*/
private tryEmbedInMalwareAnalysis(parent: Sdo, child: Sdo): void {
if (!parent.analysis_sco_refs) {
parent.analysis_sco_refs = [];
}
parent.analysis_sco_refs.push(child.id);
}

/**
* Embed a reference to the child in the parent. If the child cannot be
* embedded, return a new SRO.
Expand Down
15 changes: 14 additions & 1 deletion src/attack_flow_builder/src/assets/builder.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,20 @@ const config: AppConfiguration = {
submitted : { type: PropertyType.Date },
analysis_started : { type: PropertyType.Date },
analysis_ended : { type: PropertyType.Date },
av_result : { type: PropertyType.String},
result : {
type: PropertyType.Enum,
options: {
type: PropertyType.List,
form: { type: PropertyType.String },
value: [
["malicious", "Malicious"],
["suspicious", "Suspicious"],
["benign", "Benign"],
["unknown", "Unknown"]
]
},
value: null
},
},
anchor_template: "@__builtin__anchor",
style: DarkTheme.DictionaryBlock({ head: { ...Colors.Gray }})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ class AttackFlowValidator extends DiagramValidator {
this.addError(id, "Latitude and Longitude must be supplied together.");
}
break;
case "malware_analysis":
if(!node.props.value.get("result")?.isDefined()) {
// If "result" is empty, check for "analysis_sco_refs"
if(node.next.length === 0) {
this.addError(id, "A Malware Analysis must have the Result field filled out or point to at least one object captured during analysis.")
}
}
break;
case "network_traffic":
this.validateNetworkTrafficLinks(id, node);
break;
Expand Down
2 changes: 1 addition & 1 deletion stix/oasis-open/sdos/malware-analysis.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
{"required": ["analysis_sco_refs"]}
],
"definitions": {
"malware-av-result-ov": {
"malware-result-ov": {
"type": "string",
"enum": [
"malicious",
Expand Down

0 comments on commit f2bb214

Please sign in to comment.