You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cron is pretty much always there, we can rely on it. It also has per user abilities so we don't need to run as root to run it.
But why not applicable in Windows? Ah, that's because in Windows it's T1053
Last, how will we handle leftovers? Are we leaving a command running in the victim PC till end of time? What command will we leave?
It also has per user abilities so we don't need to run as root to run it.
I can't add files to /etc/cron.* without root permissions. I can edit crontab using crontab -e but how would I do that in a single command? When we're using cronab -e, it creates a temporary copy of the crontab file in /tmp which is edited and then runs some checks before installing it to the actual crontab file (see this).
About the command to leave, we can just leave in a comment in the file we're editing so nothing will run.
Cron files exist per user under /var/spool/cron/crontab/. While the file itself is accessible by the user (since the user is the owner), the user doesn't have access to the directory that it is a part of, so the user can't write to the file without root permission.
But as a user, you can use crontab -e to edit the file. This creates a temporary copy of /var/spool/cron/crontab/myusername in /tmp which the user can edit, and before adding the changes to the actual cron file, some checks are run on it.
However, given that using crontab -e creates a temporary copy of the cron file to edit, how would we make changes to it using just a command? It creates a file with a random name under /tmp which we can't know beforehand.
Activity
acepace commentedon Jun 8, 2020
Cron is pretty much always there, we can rely on it. It also has per user abilities so we don't need to run as root to run it.
But why not applicable in Windows? Ah, that's because in Windows it's T1053
Last, how will we handle leftovers? Are we leaving a command running in the victim PC till end of time? What command will we leave?
shreyamalviya commentedon Jun 9, 2020
I can't add files to
/etc/cron.*without root permissions. I can edit crontab usingcrontab -ebut how would I do that in a single command? When we're usingcronab -e, it creates a temporary copy of the crontab file in/tmpwhich is edited and then runs some checks before installing it to the actual crontab file (see this).About the command to leave, we can just leave in a comment in the file we're editing so nothing will run.
acepace commentedon Jun 9, 2020
Can you explain further? Cron files can exist for per users, I assume there's a command or a file to be created.
shreyamalviya commentedon Jun 9, 2020
Cron files exist per user under
/var/spool/cron/crontab/. While the file itself is accessible by the user (since the user is the owner), the user doesn't have access to the directory that it is a part of, so the user can't write to the file without root permission.But as a user, you can use
crontab -eto edit the file. This creates a temporary copy of/var/spool/cron/crontab/myusernamein/tmpwhich the user can edit, and before adding the changes to the actual cron file, some checks are run on it.However, given that using
crontab -ecreates a temporary copy of the cron file to edit, how would we make changes to it using just a command? It creates a file with a random name under/tmpwhich we can't know beforehand.