Skip to content

Commit 5140b8c

Browse files
author
Brent Cook
committed
fix crash on fork with OSX Python meterpreter using SystemConfiguration
Calling into SystemConfiguration before forking seems to allow the child process to use it without a null pointer dereference.
1 parent edbf9b7 commit 5140b8c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

data/meterpreter/meterpreter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# this MUST be imported for urllib to work on OSX
2323
try:
2424
import SystemConfiguration as osxsc
25+
osxsc.SCNetworkInterfaceCopyAll()
2526
has_osxsc = True
2627
except ImportError:
2728
has_osxsc = False
@@ -749,7 +750,7 @@ def create_response(self, request):
749750
resp = struct.pack('>I', len(resp) + 4) + resp
750751
return resp
751752

752-
if not hasattr(os, 'fork') or has_osxsc or (hasattr(os, 'fork') and os.fork() == 0):
753+
if not hasattr(os, 'fork') or (hasattr(os, 'fork') and os.fork() == 0):
753754
if hasattr(os, 'setsid'):
754755
try:
755756
os.setsid()

0 commit comments

Comments
 (0)