Skip to content

Commit ab5ca74

Browse files
randomuseridgithub-actions[bot]
authored andcommitted
user risk score docs (#2055)
* user risk score initial create of user risk score docs * add paragraph adding another paragraph for explainabiltiy as suggested by pm * Update docs/experimental-machine-learning/readme.md Co-authored-by: Apoorva Joshi <[email protected]> * Update user-risk-score.md fixes and suggestions * Update user-risk-score.md rm int script reference * Update docs/experimental-machine-learning/user-risk-score.md Co-authored-by: Apoorva Joshi <[email protected]> * Update user-risk-score.md * Update user-risk-score.md * Update user-risk-score.md Co-authored-by: Apoorva Joshi <[email protected]> (cherry picked from commit 1bb2273)
1 parent c3e3a40 commit ab5ca74

File tree

2 files changed

+171
-0
lines changed

2 files changed

+171
-0
lines changed

docs/experimental-machine-learning/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This repo contains some additional information and files to use experimental[*](
77
* [ProblemChild](problem-child.md)
88
* [HostRiskScore](host-risk-score.md)
99
* [URLSpoof](url-spoof.md)
10+
* [UserRiskScore](user-risk-score.md)
1011
* [experimental detections](experimental-detections.md)
1112

1213
## Releases
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
# User Risk Score
2+
3+
The User Risk Score feature highlights risky usernames from within your environment. It utilizes a transform with a scripted metric aggregation to calculate user risk scores based on alerts that were generated within the past three months. The transform runs hourly to update the score as new alerts are generated. Each alert's contribution to the user risk score is based on the alert's risk score (`signal.rule.risk_score`). The risk score is calculated using a weighted sum where rules with higher time-corrected risk scores also have higher weights. Each risk score is normalized to a scale of 0 to 100.
4+
5+
User Risk Score is an experimental feature that assigns risk scores to usernames in a given Kibana space. Risk scores are calculated for each username by utilizing transforms on the alerting indices. The transform updates the score as new alerts are generated. The User Risk Score [package](https://github.com/elastic/detection-rules/releases/tag/ML-UserRiskScore-20220628-1) contains all of the required artifacts for setup. The User Risk Score feature provides Lens dashboards for viewing summary and detailed username risk score information. The detail view dashboard - Drilldown of User Risk Score - presents detail on why a username has been given a high risk score. In addition, user risk scores are presented in the detailed view for a username in the Elastic Security App.
6+
7+
8+
### On Usernames and Risk Scores
9+
10+
Many alerts contain usernames which were present in the original log or event documents that alert rules, or anomaly rules, matched. These are discrete usernames, not (yet) pointers to a user *entity*. In most environments, each human user has multiple usernames across the various applications and systems they use. In order to investigate a user, it may be necessary to add each of their usernames to the list of usernames being used to filter the output of the detail dashboard.
11+
12+
In some cases, there are certain usernames that are not readily individuated. The Local System, or SYSTEM account, under Windows, for example, has the same name and the same SID (security identifier) on every Windows host. In order to individuate a particular Local System user account, it is necessary to add its hostname as a filter. The user risk score detail dashboard contains tables of alerts by hostname, in addition to username, in order to help identify the hostname(s) associated with a local user that has been given a risk score.
13+
14+
## Setup Instructions
15+
16+
1. [Obtain artifacts](#obtain-artifacts)
17+
2. [Upload scripts](#upload-scripts)
18+
3. [Upload ingest pipeline](#upload-ingest-pipeline)
19+
4. [Upload and start the `pivot` transform](#upload-start-pivot)
20+
5. [Create the User Risk Score index](#user-risk-index)
21+
6. [Upload and start the `latest` transform](#upload-start-latest)
22+
7. [Import dashboards](#import-dashboards)
23+
8. [(Optional) Enable Kibana features](#enable-kibana)
24+
25+
<h3 id="modify-artifacts">1. Obtain artifacts</h3>
26+
27+
The User Risk Score functionality is space aware for privacy. Downloaded artifacts must be modified with the desired space before they can be used.
28+
29+
- Download the release bundle from [here](https://github.com/elastic/detection-rules/releases/tag/ML-UserRiskScore-20220628-1). The User Risk Score releases can be identified by the tag `ML-UserRiskScore-YYYYMMDD-N`. Check the release description to make sure it is compatible with the Elastic Stack version you are running.
30+
- Unzip the contents of `ML-UserRiskScore-YYYYMMDD-N.zip`.
31+
- Run `ml_userriskscore_generate_scripts.py` script in the unzipped directory with your Kibana space as the argument.
32+
<div style="margin-left: 40px">
33+
<i>Example of modifying artifacts for the default space</i>
34+
<pre style="margin-top:-2px"><code>python ml_userriskscore_generate_scripts.py --space default
35+
</code></pre></div>
36+
37+
- Find a new folder named after your space in the unzipped directory. **You will be using the scripts within this directory for the next steps.**
38+
39+
<h3 id="upload-scripts">2. Upload scripts</h3>
40+
41+
- Navigate to `Management / Dev Tools` in Kibana.
42+
- Upload the contents of `ml_userriskscore_levels_script.json`, `ml_userriskscore_map_script.json`, `ml_userriskscore_reduce_script.json` using the Script API with the following syntax.
43+
- Ensure that your space name (such as `default`) replaces `<your-space-name>` in the script names below.
44+
45+
<div style="margin-left: 40px">
46+
<i>uploading scripts</i>
47+
<pre style="margin-top:-2px"><code>
48+
PUT _scripts/ml_userriskscore_levels_script_&lt;your-space-name&gt;
49+
{contents of ml_userriskscore_levels_script.json file}
50+
</code></pre></div>
51+
52+
<div style="margin-left: 40px">
53+
<pre><code>
54+
PUT _scripts/ml_userriskscore_map_script_&lt;your-space-name&gt;
55+
{contents of ml_userriskscore_map_script.json file}
56+
</code></pre></div>
57+
58+
<div style="margin-left: 40px">
59+
<pre><code>
60+
PUT _scripts/ml_userriskscore_reduce_script_&lt;your-space-name&gt;
61+
{contents of ml_userriskscore_reduce_script.json file}
62+
</code></pre></div>
63+
64+
<i>For Elastic Stack version 8.1+ only</i>
65+
<div style="margin-left: 40px">
66+
<pre><code>
67+
PUT _scripts/ml_userriskscore_init_script_&lt;your-space-name&gt;
68+
{contents of ml_userriskscore_init_script.json file}
69+
</code></pre></div>
70+
71+
72+
<h3 id="upload-ingest-pipeline">3. Upload ingest pipeline</h3>
73+
74+
- Upload the contents of `ml_userriskscore_ingest_pipeline.json` using the Ingest API with the following syntax.
75+
- Ensure that your space name (such as `default`) replaces `<your-space-name>` below.
76+
77+
<div style="margin-left: 40px">
78+
<i>uploading ingest pipeline</i>
79+
<pre style="margin-top:-2px"><code>PUT _ingest/pipeline/ml_usertriskscore_ingest_pipeline_&lt;your-space-name&gt;
80+
{contents of ml_userriskscore_ingest_pipeline.json file}
81+
</code></pre></div>
82+
83+
84+
85+
<h3 id="upload-start-pivot">4. Upload and start the <code>pivot</code> transform</h3>
86+
87+
This transform calculates the risk level every hour for each username in the Kibana space specified.
88+
89+
- Upload the contents of `ml_userriskscore_pivot_transform.json` using the Transform API with the following syntax.
90+
- Ensure that your space name (such as `default`) replaces `<your-space-name>` below.
91+
92+
<div style="margin-left: 40px">
93+
<i>uploading pivot transform</i>
94+
<pre style="margin-top:-2px"><code>PUT _transform/ml_userriskscore_pivot_transform_&lt;your-space-name&gt;
95+
{contents of ml_userriskscore_pivot_transform.json file}
96+
</code></pre></div>
97+
98+
- Navigate to `Transforms` under `Management / Stack Management` in Kibana. Find the transform with the ID `ml_userriskscore_pivot_transform_<your-space-name>`. Open the `Actions` menu on the right side of the row, then click `Start`.
99+
- Confirm the transform is working as expected by navigating to `Management / Dev Tools` and ensuring the target index exists.
100+
101+
<div style="margin-left: 40px">
102+
<i>sample test query</i>
103+
<pre style="margin-top:-2px"><code>GET ml_user_risk_score_&lt;your-space-name&gt;/_search
104+
</code></pre></div>
105+
106+
<h3 id="user-risk-index">5. Create the User Risk Score index</h3>
107+
108+
- Navigate to `Management / Dev Tools` in Kibana.
109+
- Create the User Risk Score index (`ml_user_risk_score_latest_<your-space-name>`) with the following mappings.
110+
- Ensure that your space name (such as `default`) replaces `<your-space-name>` below.
111+
112+
<div style="margin-left: 40px">
113+
<i>creating the User Risk Score index</i>
114+
<pre style="margin-top:-2px"><code>PUT ml_user_risk_score_latest_&lt;your-space-name&gt;
115+
{
116+
"mappings":{
117+
"properties":{
118+
"user.name":{
119+
"type":"keyword"
120+
}
121+
}
122+
}
123+
}
124+
</code></pre></div>
125+
126+
<h3 id="upload-start-latest">6. Upload and start the <code>latest</code> transform</h3>
127+
128+
This transform recurrently calculates risk levels for all usernames in the Kibana space specified.
129+
130+
- Upload the contents of `ml_userriskscore_latest_transform.json` using the Transform API with the following syntax.
131+
- Ensure that your space name (such as `default`) replaces `<your-space-name>` below.
132+
133+
<div style="margin-left: 40px">
134+
<i>uploading latest transform</i>
135+
<pre style="margin-top:-2px"><code>PUT _transform/ml_userriskscore_latest_transform_&lt;your-space-name&gt;
136+
{contents of ml_userriskscore_latest_transform.json file}
137+
</code></pre></div>
138+
139+
- Navigate to `Transforms` under `Management / Stack Management` in Kibana. Find the transform with the ID `ml_userriskscore_latest_transform_<your-space-name>`. Open the `Actions` menu on the right side of the row, and click `Start`.
140+
- Confirm the transform is working as expected by navigating to `Management / Dev Tools` and ensuring the target index exists. You should see documents starting to appear in the index if there is ongoing alerting activity associated with usernames.
141+
142+
<div style="margin-left: 40px">
143+
<i>sample test query</i>
144+
<pre style="margin-top:-2px"><code>GET ml_user_risk_score_latest_&lt;your-space-name&gt;/_search
145+
</code></pre></div>
146+
147+
<h3 id="import-dashboards">7. Import dashboards</h3>
148+
149+
- Navigate to `Management / Stack Management / Kibana / Saved Objects` in Kibana.
150+
- Click on `Import` and import the `ml_userriskscore_dashboards.ndjson` file.
151+
- Navigate to `Analytics / Dashboard`.
152+
- Confirm you can see a dashboard named `Current Risk Scores for Users`, which displays the current list (Top 20) of usernames for which a risk score has been computed.
153+
- Confirm you can see a dashboard named `Drilldown of User Risk Score`, which allows you to further drill down into details of the risk associated with a particular username of interest.
154+
155+
<h3 id="enable-kibana">8. Enable Kibana features</h3>
156+
157+
To enable the Kibana features for User Risk Score, you will first need to add the following configuration to `kibana.yml`.
158+
159+
```
160+
xpack.securitySolution.enableExperimental: ['riskyUsersEnabled']
161+
```
162+
This can be added by editing the kibana.yml file, on a Kibana server instance, or by modifying a Kibana server configuration, in an Elastic Cloud deployment, using the steps documented here:
163+
164+
https://www.elastic.co/guide/en/cloud-enterprise/current/ece-manage-kibana-settings.html
165+
166+
Once you have modified the `kibana.yml` file, you will find User Risk Scoring features in the "User Risk" tab in the detail view for a username. The detail view is reached by clicking a username in the Users page in the Security Solution:
167+
168+
<hr/>
169+
170+

0 commit comments

Comments
 (0)