rapid7 / metasploit-payloads

Unified repository for different Metasploit Framework payloads
Other
1.75k stars 673 forks source link

Handle discrepancy of process launching on Windows between different versions of Java #726

Closed smashery closed 1 month ago

smashery commented 1 month ago

This fixes a test failure when running acceptance tests with Java 8 on Windows.

image

At some point in the past, it seems that OpenJDK decided to change the behaviour of ProcessBuilder on Windows, to partially-but-not-entirely start doing some argv-like escaping when converting to a Windows command line.

Seems like it's just better for us to avoid letting Java do any smarts, and just create a command line string that is passed straight to the CreateProcess API, which we know has been consistent since the dawn of time.

Verification

On both older (Java 8? 11?) and newer (tested on Java 16):