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

Add Yeti Package to create several objects defined as json #1140

Merged
merged 12 commits into from
Oct 4, 2024
Merged

Conversation

udgover
Copy link
Collaborator

@udgover udgover commented Sep 24, 2024

This PR brings Yeti Package to easily create a bundle of mixed yeti objects. It supports:

  • all observable types and will create generic type with a tag
  • all available entities and indicators
  • link between defined objects

Here's one example:

{
   "timestamp": "2024-09-24T08:31:29.312Z",
   "source": "honeypot",
   "tags": {
      "global": ["honeypot", "exploitation"],
      "88.173.200.156": ["one_tag"]
   }
   "observables": [
      {
         "value": "88.173.200.156",
         "type": "ipv4"
      },
      {
         "value": "Go-http-client/1.1",
         "type": "user_agent"
      },
      {
         "value": "ubuntu:18.04",
         "type": "docker_image"
      },
      {
         "value": "/bin/bash",
         "type": "command_line"
      }
   ],
   "entities": [
      { 
         "name": "docker malicious campaign",
         "type": "campaign",
         "description": "### Docker container creation attempt\n* ```ubuntu:18.04```\n* ```/bin/bash```\n"
      }
   ],
   "indicators": {},
   "relationships": {
         "docker malicious campaign": [
            {
               "target": "88.173.200.156",
               "link_type": "observes"
            },
            {
               "target": "ubuntu:18.04",
               "link_type": "creates"
            },
            {
               "target": "/bin/bash",
               "link_type": "executes"
            },
         ],
         "88.173.200.156": [
            {
               "target": "Go-http-client/1.1",
               "link_type": "uses"
            },
            {
               "target": "ubuntu:18.04",
               "link_type": "creates"
            },
            {
               "target": "/bin/bash",
               "link_type": "executes"
            }
         ]
      }
}

This package will create a campaign named "docker malicious campaign" with the following observables:

  • ipv4: 88.173.200[.]156
  • user-agent: Go-http-client/1.1
  • docker_image: ubuntu:18.04
  • command_line: /bin/bash

The following relationships will also be created:

  • 88.173.200[.]156 --> uses --> Go-http-client/1.1
  • 88.173.200[.]156 --> creates --> ubuntu:18.04
  • 88.173.200.156 --> executes --> /bin/bash

The campaign itself will be linked with:

  • 88.173.200[.]156 and observes link
  • ubuntu:18.04 and creates link
  • /bin/bash and executes link

All elements will be tagged with honeypot and exploitation and 88.173.200[.]156 will be tagged with one_tag

@udgover udgover marked this pull request as ready for review October 4, 2024 07:29
@udgover udgover added enhancement noteworthy PRs that are noteworthy / introduce new features core labels Oct 4, 2024
core/schemas/package.py Outdated Show resolved Hide resolved
core/schemas/package.py Show resolved Hide resolved
core/schemas/package.py Outdated Show resolved Hide resolved
)
tags = set(self.tags)
if not yeti_observable:
# support unknown observable type with generic and adds type as tag: type:<obs_type>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this is not the usual behavior that we have when saving objects, can we add a tag_unknown_with_type parameter to this _save_observable function to do this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the behaviour if not enabled?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would not add the extra tag to the observables that are added

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And how would you imagine setting this when building from json for example?

tests/schemas/package.py Outdated Show resolved Hide resolved
core/schemas/package.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@tomchop tomchop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this is great!

core/schemas/package.py Outdated Show resolved Hide resolved
@tomchop tomchop merged commit e4178a7 into main Oct 4, 2024
3 checks passed
@tomchop tomchop deleted the yeti_package branch October 4, 2024 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core enhancement noteworthy PRs that are noteworthy / introduce new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants