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

[SIEM][Detection Engine] Adds ecs threat properties to rules #51782

Merged
merged 3 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const sampleRuleAlertParams = (
filters: undefined,
savedId: undefined,
meta: undefined,
threats: undefined,
});

export const sampleDocNoSortId = (someUuid: string = sampleIdGuid): SignalSourceHit => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const createRules = async ({
name,
severity,
tags,
threats,
to,
type,
references,
Expand Down Expand Up @@ -57,6 +58,7 @@ export const createRules = async ({
riskScore,
severity,
tags,
threats,
to,
type,
references,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const rulesAlertType = ({
riskScore: schema.number(),
severity: schema.string(),
tags: schema.arrayOf(schema.string(), { defaultValue: [] }),
threats: schema.nullable(schema.arrayOf(schema.object({}, { allowUnknowns: true }))),
to: schema.string(),
type: schema.string(),
references: schema.arrayOf(schema.string(), { defaultValue: [] }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ import { esFilters } from '../../../../../../../../src/plugins/data/server';

export type PartialFilter = Partial<esFilters.Filter>;

export interface ThreatParams {
framework: string;
tactic: {
id: string;
name: string;
reference: string;
};
technique: {
id: string;
name: string;
reference: string;
};
}
export interface RuleAlertParams {
description: string;
enabled: boolean;
Expand All @@ -44,6 +57,7 @@ export interface RuleAlertParams {
severity: string;
tags: string[];
to: string;
threats: ThreatParams[] | undefined | null;
Copy link
Contributor

@FrankHassanabad FrankHassanabad Nov 26, 2019

Choose a reason for hiding this comment

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

per comments below and how ECS labels it as threat I would keep it at threat even though yes it is indeed multiple threats.

Actually this should be fine as threats, I updated my comments below. I am wrong here as this is different than the ECS threats, this is a threat from a rule which would probably be a nested object.

type: 'filter' | 'query' | 'saved_query';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const updateRules = async ({
name,
severity,
tags,
threats,
to,
type,
references,
Expand Down Expand Up @@ -101,6 +102,7 @@ export const updateRules = async ({
riskScore,
severity,
tags,
threats,
to,
type,
references,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const buildRule = ({
filters: ruleParams.filters,
created_by: createdBy,
updated_by: updatedBy,
threats: ruleParams.threats,
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ export const typicalPayload = (): Partial<Omit<RuleAlertParamsRest, 'filter'>> =
severity: 'high',
query: 'user.name: root or user.name: admin',
language: 'kuery',
threats: [
{
framework: 'fake',
tactic: { id: 'fakeId', name: 'fakeName', reference: 'fakeRef' },
technique: { id: 'techniqueId', name: 'techniqueName', reference: 'techniqueRef' },
},
],
});

export const typicalFilterPayload = (): Partial<RuleAlertParamsRest> => ({
Expand Down Expand Up @@ -139,6 +146,21 @@ export const getResult = (): RuleAlertType => ({
tags: [],
to: 'now',
type: 'query',
threats: [
{
framework: 'MITRE ATT&CK',
tactic: {
id: 'TA0040',
name: 'impact',
reference: 'https://attack.mitre.org/tactics/TA0040/',
},
technique: {
id: 'T1499',
name: 'endpoint denial of service',
reference: 'https://attack.mitre.org/techniques/T1499/',
},
},
],
references: ['http://www.example.com', 'https://ww.example.com'],
},
interval: '5m',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ export const createCreateRulesRoute: Hapi.ServerRoute = {
name,
severity,
tags,
threats,
to,
type,
references,
} = request.payload;

const alertsClient = isFunction(request.getAlertsClient) ? request.getAlertsClient() : null;
const actionsClient = isFunction(request.getActionsClient) ? request.getActionsClient() : null;

Expand Down Expand Up @@ -94,6 +94,7 @@ export const createCreateRulesRoute: Hapi.ServerRoute = {
tags,
to,
type,
threats,
references,
});
return transformOrError(createdRule);
Expand Down
Loading