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

[Bug] Not able to retrieve an Attack Pattern object from get_object_by_stix_id() method #120

Closed
vinisimoes opened this issue Jun 13, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@vinisimoes
Copy link

Expected Behavior

When I run the following code:

from mitreattack.stix20 import MitreAttackData
mitre_attack_data = MitreAttackData("enterprise-attack.json")
attack_pattern_object = mitre_attack_data.get_object_by_stix_id("attack-pattern--7f32230b-d4ac-502c-a37c-e85b6aa6664d")

I expect the attack_pattern_object to be an object representing the following technique: "Resource Hijacking".

Actual Behavior

I am getting the following error:

File "...\lib\site-packages\mitreattack\stix20\custom_attack_objects.py", line 50, in StixObjectFactory
if "type" in data and data["type"] in stix_type_to_custom_class:
TypeError: argument of type 'NoneType' is not iterable

Possible Solution

Fix the get_object_by_stix_id() method to actually return an object representing an attack pattern.

@vinisimoes vinisimoes added the bug Something isn't working label Jun 13, 2023
@clemiller
Copy link
Contributor

Hi @vinisimoes,

Thanks for opening up an issue. It appears that no object was found with STIX ID attack-pattern--7f32230b-d4ac-502c-a37c-e85b6aa6664d which caused the StixObjectFactory to throw an error. A PR has been opened to include some additional checking which will return None if no objects with the given ID exist in the dataset rather than throwing an error.

Also want to mention that if you are using the ATT&CK Enterprise dataset, it doesn't look like any objects have that STIX ID. Maybe you're looking for Resource Hijacking: attack-pattern--cd25c1b4-935c-4f0e-ba8d-552f28bc4783?

@vsun757 vsun757 assigned vsun757 and unassigned vsun757 Jun 14, 2023
@clemiller
Copy link
Contributor

Resolved in #121

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

3 participants