Skip to content
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

[Rule Tuning] persistence_via_cron #4316

Open
farbod-sec opened this issue Dec 19, 2024 · 0 comments
Open

[Rule Tuning] persistence_via_cron #4316

farbod-sec opened this issue Dec 19, 2024 · 0 comments
Assignees
Labels
Rule: Tuning tweaking or tuning an existing rule Team: TRADE

Comments

@farbod-sec
Copy link

Link to Rule

https://github.com/elastic/detection-rules/blob/main/hunting/linux/queries/persistence_via_cron.toml

Rule Tuning Type

None

Description

Might be interesting to also include the possibility of base64 encoded strings in the crontab or IP connections. Hope the regex is correct.

//| WHERE process.parent.name RLIKE """.[0-9]{1,3}(.[0-9]{1,3}){3}.""" // Find hard coded IP addresses
//|WHERE process.parent.name RLIKE """[A-Za-z].+==""" // Find Base64 strings (ending in ==)

Example Data

from logs-endpoint.events.process-*
| WHERE @timestamp > now() - 30 day
| WHERE host.os.type == "linux" and event.action == "exec" and event.type == "start" and process.parent.name in ("cron", "fcron", "atd")
//| WHERE process.parent.name RLIKE """.[0-9]{1,3}(.[0-9]{1,3}){3}.""" // Find hard coded IP addresses
//|WHERE process.parent.name RLIKE """[A-Za-z].+==""" // Find Base64 strings (ending in ==)
| STATS cc = count(), host_count = count_distinct(host.id) by process.command_line
| WHERE host_count <= 3
| SORT cc asc
| LIMIT 100

(commented line 4 + 5)

@farbod-sec farbod-sec added Rule: Tuning tweaking or tuning an existing rule Team: TRADE labels Dec 19, 2024
@Aegrah Aegrah self-assigned this Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rule: Tuning tweaking or tuning an existing rule Team: TRADE
Projects
None yet
Development

No branches or pull requests

2 participants