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

DRAFT: new RBA Object #263

Draft
wants to merge 49 commits into
base: contentctl_5
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
66e743e
initial sketch
ljstella Aug 27, 2024
802bfe6
Merge branch 'main' into obs_to_rba
ljstella Aug 27, 2024
2c1275c
Merge branch 'main' into obs_to_rba
ljstella Aug 28, 2024
f81f82e
Merge branch 'main' into obs_to_rba
ljstella Sep 4, 2024
dd5b52d
save point
ljstella Sep 5, 2024
56f4273
Merge branch 'main' into obs_to_rba
ljstella Sep 26, 2024
f6f2999
Merge branch 'main' into obs_to_rba
ljstella Nov 4, 2024
b294765
Implement hashing
ljstella Nov 8, 2024
7f7724c
Updated default detection
ljstella Nov 8, 2024
0224f9e
Merge branch 'main' into obs_to_rba
ljstella Nov 8, 2024
3be2c3a
Remove tags.message and tags.observable
ljstella Nov 8, 2024
9c138f1
remove code for tags.message
ljstella Nov 8, 2024
11a1ca9
reworking validations
ljstella Nov 8, 2024
3882b9b
new rba location
ljstella Nov 8, 2024
d584822
Refactor risk()
ljstella Nov 8, 2024
3cde4a6
slight tweak
ljstella Nov 8, 2024
f4739cc
Better guard against None
ljstella Nov 12, 2024
d6b848e
Another None case
ljstella Nov 12, 2024
9cda91e
remove print
ljstella Nov 12, 2024
8e5676c
Another None guard
ljstella Nov 12, 2024
6f77c47
Just production
ljstella Nov 12, 2024
9266898
Merge branch 'main' into obs_to_rba
ljstella Nov 13, 2024
1a4ea93
Validate all, not just production
ljstella Nov 13, 2024
e2565f4
Remove comment
ljstella Nov 14, 2024
12c8881
Temporary tweak for testing companion branch
ljstella Nov 14, 2024
afa864b
tweak to required
ljstella Nov 15, 2024
e7fd466
threat object type typo
ljstella Nov 15, 2024
2fe24e6
more threat object types
ljstella Nov 15, 2024
3435f4c
one more threat object type
ljstella Nov 15, 2024
140089f
Oopsied the merge
ljstella Nov 22, 2024
9790e16
Merge branch 'main' into obs_to_rba
ljstella Nov 22, 2024
042a53a
Wrong branch for 3.13
ljstella Nov 22, 2024
e671f2b
Create new rba object via new content workflow
ljstella Nov 25, 2024
1107ae1
Reordering output
ljstella Nov 25, 2024
12acd66
Merge branch 'contentctl_5' into obs_to_rba
ljstella Dec 10, 2024
474ede5
Merge branch 'contentctl_5' into obs_to_rba
ljstella Dec 12, 2024
f88bca6
convert plain enums, or enums with
pyth0n1c Dec 4, 2024
5b9cb95
Remove all usage of use_enum_values.
pyth0n1c Dec 4, 2024
827a8f4
Remove use of .value on enums in code
pyth0n1c Dec 4, 2024
eeaeb4d
fix missing typing of mode_name
pyth0n1c Dec 4, 2024
b794d15
remove files that are no longer used anymore. Add logic to serialize …
pyth0n1c Dec 6, 2024
334062c
Remove dead code from
pyth0n1c Dec 6, 2024
4bc5e68
remove the 'forbid' from a few classes
pyth0n1c Dec 11, 2024
84715bf
Clean up two more use of .value on
pyth0n1c Dec 11, 2024
8cc3451
Add GH Actions to Dependabot
ljstella Dec 12, 2024
b4848be
Reduce matrix for simplicity
ljstella Dec 12, 2024
753b3b0
Merge branch 'contentctl_5' into obs_to_rba
ljstella Dec 12, 2024
24b003c
Update CI to temporarily test against #3269 on security_content
ljstella Jan 6, 2025
285acf1
New threat object type
ljstella Jan 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test_against_escu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
with:
path: security_content
repository: splunk/security_content
ref: strict_yml_from_rba

#Install the given version of Python we will test against
- name: Install Required Python Version
Expand Down
2 changes: 1 addition & 1 deletion contentctl/input/new_content_questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def get_questions_detection(cls) -> list[dict[str,Any]]:
{
'type': 'checkbox',
'message': 'Your data source',
'name': 'data_source',
'name': 'data_sources',
#In the future, we should dynamically populate this from the DataSource Objects we have parsed from the data_sources directory
'choices': sorted(DataSource._value2member_map_ )

Expand Down

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions contentctl/objects/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@


class App_Base(BaseModel,ABC):

model_config = ConfigDict(validate_default=True, arbitrary_types_allowed=True, extra='forbid')
uid: Optional[int] = Field(default=None)
title: str = Field(description="Human-readable name used by the app. This can have special characters.")
Expand Down
4 changes: 1 addition & 3 deletions contentctl/objects/detection_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

class DetectionTags(BaseModel):
# detection spec

model_config = ConfigDict(validate_default=False, extra='forbid')
analytic_story: list[Story] = Field(...)
asset_type: AssetType = Field(...)
Expand Down Expand Up @@ -70,7 +71,6 @@ def severity(self)->RiskSeverity:

# TODO (#249): Add pydantic validator to ensure observables are unique within a detection
observable: List[Observable] = []
message: str = Field(...)
product: list[SecurityContentProductName] = Field(..., min_length=1)
throttling: Optional[Throttling] = None
security_domain: SecurityDomain = Field(...)
Expand Down Expand Up @@ -153,8 +153,6 @@ def serialize_model(self):
"cis20": self.cis20,
"kill_chain_phases": self.kill_chain_phases,
"nist": self.nist,
"observable": self.observable,
"message": self.message,
"risk_score": self.risk_score,
"security_domain": self.security_domain,
"risk_severity": self.severity,
Expand Down
1 change: 1 addition & 0 deletions contentctl/objects/mitre_attack_enrichment.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def standardize_contributors(cls, contributors:list[str] | None) -> list[str]:
return contributors

class MitreAttackEnrichment(BaseModel):

ConfigDict(extra='forbid')
mitre_attack_id: MITRE_ATTACK_ID_TYPE = Field(...)
mitre_attack_technique: str = Field(...)
Expand Down
59 changes: 59 additions & 0 deletions contentctl/objects/rba.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from enum import Enum
from pydantic import BaseModel
from abc import ABC
from typing import Set



class RiskObjectType(str, Enum):
SYSTEM = "system"
USER = "user"
OTHER = "other"

class ThreatObjectType(str, Enum):
CERTIFICATE_COMMON_NAME = "certificate_common_name"
CERTIFICATE_ORGANIZATION = "certificate_organization"
CERTIFICATE_SERIAL = "certificate_serial"
CERTIFICATE_UNIT = "certificate_unit"
COMMAND = "command"
DOMAIN = "domain"
EMAIL_ADDRESS = "email_address"
EMAIL_SUBJECT = "email_subject"
FILE_HASH = "file_hash"
FILE_NAME = "file_name"
FILE_PATH = "file_path"
HTTP_USER_AGENT = "http_user_agent"
IP_ADDRESS = "ip_address"
PROCESS = "process"
PROCESS_NAME = "process_name"
PARENT_PROCESS = "parent_process"
PARENT_PROCESS_NAME = "parent_process_name"
PROCESS_HASH = "process_hash"
REGISTRY_PATH = "registry_path"
REGISTRY_VALUE_NAME = "registry_value_name"
REGISTRY_VALUE_TEXT = "registry_value_text"
SERVICE = "service"
SIGNATURE = "signature"
SYSTEM = "system"
TLS_HASH = "tls_hash"
URL = "url"

class risk_object(BaseModel):
field: str
type: RiskObjectType
score: int

def __hash__(self):
return hash((self.field, self.type, self.score))

class threat_object(BaseModel):
field: str
type: ThreatObjectType

def __hash__(self):
return hash((self.field, self.type))

class rba_object(BaseModel, ABC):
message: str
risk_objects: Set[risk_object]
threat_objects: Set[threat_object]
2 changes: 1 addition & 1 deletion contentctl/output/templates/savedsearches_detections.j2
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ action.escu.providing_technologies = null
action.escu.analytic_story = {{ objectListToNameList(detection.tags.analytic_story) | tojson }}
{% if detection.deployment.alert_action.rba.enabled%}
action.risk = 1
action.risk.param._risk_message = {{ detection.tags.message | escapeNewlines() }}
action.risk.param._risk_message = {{ detection.rba.message | escapeNewlines() }}
action.risk.param._risk = {{ detection.risk | tojson }}
action.risk.param._risk_score = 0
action.risk.param.verbose = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,35 +38,31 @@ drilldown_searches:
search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ($user$, $dest$) starthoursago=168 endhoursago=1 | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
earliest_offset: $info_min_time$
latest_offset: $info_max_time$
rba:
message: An instance of $parent_process_name$ spawning $process_name$ was identified
on endpoint $dest$ by user $user$. This behavior is indicative of suspicious loading
of 7zip.
risk_objects:
- field: user
type: user
score: 56
- field: dest
type: system
score: 60
threat_objects:
- field: parent_process_name
type: parent_process_name
- field: process_name
type: process_name
tags:
analytic_story:
- Cobalt Strike
asset_type: Endpoint
confidence: 80
impact: 80
message: An instance of $parent_process_name$ spawning $process_name$ was identified
on endpoint $dest$ by user $user$. This behavior is indicative of suspicious loading
of 7zip.
mitre_attack_id:
- T1560.001
- T1560
observable:
- name: user
type: User
role:
- Victim
- name: dest
type: Hostname
role:
- Victim
- name: parent_process_name
type: Process
role:
- Attacker
- name: process_name
type: Process
role:
- Attacker
product:
- Splunk Enterprise
- Splunk Enterprise Security
Expand Down
Loading