Reloading payloads doesn't work
Steps to reproduce
msf6 payload(python/meterpreter_reverse_http) > reload
[*] Reloading module...
[-] Failed to reload: undefined method `loader' for Object:Class
Version
msf6 payload(python/meterpreter_reverse_http) > version
Framework: 6.1.33-dev-e9393e471c
Console : 6.1.33-dev-e9393e471c
Hi!
This issue has been left open with no activity for a while now.
We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.
I took a look into this. It looks like the error is being caused when payloads reload and hit this line: https://github.com/rapid7/metasploit-framework/blob/fedcdc386b1bf06c7fd46d1f196c2c926630d8a7/lib/msf/core/module_manager/reloading.rb#L24 I did some debugging to find this in the stack trace. Based on what I can tell, it's because the payload module that's being reloaded does not have a parent class, which is why when the loader is accessed, we get a nil value. I'm not exactly certain of the heirarchy of modules/classes to pin it down, but at a first glance I notice this doesn't happen in auxiliary/exploit/etc modules because they all are subclasses of their main category module (e.g. https://github.com/rapid7/metasploit-framework/blob/master/modules/auxiliary/scanner/http/azure_ad_login.rb) whereas the payload modules do not, which would explain them not having a parent class available for the reload (e.g. https://github.com/rapid7/metasploit-framework/blob/master/modules/payloads/singles/python/meterpreter_reverse_http.rb). I'm not entirely sure where to fix this in the lib, but these details might help someone who can
Thanks for taking a look! I don't frequently need to reload payloads, so I'll mark this as closed for now.
I believe we'd need to make changes to support calling the recalculation of payload sets to reload a payload module; as a payload module could consist of multiple stages from the filesystem - unlike aux/post/etc modules which have a 1:1 mapping of Ruby code to a file sitting on the disk
Thanks for your contribution to Metasploit Framework! We've looked at this issue, and unfortunately we do not currently have the bandwidth to prioritize this issue.
We've labeled this as attic and closed it for now. If you believe this issue has been closed in error, or that it should be prioritized, please comment with additional information.
For people trying to develop a payload, you can use msfvenom for dev / test cycles
msfvenom -p windows/my_windows_payload