Skip to content
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

Sub Techniques not correctly mapped? Issue while retrieving "sub_techniques" attribute of a specific technique #1

Closed
sibkyd opened this issue Dec 3, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@sibkyd
Copy link

sibkyd commented Dec 3, 2021

The following code should print the sub techniques of the first listed technique (Abuse Elevation Control Mechanism, at the moment):
print(next(iter(attack.techniques)).sub_techniques)
However, it prints ALL the subtechniques of the entire Mitre ATT&CK framework.
The following code gets ALL the subtechniques as well:
next(iter(next(iter(attack.groups)).techniques)).sub_techniques
It looks like every technique has the whole set of subtechniques as its child, instead of the correct subtechniques.

@sibkyd
Copy link
Author

sibkyd commented Dec 3, 2021

I think technique.py sub_techniques property should be changed to something like this:

    def sub_techniques(self):
        from .sub_technique import SubTechnique
        sub_techniques_ = []
        for attack_obj in self.attack_objects['objects']:
            if attack_obj.get('x_mitre_is_subtechnique'):
                if self.id in attack_obj['external_references'][0]['external_id']:
                    sub_techniques_.append(attack_obj)
        return sub_techniques_

It partially works, but there should a be a nicer and cleaner way to do it.

@xakepnz
Copy link
Owner

xakepnz commented Dec 4, 2021

Hi there, thanks for this. Let me look into this.

@xakepnz
Copy link
Owner

xakepnz commented Dec 4, 2021

@sibkyd, should be fixed in v.0.1.2: b5a67dd

Screen Shot 2021-12-04 at 8 08 38 PM

Poc:

for technique in attack.techniques:
    print('{} - {}'.format(technique.name, len(technique.sub_techniques)))

Before:

Weaken Encryption - 499
Web Service - 499
Web Session Cookie - 499
Web Shell - 499
Windows Admin Shares - 499
Windows Management Instrumentation - 499
Windows Management Instrumentation Event Subscription - 499
Windows Remote Management - 499
Winlogon Helper DLL - 499
XSL Script Processing - 499

After:

Weaken Encryption - 2
Web Service - 3
Web Session Cookie - 1
Web Shell - 1
Windows Admin Shares - 1
Windows Management Instrumentation - 0
Windows Management Instrumentation Event Subscription - 1
Windows Remote Management - 1
Winlogon Helper DLL - 1
XSL Script Processing - 0

@xakepnz xakepnz added the bug Something isn't working label Dec 6, 2021
@xakepnz xakepnz closed this as completed Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants