Skip to content

Add nursery rules for Linux kernel rootkit techniques#1136

Open
aryanyk wants to merge 2 commits intomandiant:masterfrom
aryanyk:linux-rootkit-rules
Open

Add nursery rules for Linux kernel rootkit techniques#1136
aryanyk wants to merge 2 commits intomandiant:masterfrom
aryanyk:linux-rootkit-rules

Conversation

@aryanyk
Copy link

@aryanyk aryanyk commented Mar 11, 2026

Fixes #998

Description

This PR adds two new nursery rules for detecting Linux kernel rootkit techniques.

The first rule detects privilege escalation patterns commonly used in Linux kernel rootkits where elevated credentials are created using prepare_kernel_cred and applied via commit_creds.

The second rule detects registration of Netfilter hooks through nf_register_net_hook or nf_register_hook, which can be used by kernel modules to intercept or modify network traffic.

Both rules target Linux kernel module behavior that may indicate rootkit activity.

Rules Added

  1. escalate privileges via commit_creds on Linux
    Detects the use of the prepare_kernel_credcommit_creds API pattern frequently used by kernel rootkits to escalate privileges.

  2. register Netfilter hook on Linux
    Detects the registration of Netfilter hooks (nf_register_net_hook or nf_register_hook) that may be used to inspect or manipulate packet flow.

Testing

The rules were validated using the capa linting utilities.

Commands used:

python ../capa/scripts/lint.py -t "escalate privileges via commit_creds on Linux" -v .
python ../capa/scripts/lint.py -t "register Netfilter hook on Linux" -v .

Both rules pass lint checks.
Examples are not included yet, so the rules remain in the nursery directory.

References

AI Usage

AI tools were used to assist with drafting rule descriptions and refining rule structure. All rule logic and validation steps were reviewed and tested manually.

Copy link
Collaborator

@mike-hunhoff mike-hunhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @aryanyk , I've left comments for your review.

static: function
dynamic: call
att&ck:
- Defense Evasion::Impair Defenses [T1562]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain why this is a good fit.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registering Netfilter hooks allows a kernel module to intercept, inspect, or modify network traffic at different stages of the networking stack. Malicious kernel modules and rootkits often use this capability to hide network activity or manipulate packets, which aligns with ATT&CK technique T1562 (Impair Defenses).

static: function
dynamic: call
att&ck:
- Privilege Escalation::Exploitation for Privilege Escalation [T1068]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain how this is a good fit.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This technique maps well to ATT&CK T1068 (Exploitation for Privilege Escalation) because Linux kernel rootkits commonly elevate privileges by creating a new credential structure with prepare_kernel_cred and applying it using commit_creds, effectively granting root privileges to the current process.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use your own personal knowledge, analysis and words. we all have access to LLM-based tools, so when we respond to you, we're not asking you to ask the LLM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux kernel rootkit techniques

3 participants