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

121 lines
2.6 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# SSHD Error Message CVE-2018-15473\n",
"Detects exploitation attempt using public exploit code for CVE-2018-15473"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rule Content\n",
"```\n",
"- title: SSHD Error Message CVE-2018-15473\n",
" id: 4c9d903d-4939-4094-ade0-3cb748f4d7da\n",
" description: Detects exploitation attempt using public exploit code for CVE-2018-15473\n",
" references:\n",
" - https://github.com/Rhynorater/CVE-2018-15473-Exploit\n",
" author: Florian Roth\n",
" date: 2017/08/24\n",
" logsource:\n",
" product: linux\n",
" service: sshd\n",
" category: null\n",
" detection:\n",
" keywords:\n",
" - 'error: buffer_get_ret: trying to get more bytes 1907 than in buffer 308 [preauth]'\n",
" condition: keywords\n",
" falsepositives:\n",
" - Unknown\n",
" level: medium\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='error\\:\\ buffer_get_ret\\:\\ trying\\ to\\ get\\ more\\ bytes\\ 1907\\ than\\ in\\ buffer\\ 308\\ \\[preauth\\]')\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
}