HELK/docker/helk-jupyter/notebooks/sigma/proxy_cobalt_amazon.ipynb

135 lines
3.6 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# CobaltStrike Malleable Amazon browsing traffic profile\n",
"Detects Malleable Amazon Profile"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rule Content\n",
"```\n",
"- title: CobaltStrike Malleable Amazon browsing traffic profile\n",
" id: 953b895e-5cc9-454b-b183-7f3db555452e\n",
" status: experimental\n",
" description: Detects Malleable Amazon Profile\n",
" references:\n",
" - https://github.com/rsmudge/Malleable-C2-Profiles/blob/master/normal/amazon.profile\n",
" - https://www.hybrid-analysis.com/sample/ee5eca8648e45e2fea9dac0d920ef1a1792d8690c41ee7f20343de1927cc88b9?environmentId=100\n",
" author: Markus Neis\n",
" tags:\n",
" - attack.t1102\n",
" logsource:\n",
" category: proxy\n",
" product: null\n",
" service: null\n",
" detection:\n",
" selection1:\n",
" c-useragent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like\n",
" Gecko\n",
" cs-method: GET\n",
" c-uri: /s/ref=nb_sb_noss_1/167-3294888-0262949/field-keywords=books\n",
" cs-host: www.amazon.com\n",
" cs-cookie: '*=csm-hit=s-24KU11BB82RZSYGJ3BDK|1419899012996'\n",
" selection2:\n",
" c-useragent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like\n",
" Gecko\n",
" cs-method: POST\n",
" c-uri: /N4215/adj/amzn.us.sr.aps\n",
" cs-host: www.amazon.com\n",
" condition: selection1 or selection2\n",
" falsepositives:\n",
" - Unknown\n",
" level: high\n",
"\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Querying Elasticsearch"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Import Libraries"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from elasticsearch import Elasticsearch\n",
"from elasticsearch_dsl import Search\n",
"import pandas as pd"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Initialize Elasticsearch client"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"es = Elasticsearch(['http://helk-elasticsearch:9200'])\n",
"searchContext = Search(using=es, index='logs-*', doc_type='doc')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Run Elasticsearch Query"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"s = searchContext.query('query_string', query='(c-useragent:\"Mozilla\\/5.0\\ \\(Windows\\ NT\\ 6.1;\\ WOW64;\\ Trident\\/7.0;\\ rv\\:11.0\\)\\ like\\ Gecko\" AND cs-host:\"www.amazon.com\" AND ((cs-method:\"GET\" AND c-uri:\"\\/s\\/ref\\=nb_sb_noss_1\\/167\\-3294888\\-0262949\\/field\\-keywords\\=books\" AND cs-cookie.keyword:*\\=csm\\-hit\\=s\\-24KU11BB82RZSYGJ3BDK|1419899012996) OR (cs-method:\"POST\" AND c-uri:\"\\/N4215\\/adj\\/amzn.us.sr.aps\")))')\n",
"response = s.execute()\n",
"if response.success():\n",
" df = pd.DataFrame((d.to_dict() for d in s.scan()))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Show Results"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df.head()"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 4
}