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

Add ".bash_profile and .bashrc" attack technique (T1156) #682

Closed
shreyamalviya opened this issue Jun 8, 2020 · 4 comments · Fixed by #687
Closed

Add ".bash_profile and .bashrc" attack technique (T1156) #682

shreyamalviya opened this issue Jun 8, 2020 · 4 comments · Fixed by #687
Assignees
Labels
Feature Issue that describes a new feature to be implemented.
Milestone

Comments

@shreyamalviya
Copy link
Contributor

shreyamalviya commented Jun 8, 2020

T1156

~/.bash_profile and ~/.bashrc are shell scripts that are executed in a user's context when a new shell is opened or when a user logs in so that their environment is set correctly. Adversaries may abuse these shell scripts by adding arbitrary commands that may be used to execute other binaries to gain persistence. Every time the user logs in or opens a new shell, the modified ~/.bash_profile and/or ~/.bashrc scripts will be executed.

Adding it as a PBA:
- LINUX: attempt to add some command (will be commented) to .bash_profile and .bashrc by echo-ing it into the file, and then removing it using sed
- WINDOWS: do the same for profile files in Powershell (refer to this) T1504

Mapping the technique to the ATT&CK matrix

@shreyamalviya shreyamalviya added Monkey Feature Issue that describes a new feature to be implemented. labels Jun 8, 2020
@shreyamalviya shreyamalviya self-assigned this Jun 8, 2020
@acepace
Copy link
Contributor

acepace commented Jun 8, 2020

There's an equivalent of bashrc with powershell profiles.
How will we handle making sure we don't cause real changes to the files?

@shreyamalviya
Copy link
Contributor Author

Oh yeah, updated!

You mean how we'll make sure we're not leaving arbitrary commands in the files? I was thinking we'd add only a comment to the file so that even if there's some issue with deleting it from the file afterwards, it won't execute a random command. Did you mean something else?

@acepace
Copy link
Contributor

acepace commented Jun 9, 2020

I'm pro that. Another option is to add a simple output statement to them so they print on startup.
We should also ask if we want to infect all users we can see, or just the user we're currently running on.

@shreyamalviya
Copy link
Contributor Author

Yeah, although how would we add that to the configuration page? A separate section for just this one PBA?

@ShayNehmad ShayNehmad added this to the 1.9.0 milestone Jun 9, 2020
@shreyamalviya shreyamalviya changed the title Add .bash_profile and .bashrc attack technique (T1156) Add ".bash_profile and .bashrc" attack technique (T1156) Jun 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Issue that describes a new feature to be implemented.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants