
In Linux/Unix systems, the find command is a powerful tool for file searching, with the -exec parameter allowing specified operations on found files. However, this parameter can also be used to execute arbitrary shell commands, becoming a covert command execution technique. Attackers can exploit this feature to execute unauthorized commands on target systems, especially when the find command runs with privileged user permissions (such as root), potentially leading to privilege escalation, lateral movement, or other malicious activities.
Create a detection rule to identify suspicious behavior where shell execution occurs through the find command’s -exec parameter. You need to focus on combinations of the find command with the -exec parameter followed by shell program execution (such as /bin/sh, /bin/bash, etc.) or commands that might lead to code execution. Be sure to capture different variants while balancing detection rates and false positives.
Data source: Sysmon, sample data:
{ "Name": "ParentUser", "Guid": "{ff032593-a8d3-4f13-b0d6-01fc615a0f97}", "EventID": "1", "Version": "5", "Level": "4", "Task": "1", "Opcode": "0", "Keywords": "0x8000000000000000", "SystemTime": "2025-03-14T03:49:29.566449000Z", "EventRecordID": "9633", "ProcessID": "1827", "ThreadID": "1827", "Channel": "Linux-Sysmon/Operational", "Computer": "ubuntu-soclabs", "UserId": "0", "RuleName": "-", "UtcTime": "2025-03-14 03:49:29.567", "ProcessGuid": "{09a89e73-a749-67d3-c1ac-93ffd75a0000}", "ProcessId": "2904", "Image": "/usr/bin/find", "FileVersion": "-", "Description": "-", "Product": "-", "Company": "-", "OriginalFileName": "-", "CommandLine": "find . -exec /bin/bash ; -quit", "CurrentDirectory": "/home", "User": "root", "LogonGuid": "{09a89e73-a5e8-67d3-0000-000002000000}", "LogonId": "0", "TerminalSessionId": "8", "IntegrityLevel": "no level", "Hashes": "SHA256=ac1ea1c5391de921aca1572f1bf25d03707beb3887b27c16a5b4948fd553941b", "ParentProcessGuid": "{09a89e73-a5e8-67d3-2d33-ecad835b0000}", "ParentProcessId": "2297", "ParentImage": "/usr/bin/bash", "ParentCommandLine": "-bash", "ParentUser": "root", "timestamp": "2025-03-14T03:52:51.173517"}
No fields found