HELK/docker/helk-jupyter/notebooks/sigma/group_modification_logging....

169 lines
5.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Group Modification Logging\n",
"Configure systems to issue a log entry and alert when an account is added to or removed from any group assigned administrative privileges. Sigma detects Event ID 4728 indicates a Member is added to a Security Group. Event ID 4729 indicates a Member is removed from a Security enabled-group. Event ID 4730 indicates aSecurity Group is deleted. The case is not applicable for Unix OS. Supported OS - Windows 2008 R2 and 7, Windows 2012 R2 and 8.1, Windows 2016 and 10 Windows Server 2019, Windows Server 2000, Windows 2003 and XP."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rule Content\n",
"```\n",
"- title: Group Modification Logging\n",
" id: 9cf01b6c-e723-4841-a868-6d7f8245ca6e\n",
" description: \"Configure systems to issue a log entry and alert when an account is\\\n",
" \\ added to or removed from any group assigned administrative privileges. Sigma\\\n",
" \\ detects Event ID 4728 indicates a \\u2018Member is added to a Security Group\\u2019\\\n",
" . Event ID 4729 indicates a \\u2018Member is removed from a Security enabled-group\\u2019\\\n",
" . Event ID 4730 indicates a\\u2018Security Group is deleted\\u2019. The case is\\\n",
" \\ not applicable for Unix OS. Supported OS - Windows 2008 R2 and 7, Windows 2012\\\n",
" \\ R2 and 8.1, Windows 2016 and 10 Windows Server 2019, Windows Server 2000, Windows\\\n",
" \\ 2003 and XP.\"\n",
" author: Alexandr Yampolskyi, SOC Prime\n",
" status: stable\n",
" references:\n",
" - https://www.cisecurity.org/controls/cis-controls-list/\n",
" - https://www.pcisecuritystandards.org/documents/PCI_DSS_v3-2-1.pdf\n",
" - https://nvlpubs.nist.gov/nistpubs/CSWP/NIST.CSWP.04162018.pdf\n",
" - https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventID=4728\n",
" - https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventID=4729\n",
" - https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventID=4730\n",
" - https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventID=633\n",
" - https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventID=632\n",
" - https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventID=634\n",
" date: 2019/03/26\n",
" logsource:\n",
" product: windows\n",
" service: security\n",
" category: null\n",
" detection:\n",
" selection:\n",
" EventID:\n",
" - 4728\n",
" - 4729\n",
" - 4730\n",
" - 633\n",
" - 632\n",
" - 634\n",
" condition: selection\n",
" falsepositives:\n",
" - unknown\n",
" level: low\n",
" tags:\n",
" - CSC4\n",
" - CSC4.8\n",
" - NIST CSF 1.1 PR.AC-4\n",
" - NIST CSF 1.1 PR.AT-2\n",
" - NIST CSF 1.1 PR.MA-2\n",
" - NIST CSF 1.1 PR.PT-3\n",
" - ISO 27002-2013 A.9.1.1\n",
" - ISO 27002-2013 A.9.2.2\n",
" - ISO 27002-2013 A.9.2.3\n",
" - ISO 27002-2013 A.9.2.4\n",
" - ISO 27002-2013 A.9.2.5\n",
" - ISO 27002-2013 A.9.2.6\n",
" - ISO 27002-2013 A.9.3.1\n",
" - ISO 27002-2013 A.9.4.1\n",
" - ISO 27002-2013 A.9.4.2\n",
" - ISO 27002-2013 A.9.4.3\n",
" - ISO 27002-2013 A.9.4.4\n",
" - PCI DSS 3.2 2.1\n",
" - PCI DSS 3.2 7.1\n",
" - PCI DSS 3.2 7.2\n",
" - PCI DSS 3.2 7.3\n",
" - PCI DSS 3.2 8.1\n",
" - PCI DSS 3.2 8.2\n",
" - PCI DSS 3.2 8.3\n",
" - PCI DSS 3.2 8.7\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-endpoint-winevent-security-*', 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='event_id:(\"4728\" OR \"4729\" OR \"4730\" OR \"633\" OR \"632\" OR \"634\")')\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
}