Skip to content
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

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

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

smashery
Copy link
Contributor

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):

  • In MSF, check out the new_cmd_exec branch
  • Build the java solution (run make when in a directory adjacent to MSF)
  • Create a java payload (java/meterpreter/reverse_tcp), and run it on Windows
  • Catch the shell in MSF - validate that it warns that ext_server_stdapi.jar is being used
  • loadpath test/modules/
  • use post/test/cmd_exec
  • run with the captured session
  • Validate that all tests pass

@adfoster-r7 adfoster-r7 marked this pull request as ready for review October 16, 2024 10:04
@adfoster-r7 adfoster-r7 merged commit af3e145 into rapid7:master Oct 16, 2024
25 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants