Skip to content

[New Rule] SUID/SGUID Enumeration Detected #2956

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

Merged
merged 6 commits into from
Aug 3, 2023
Merged

Conversation

Aegrah
Copy link
Contributor

@Aegrah Aegrah commented Jul 24, 2023

Summary

This rule monitors for the usage of the "find" command in conjunction with SUID and SGUID permission arguments. SUID (Set User ID) and SGID (Set Group ID) are special permissions in Linux that allow a program to execute with the privileges of the file owner or group, respectively, rather than the privileges of the user running the program. Attackers can leverage these permissions to escalate privileges by exploiting vulnerabilities or built-in features in the privileged program.

Detection

The rule was tested in RedSector, and shows 0 hits in the last 365 days. However, tools such as linpeas and linenum are detected through this logic.

process where host.os.type == "linux" and event.action == "exec" and event.type == "start" and 
process.name == "find" and process.args : "-perm" and process.args : (
"/6000", "-6000", "/4000", "-4000", "/2000", "-2000", "/u=s", "-u=s", "/g=s", "-g=s", "/u=s,g=s", "/g=s,u=s"
) and not user.Ext.real.id : "0" and not group.Ext.real.id : "0"
image

Comment on lines 15 to 16
Attackers can leverage these permissions to escalate privileges by exploiting vulnerabilities or built-in features
in the privileged program.
Copy link
Contributor

Choose a reason for hiding this comment

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

We could focus a bit more on the enumeration here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added an additional line to the description that talks about enumeration.

@Aegrah Aegrah requested a review from w0rk3r July 25, 2023 14:02
Copy link
Contributor

@w0rk3r w0rk3r left a comment

Choose a reason for hiding this comment

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

Awesome 🧙🏼

Copy link
Contributor

@brokensound77 brokensound77 left a comment

Choose a reason for hiding this comment

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

LGTM :shipit:

@Aegrah Aegrah merged commit 03110fb into main Aug 3, 2023
@Aegrah Aegrah deleted the new-rule-suid-sguid-enum branch August 3, 2023 07:57
protectionsmachine pushed a commit that referenced this pull request Aug 3, 2023
* [New Rule] SUID/SGUID Enumeration Detected

* Remove endgame compatibility

* readded endgame support after troubleshooting

* Update discovery_suid_sguid_enumeration.toml

* Update rules/linux/discovery_suid_sguid_enumeration.toml

Co-authored-by: Justin Ibarra <[email protected]>

---------

Co-authored-by: Justin Ibarra <[email protected]>

(cherry picked from commit 03110fb)
protectionsmachine pushed a commit that referenced this pull request Aug 3, 2023
* [New Rule] SUID/SGUID Enumeration Detected

* Remove endgame compatibility

* readded endgame support after troubleshooting

* Update discovery_suid_sguid_enumeration.toml

* Update rules/linux/discovery_suid_sguid_enumeration.toml

Co-authored-by: Justin Ibarra <[email protected]>

---------

Co-authored-by: Justin Ibarra <[email protected]>

(cherry picked from commit 03110fb)
protectionsmachine pushed a commit that referenced this pull request Aug 3, 2023
* [New Rule] SUID/SGUID Enumeration Detected

* Remove endgame compatibility

* readded endgame support after troubleshooting

* Update discovery_suid_sguid_enumeration.toml

* Update rules/linux/discovery_suid_sguid_enumeration.toml

Co-authored-by: Justin Ibarra <[email protected]>

---------

Co-authored-by: Justin Ibarra <[email protected]>

(cherry picked from commit 03110fb)
protectionsmachine pushed a commit that referenced this pull request Aug 3, 2023
* [New Rule] SUID/SGUID Enumeration Detected

* Remove endgame compatibility

* readded endgame support after troubleshooting

* Update discovery_suid_sguid_enumeration.toml

* Update rules/linux/discovery_suid_sguid_enumeration.toml

Co-authored-by: Justin Ibarra <[email protected]>

---------

Co-authored-by: Justin Ibarra <[email protected]>

(cherry picked from commit 03110fb)
protectionsmachine pushed a commit that referenced this pull request Aug 3, 2023
* [New Rule] SUID/SGUID Enumeration Detected

* Remove endgame compatibility

* readded endgame support after troubleshooting

* Update discovery_suid_sguid_enumeration.toml

* Update rules/linux/discovery_suid_sguid_enumeration.toml

Co-authored-by: Justin Ibarra <[email protected]>

---------

Co-authored-by: Justin Ibarra <[email protected]>

(cherry picked from commit 03110fb)
protectionsmachine pushed a commit that referenced this pull request Aug 3, 2023
* [New Rule] SUID/SGUID Enumeration Detected

* Remove endgame compatibility

* readded endgame support after troubleshooting

* Update discovery_suid_sguid_enumeration.toml

* Update rules/linux/discovery_suid_sguid_enumeration.toml

Co-authored-by: Justin Ibarra <[email protected]>

---------

Co-authored-by: Justin Ibarra <[email protected]>

(cherry picked from commit 03110fb)
protectionsmachine pushed a commit that referenced this pull request Aug 3, 2023
* [New Rule] SUID/SGUID Enumeration Detected

* Remove endgame compatibility

* readded endgame support after troubleshooting

* Update discovery_suid_sguid_enumeration.toml

* Update rules/linux/discovery_suid_sguid_enumeration.toml

Co-authored-by: Justin Ibarra <[email protected]>

---------

Co-authored-by: Justin Ibarra <[email protected]>

(cherry picked from commit 03110fb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants