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

Stack trace when Event To Attributes - template has no template_uuid #32

Open
cvandeplas opened this issue May 21, 2020 · 4 comments
Open
Assignees
Labels

Comments

@cvandeplas
Copy link
Member

It seems that in some use-cases the MISP Object does not have a template_uuid .

Is this a bug on MISP-maltego or on MISP?

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/canari/maltego/runner.py", line 130, in local_transform_runner
    config
  File "/usr/local/lib/python3.6/dist-packages/MISP_maltego/transforms/eventtoattributes.py", line 109, in do_transform
    self.gen_response_objects()
  File "/usr/local/lib/python3.6/dist-packages/MISP_maltego/transforms/eventtoattributes.py", line 79, in gen_response_objects
    self.response += self.conn.object_to_entity(o)
  File "/usr/local/lib/python3.6/dist-packages/MISP_maltego/transforms/common/util.py", line 106, in object_to_entity
    o_template = self.misp.get_object_template(o['template_uuid'])
  File "/usr/local/lib/python3.6/dist-packages/pymisp/api.py", line 396, in get_object_template
    object_template_id = get_uuid_or_id_from_abstract_misp(object_template)
  File "/usr/local/lib/python3.6/dist-packages/pymisp/api.py", line 54, in get_uuid_or_id_from_abstract_misp
    if 'uuid' in obj:
TypeError: argument of type 'NoneType' is not iterable (from entity "12786")
Transform Event To Attributes returned with an error: Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/canari/maltego/runner.py", line 130, in local_transform_runner
    config
  File "/usr/local/lib/python3.6/dist-packages/MISP_maltego/transforms/eventtoattributes.py", line 109, in do_transform
    self.gen_response_objects()
  File "/usr/local/lib/python3.6/dist-packages/MISP_maltego/transforms/eventtoattributes.py", line 79, in gen_response_objects
    self.response += self.conn.object_to_entity(o)
  File "/usr/local/lib/python3.6/dist-packages/MISP_maltego/transforms/common/util.py", line 106, in object_to_entity
    o_template = self.misp.get_object_template(o['template_uuid'])
  File "/usr/local/lib/python3.6/dist-packages/pymisp/api.py", line 396, in get_object_template
    object_template_id = get_uuid_or_id_from_abstract_misp(object_template)
  File "/usr/local/lib/python3.6/dist-packages/pymisp/api.py", line 54, in get_uuid_or_id_from_abstract_misp
    if 'uuid' in obj:
TypeError: argument of type 'NoneType' is not iterable (from entity "12786")
@cvandeplas cvandeplas added the bug label May 21, 2020
@cvandeplas cvandeplas self-assigned this May 21, 2020
@Rafiot
Copy link
Member

Rafiot commented May 21, 2020

it is definitely unexpected from PyMISP side, self.misp.get_object_template(o['template_uuid']) doesn't expect None there.

I'm not sure how you can get to the point where an object you get from MISP doesn't have a template_uuid. Could the object it fails on be self defined and the instance you get it from doesn't have the template?

@cvandeplas
Copy link
Member Author

Thanks for the feedback !
I don't know yet, waiting for the MISP json file from the user.

@cvandeplas
Copy link
Member Author

The uuid is missing from the template. It seems to be a locally made template.
This indicates a bug in MISP that it loads templates that have no UUID.

@Rafiot
Copy link
Member

Rafiot commented May 21, 2020

Either that, or when you export the event from MISP, as it is not tied to a known template, it cannot fill the field. If that's the case, it should not create the key, and initialize with None. Calling o['template_uuid'] should fail with a key error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants