-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Add OSX Periodic Script Peristence #19903
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
base: master
Are you sure you want to change the base?
Conversation
This is great, thanks for adding more persistence mechanisms! My suggestion: wait. There are a LOT of breaking changes introduced in #19815 and you'll need to recode a bunch of this. Because of that, you'll have to rebase after that other PR lands, so I'd just hold tight until @dledda-r7 has some time to finish up and land. Once that PR lands, then there are already 2 other PRs that will need to be rebased and updated, then landed, and yours is 3rd in line. I'll start a non-persistence-overhaul review, but then just hang on for a bit. I promise we won't forget about this! |
Thanks for your pull request! Before this can be merged, we need the following documentation for your module: |
you may want to cleanup the git log here as well, I think 1 commit should be sufficient to get it to this phase. |
Temporarily blocked by #19815 |
def exploit | ||
@cleanup = "sudo " | ||
if target['Arch'] == ARCH_PYTHON | ||
payload_bin = "#!/usr/bin/env python\n" + payload.encoded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be updated to detect the different python2/python3 binary names:
$ python --version
pyenv: python: command not found
sh-3.2$ python3 --version
Python 3.13.2
The payload adapters support this functionality directly, so we should be able to drop python payload and use the cmd adapters instead 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what I should change for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, there should be probably detection for Python version - in the very simple case, calling python --version
and differentiate which Python version to use
Hi @gardnerapp , the PR shouldn't be blocked anymore, so just to give you heads-up. There's still some changes required for this PR, so you can go ahead with them and we'll review it/land it as soon as possible! |
b789581
to
c08790c
Compare
Other operating systems like BSD support periodic scripts with the same |
Yep, that makes sense, it should be probably under |
Hi @gardnerapp, just checking in! There are some comments that have been not addressed, so I wanted to reach out and check if you would need any help/assistance. We would love to have this module, so let me know if I can be of assistance. |
just added default |
The PR is not blocked by persistence directory, we're moving this forward. I would go with moving this module into multi category and adjust the code according to that |
This PR implements OSX persistence via Periodic Scripts, a concept similar to Cron jobs.
Verification
/etc/periodic/*
requires root privileges we will run the executable with sudoIn another terminal:
Knock Knock Scan

LuLu catching the payload executing

Due to #19839 we may need to change the location of the file and carry out other minor refactoring. This module should also work for BSD and other operating systems using
/etc/periodic
but I have not tested on these.