转自:https://community.rapid7.com/thread/3822
What you are experiencing is common on systems in the wild (I see it more often in VM environments). Basically, the process you’re exploiting is not stable enough to keep a shell open, and as you seem to already know, you need to migrate into another process ASAP in order to keep your shell. Instead of set PrependMigrate true try:
set InitialAutoRunScript migrate -f
I have had better experiences with this method than with the PrependMigrate method.
nap_