Skip to content

[Bug] Technique/tactic seems malformed #186

Description

@Yellowwaves

Expected Behavior

Using the exporters such as Excel or SVG using a local json file like https://github.com/mitre-attack/attack-stix-data/blob/master/enterprise-attack/enterprise-attack.json source should retrieve the proper data and produce the expected exported output with an output layer.

Actual Behavior

Every technique and subtechnique I was testing worked perfectly expect for this one : T1078.004

The error message is :
WARNING! Technique/Tactic T1078.004/(none) seems malformed. Skipping...

Steps to Reproduce the Problem

from mitreattack.navlayers.core import Layer
from mitreattack.navlayers.exporters.to_excel import ToExcel

lay = Layer()
lay.from_file("C:path_to_layer.json")

t2 = ToExcel(domain='enterprise', source='local', resource='path_to_enterprise-attack.json')
t2.to_xlsx(layerInit=lay, filepath="demo.xlsx")

The layer i'm using is

{
    "name": "example layer",
    "domain": "enterprise-attack",
    "description": "demo xlsx",
    "versions": {
        "layer": "4.5",
        "attack": "16.1",
        "navigator": "5.1.0"
    },
    "filters": {
        "platforms": [
            "Windows",
            "macOS"
        ]
    },
    "sorting": 2,
    "layout": {
        "layout": "side",
        "showID": true,
        "showName": true,
        "showAggregateScores": true,
        "countUnscored": true,
        "aggregateFunction": "average",
        "expandedSubtechniques": "annotated"
    },
    "hideDisabled": false,
    "techniques": [
        {
            "techniqueID": "T1078",
            "color": "#00FF00",
            "showSubtechniques": true
        },
        {
            "techniqueID": "T1078.004",
            "comment": "https://attack.mitre.org/techniques/T1078/004/",
            "color": "#00FF00"
        }
    ],
    "gradient": {
        "colors": [
            "#ff6666",
            "#ffe766",
            "#8ec843"
        ],
        "minValue": 0,
        "maxValue": 100
    },
    "legendItems": [
        {
            "label": "Legend Item Label",
            "color": "#FF00FF"
        }
    ],
    "showTacticRowBackground": true,
    "tacticRowBackground": "#dddddd",
    "selectTechniquesAcrossTactics": false,
    "selectSubtechniquesWithParent": false,
    "selectVisibleTechniques": false,
    "metadata": [
        {
            "name": "layer metadata 1",
            "value": "layer metadata 1 value"
        },
        {
            "name": "layer metadata 2",
            "value": "layer metadata 2 value"
        }
    ]
}

Possible Solution

The problem is appearing here

                else:
                    parents = [x for x in layer.layer.techniques if x.techniqueID == tech.techniqueID.split(".")[0]]
                    if tech.tactic:
                        parents = [x for x in parents if x.tactic == tech.tactic]
                    if all([True if not x.showSubtechniques else False for x in parents]):
                        print(
                            "NOTE! Technique/Tactic " + tech.techniqueID + "/" + tac + " does not appear "
                            "to be visible in the matrix. Its parent appears to be hiding it."
                        )
                    else:
                        print(
                            "WARNING! Technique/Tactic " + tech.techniqueID + "/" + tac + " seems malformed. "
                            "Skipping..."
                        )

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions