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

Elastic-ecs mapping - Email Object #1518

Open
Harmedox opened this issue Jun 26, 2023 · 5 comments
Open

Elastic-ecs mapping - Email Object #1518

Harmedox opened this issue Jun 26, 2023 · 5 comments

Comments

@Harmedox
Copy link
Contributor

Elastic Email Object is currently not mapped to STIX. As an example, an Email Object

"email": {
        "attachments": [
            {
            "file": {
                "name": "tabby.html",
                "mime_type": "text/html"
                }
            },
            {
            "file": {
                  "name": "tabby.zip",
                  "mime_type": "application/zip"
              }    
            }
        ],
        "subject": "Check out this picture of a cat!",
        "from": {
            "address": "[email protected]"
        },
        "to": {
            "address": [
                "[email protected]",
                "[email protected]"
            ]
        },
}

should be represented in the STIX bundle as:

{
    "0": {
        "type": "email-message",
        "subject": "Check out this picture of a cat!",
        "from_ref": "3",
        "to_refs": ["4", "5"],
        "is_multipart": true,
        "content_type": "multipart/mixed",
        "body-multiparts": [{
            "content_type": "text/html",
            "content_disposition": "attachment; filename=tabby.html",
            "body_raw_ref": "1"
        }, 
        {
            "content_type": "application/zip",
            "content_disposition": "attachment; filename=tabby.zip",
            "body_raw_ref": "2"
        }]
    },
    "1": {
        "type": "file",
        "name": "tabby.html",
        "mime_type": "text/html"
    },
    "2": {
        "type": "file",
        "name": "tabby.zip",
        "mime_type":  "application/zip"
    },
    "3": {
        "type": "email-addr",
        "value": "[email protected]"
    },
    "4": {
        "type": "email-addr",
        "value": "[email protected]"
    },
    "5": {
        "type": "email-addr",
        "value": "[email protected]"
    }
}
@Harmedox
Copy link
Contributor Author

Harmedox commented Jul 3, 2023

The significant challenges with this mapping are:

  1. email.attachments is an array of objects.
  2. The presence of an entity in the Email object leads to multiple attributes in STIX. For example, the presence of more than one object in the email.attachments array means that "is_multipart": true, "content_type": "multipart/mixed"...must be set in the STIX bundle.
  3. For example, email.attachments.file.name and email.attachments.file.mime_type has to be transformed to form email-message.body_multiparts. content_type and email-message.body_multiparts. content_disposition

Anyone with ideas on how to handle (1) and (2) above? I fixed (3) using a transformer.

@Harmedox
Copy link
Contributor Author

Harmedox commented Jul 3, 2023

@mdazam1942 @delliott90 ^^^ any thoughts?

@mdazam1942
Copy link
Member

In this case, the only way to set is_multipart and content_type is inside stix_shifter_modules/elastic_ecs/stix_transmission/connector.py as part of results processing.

there are few connectors that does the same. For example:

# set is_multipart with false as default if there is email message property

@subbyte
Copy link
Member

subbyte commented Jul 6, 2023

@mdazam1942 just to confirm, does it mean patching the STIX bundle in the transmission module to add additional fields in the raw data in order for the translation module to pick them up and translate?

@mdazam1942
Copy link
Member

Correct. add additional fields in the raw data and map those fields in to_stix. Results translator class should automatically pick them up while translating to stix observable.

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

No branches or pull requests

3 participants