Detection rules › Splunk
Linux Magic SysRq Key Abuse
Detects potential abuse of the Linux Magic SysRq (System Request) key by adversaries with root or sufficient privileges to manipulate or destabilize a system. Writing to /proc/sysrq-trigger can crash the system, kill processes, or bypass standard logging. Monitoring SysRq abuse helps detect stealthy post-exploitation activity. Correlate with related EXECVE or PROCTITLE events to identify the process or user responsible for the access or modification.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | T1059.004 Command and Scripting Interpreter: Unix Shell |
| Impact | T1489 Service Stop, T1499 Endpoint Denial of Service, T1529 System Shutdown/Reboot |
Rule body splunk
name: Linux Magic SysRq Key Abuse
id: 22c03600-f84a-47fa-abaa-ffbe3e72c782
version: 5
creation_date: '2025-08-28'
modification_date: '2026-05-13'
author: Milad Cheraghi
status: production
type: TTP
description: |
Detects potential abuse of the Linux Magic SysRq (System Request) key by adversaries with root or sufficient privileges to manipulate or destabilize a system.
Writing to /proc/sysrq-trigger can crash the system, kill processes, or bypass standard logging.
Monitoring SysRq abuse helps detect stealthy post-exploitation activity.
Correlate with related EXECVE or PROCTITLE events to identify the process or user responsible for the access or modification.
data_source:
- Linux Auditd Path
- Linux Auditd Cwd
search: |
`linux_auditd`
(type=PATH OR type=CWD)
| rex "msg=audit\([^)]*:(?<audit_id>\d+)\)"
| stats
values(type) as types
values(name) as names
values(nametype) as nametype
values(cwd) as cwd_list
values(_time) as event_times
by audit_id, host
| eval current_working_directory = coalesce(mvindex(cwd_list, 0), "N/A")
| eval candidate_paths = mvmap(names, if(match(names, "^/"), names, current_working_directory + "/" + names))
| eval matched_paths = mvfilter(match(candidate_paths, ".*/proc/sysrq-trigger|.*/proc/sys/kernel/sysrq|.*/etc/sysctl.conf"))
| eval match_count = mvcount(matched_paths)
| eval reconstructed_path = mvindex(matched_paths, 0)
| eval e_time = mvindex(event_times, 0)
| where match_count > 0
| rename host as dest
| stats count min(e_time) as firstTime max(e_time) as lastTime
values(nametype) as nametype
by current_working_directory
reconstructed_path
match_count
dest
audit_id
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `linux_magic_sysrq_key_abuse_filter`
how_to_implement: |
To implement this detection, ensure auditd is configured to watch:
- /proc/sysrq-trigger
- /proc/sys/kernel/sysrq
- /etc/sysctl.conf
with write and attribute changes (`-p wa`) and key `sysrq`. Make sure the type=CWD record type is activate in your auditd configuration and
Use the Splunk Add-on for Unix and Linux for proper ingestion and CIM normalization.
This enables effective monitoring of Linux endpoints for SysRq abuse.
known_false_positives: |
Legitimate administrative activity modifying SysRq for debugging or recovery.
Please update the filter macros to remove false positives.
references:
- https://www.kernel.org/doc/html/v4.10/_sources/admin-guide/sysrq.txt
- https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/4/html/reference_guide/s3-proc-sys-kernel
- https://www.splunk.com/en_us/blog/security/threat-update-awfulshred-script-wiper.html
drilldown_searches:
- name: View the detection results for - "$dest$"
search: '%original_detection_search% | search dest="$dest$"'
earliest_offset: $info_min_time$
latest_offset: $info_max_time$
- name: View risk events for the last 7 days for - "$dest$"
search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$dest$") | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
earliest_offset: 7d
latest_offset: "0"
finding:
title: Abuse of the Linux Magic System Request key detected on host - [$dest$]
entity:
field: dest
type: system
score: 50
analytic_story:
- Compromised Linux Host
asset_type: Endpoint
mitre_attack_id:
- T1059.004
- T1529
- T1489
- T1499
product:
- Splunk Enterprise
- Splunk Enterprise Security
- Splunk Cloud
category: endpoint
security_domain: endpoint
tests:
- name: True Positive Test
attack_data:
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1529/auditd_path_sysrq/path_sysrq.log
source: auditd
sourcetype: auditd
test_type: unit
Stages and Predicates
Stage 1: search
`linux_auditd`
(type=PATH OR type=CWD)
Stage 2: rex
| rex "msg=audit\([^)]*:(?<audit_id>\d+)\)"
Stage 3: stats
| stats
values(type) as types
values(name) as names
values(nametype) as nametype
values(cwd) as cwd_list
values(_time) as event_times
by audit_id, host
Stage 4: eval
| eval current_working_directory = coalesce(mvindex(cwd_list, 0), "N/A")
Stage 5: eval
| eval candidate_paths = mvmap(names, if(match(names, "^/"), names, current_working_directory + "/" + names))
Stage 6: eval
| eval matched_paths = mvfilter(match(candidate_paths, ".*/proc/sysrq-trigger|.*/proc/sys/kernel/sysrq|.*/etc/sysctl.conf"))
Stage 7: eval
| eval match_count = mvcount(matched_paths)
Stage 8: eval
| eval reconstructed_path = mvindex(matched_paths, 0)
Stage 9: eval
| eval e_time = mvindex(event_times, 0)
Stage 10: where
| where match_count > 0
Stage 11: rename
| rename host as dest
Stage 12: stats
| stats count min(e_time) as firstTime max(e_time) as lastTime
values(nametype) as nametype
by current_working_directory
reconstructed_path
match_count
dest
audit_id
Stage 13: search
| `security_content_ctime(firstTime)`
Stage 14: search
| `security_content_ctime(lastTime)`
Stage 15: search
| `linux_magic_sysrq_key_abuse_filter`
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.
| Field | Kind | Values |
|---|---|---|
match_count | gt |
|
sourcetype | eq |
|
type | eq |
|