-
Notifications
You must be signed in to change notification settings - Fork 529
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
[FR] Skip eql optimizations on parsing query for unique fields #3443
Merged
Mikaayenson
merged 3 commits into
main
from
218-add-required_fields-to-detections-rules-that-are-missing-those
Feb 21, 2024
Merged
[FR] Skip eql optimizations on parsing query for unique fields #3443
Mikaayenson
merged 3 commits into
main
from
218-add-required_fields-to-detections-rules-that-are-missing-those
Feb 21, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shashank-elastic
approved these changes
Feb 15, 2024
eric-forte-elastic
approved these changes
Feb 15, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to other optimization fixes. Manual review, LGTM 👍
🟢 Testing Results, required fields present
"required_fields": [
{
"ecs": true,
"name": "event.action",
"type": "keyword"
},
{
"ecs": true,
"name": "event.type",
"type": "keyword"
},
{
"ecs": true,
"name": "host.os.type",
"type": "keyword"
},
{
"ecs": true,
"name": "process.args",
"type": "keyword"
},
{
"ecs": true,
"name": "process.name",
"type": "keyword"
}
],
Details
… 218-add-required_fields-to-detections-rules-that-are-missing-those [!] is v0.1.0 via v3.8.18 (venv) on eric.forte
❯ python -m detection_rules view-rule /home/forteea1/Code/clean_mains/detection-rules/rules/linux/credential_access_gdb_init_memory_dump.toml
█▀▀▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄ ▄ █▀▀▄ ▄ ▄ ▄ ▄▄▄ ▄▄▄
█ █ █▄▄ █ █▄▄ █ █ █ █ █ █▀▄ █ █▄▄▀ █ █ █ █▄▄ █▄▄
█▄▄▀ █▄▄ █ █▄▄ █▄▄ █ ▄█▄ █▄█ █ ▀▄█ █ ▀▄ █▄▄█ █▄▄ █▄▄ ▄▄█
{
"author": [
"Elastic"
],
"description": "This rule monitors for the potential memory dump of the init process (PID 1) through gdb. Attackers may leverage memory dumping techniques to attempt secret extraction from privileged processes. Tools that display this behavior include \"truffleproc\" and \"bash-memory-dump\". This behavior should not happen by default, and should be investigated thoroughly.",
"from": "now-9m",
"index": [
"logs-endpoint.events.*"
],
"language": "eql",
"license": "Elastic License v2",
"name": "Linux init (PID 1) Secret Dump via GDB",
"query": "process where host.os.type == \"linux\" and event.action == \"exec\" and event.type == \"start\" and \nprocess.name == \"gdb\" and process.args in (\"--pid\", \"-p\") and process.args == \"1\"\n",
"references": [
"https://github.com/controlplaneio/truffleproc",
"https://github.com/hajzer/bash-memory-dump"
],
"related_integrations": [
{
"package": "endpoint",
"version": "^8.2.0"
}
],
"required_fields": [
{
"ecs": true,
"name": "event.action",
"type": "keyword"
},
{
"ecs": true,
"name": "event.type",
"type": "keyword"
},
{
"ecs": true,
"name": "host.os.type",
"type": "keyword"
},
{
"ecs": true,
"name": "process.args",
"type": "keyword"
},
{
"ecs": true,
"name": "process.name",
"type": "keyword"
}
],
"risk_score": 47,
"rule_id": "d4ff2f53-c802-4d2e-9fb9-9ecc08356c3f",
"setup": "\nThis rule requires data coming in from Elastic Defend.\n\n### Elastic Defend Integration Setup\nElastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.\n\n#### Prerequisite Requirements:\n- Fleet is required for Elastic Defend.\n- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).\n\n#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:\n- Go to the Kibana home page and click \"Add integrations\".\n- In the query bar, search for \"Elastic Defend\" and select the integration to see more details about it.\n- Click \"Add Elastic Defend\".\n- Configure the integration name and optionally add a description.\n- Select the type of environment you want to protect, either \"Traditional Endpoints\" or \"Cloud Workloads\".\n- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).\n- We suggest selecting \"Complete EDR (Endpoint Detection and Response)\" as a configuration setting, that provides \"All events; all preventions\"\n- Enter a name for the agent policy in \"New agent policy name\". If other agent policies already exist, you can click the \"Existing hosts\" tab and select an existing policy instead.\nFor more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).\n- Click \"Save and Continue\".\n- To complete the integration, select \"Add Elastic Agent to your hosts\" and continue to the next section to install the Elastic Agent on your hosts.\nFor more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).\n\n",
"severity": "medium",
"tags": [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Credential Access",
"Data Source: Elastic Defend"
],
"threat": [
{
"framework": "MITRE ATT&CK",
"tactic": {
"id": "TA0006",
"name": "Credential Access",
"reference": "https://attack.mitre.org/tactics/TA0006/"
},
"technique": [
{
"id": "T1003",
"name": "OS Credential Dumping",
"reference": "https://attack.mitre.org/techniques/T1003/",
"subtechnique": [
{
"id": "T1003.007",
"name": "Proc Filesystem",
"reference": "https://attack.mitre.org/techniques/T1003/007/"
}
]
}
]
}
],
"timestamp_override": "event.ingested",
"type": "eql",
"version": 4
}
…that-are-missing-those
…that-are-missing-those
protectionsmachine
pushed a commit
that referenced
this pull request
Feb 21, 2024
(cherry picked from commit 5420537)
protectionsmachine
pushed a commit
that referenced
this pull request
Feb 21, 2024
(cherry picked from commit 5420537)
protectionsmachine
pushed a commit
that referenced
this pull request
Feb 21, 2024
(cherry picked from commit 5420537)
protectionsmachine
pushed a commit
that referenced
this pull request
Feb 21, 2024
(cherry picked from commit 5420537)
protectionsmachine
pushed a commit
that referenced
this pull request
Feb 21, 2024
(cherry picked from commit 5420537)
protectionsmachine
pushed a commit
that referenced
this pull request
Feb 21, 2024
(cherry picked from commit 5420537)
protectionsmachine
pushed a commit
that referenced
this pull request
Feb 21, 2024
(cherry picked from commit 5420537)
protectionsmachine
pushed a commit
that referenced
this pull request
Feb 21, 2024
(cherry picked from commit 5420537)
protectionsmachine
pushed a commit
that referenced
this pull request
Feb 21, 2024
(cherry picked from commit 5420537)
protectionsmachine
pushed a commit
that referenced
this pull request
Feb 21, 2024
(cherry picked from commit 5420537)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issues
https://github.com/elastic/ia-trade-team/issues/218
Summary
At least one rule (
name = "Linux init (PID 1) Secret Dump via GDB"
) was not populating related fields because it was being optimized incorrectly. This issue is related to #2611 which involves a bug in EQL to properly optimize queries in inset.I've passed eql.parser.skip_optimizations to align with our
test_all_rule_queries_optimized
unit test which also does not optimize.Testing
view-rule
on the rule above to show required_fields populated