First of all, you and I seem to have different understanding of "backdoor". For me, if anyone speaks about a backdoor, I imagine something allowing the attacker to control the machine remotely - for example, a trojan, or RAT, or user account they can use to log in, or webshell etc.
What you are talking is something different - how to be able to run an arbitrary command as administrator (or NT AUTHORITY\SYSTEM).
There are multiple ways of course; the first thing popping into my mind is to create a scheduled task that would run any 5 minutes and execute a CMD script located in a folder accessible to the user (%temp%
would do just great - however, in my example I've used a path which is a bit easier to access).
schtasks /create /tn "TestBackdoor" /sc minute /mo 5 /tr "C:\temp\test.cmd" /RU System
Then the user can just create or edit this file, putting any command he likes - it will be executed when the scheduled task runs. For example,
mkdir "C:\temp\btest"
Not a perfect backdoor and quite noisy also - but it's simple, and I thought the key question here was simplicity.
Credit for help with commands to create a scheduled task goes to:
https://superuser.com/questions/850299/windows-scheduler-that-runs-every-x-minutes-daily-on-the-command-line
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks-create#to-schedule-a-task-that-runs-with-system-permissions
bash
somewhere as root and usechmod +s bash
. It's not a backdoor, it's an intended mechanism working as designed.sshd
with a fake user that runs as uid 0. Trojanhttpd
to give you access to another suid program. If you have shell access, litter the file system with suid binaries or modifysudo
to recognize you or even put in a special case inpasswd
. Way too many possibilities to enumerate. Once you have root then the system is yours forever.