-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New process launch API #19108
New process launch API #19108
Conversation
So we actually have a set of integration tests now that run through the meterpreter test suite on multiple different host environments, i.e. windows/ubuntu/osx, so potentially we could update these tests: And it should automatically run through all of the meterpreters on different runtimes - which would give more confidence that things will work beyond just the unit tests that have been added |
5f75fa0
to
e866d89
Compare
1365c4c
to
ebdefa4
Compare
Circling back around to this - it has been integrated with automated tests now. Test suite should run all the things we want it to test, except the backwards compatibility test cases. To test them, I pushed up Github workflow file changes to use the The failing test cases (Python 3 on Windows) were things that were already broken - since fixed in the new version. The old Python meterp:
Make sure to force-revert the last two commits prior to merging. |
16bff11
to
1b169ef
Compare
a1825a9
to
9972587
Compare
Release NotesAdds a new API, |
@@ -22,7 +22,7 @@ class ChildProcess | |||
def initialize | |||
super | |||
|
|||
@default_timeout = ENV['CI'] ? 120 : 40 | |||
@default_timeout = ENV['CI'] ? 480 : 40 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker for me; We might special case this for just targeting the older PHP releases 😄
This creates a new API,
create_process
, which allows the creation of processes from an array of args, rather than from a commandline string that needs to go through a subshell. This places the escaping logic in one place, and lets module developers create more robust code.Verification
You'll need to pull in mettle, as well as the various metasploit-payloads (php, py, c, java)
rapid7/metasploit-payloads#701
rapid7/mettle#258
Test for each of the following:
For each of the above:
create_process
passes parameters exactly as provided.irb
by setting a session - to do this get a Meterpreter session then use a module that take a session as a module options e.g.cloud/kubernetes/enum_kubernetes
runset session -1
hop intoirb
and then you can run the commands.create_process(cmd, args:[...])
. I created a test program to do this - just ask ChatGPT to write you a program that will show you what args were passed to it, each on a new line.cmd_exec
still works as it did before (including buggy calls)cmd_exec
, and then usingcreate_process
on PHP < 7.4 (not supported)You can observe process launches (to check for the presence/absence of subshells) using:
sudo bpftrace -e 'tracepoint:syscalls:sys_enter_exec*{ printf("pid: %d, comm: %s, args: ", pid, comm); join(args->argv); }'
Tests
Windows, new Metasploit, old Meterp
Windows, new Metasploit, new Meterp
Linux, new Metasploit, old Meterp
Linux, new Metasploit, new Meterp
Java, new Metasploit, old Meterp
Java, new Metasploit, new Meterp
Python, new Metasploit, old Meterp
Python, new Metasploit, new Meterp
PHP, new Metasploit, old Meterp
PHP, new Metasploit, new Meterp
PHP < 7.4, new Metasploit, new Meterp
Windows, Command shell
Linux, Command shell
PowerShell