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

Feature: Will bridge Windows Java (OpenJDK17) #328

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

FrankSpierings
Copy link
Contributor

This change will make the jvm.js code be able to bridge Java OpenJDK 17 on Windows. This was tested on Windows 10, using jdk-17.0.11+9 from https://learn.microsoft.com/en-gb/java/openjdk/download and the separately downloaded and extracted debug symbols.

The code is not pretty, but I've tried to keep as close to the original as possible.

Note the bug that I discovered while performing the tests; frida/frida-gum#811. This means that the target process needs to be restarted after detaching Frida, for the Java bridge (resolving of Symbols) to work.

This code currently does not work with OpenJDK21!

This code requires the 'manual' placement of the debug symbols, otherwise jvm.ts will be unable to find the functions it requires.

This change will make the `jvm.js` code be able to bridge Java OpenJDK 17 on Windows. This was tested on Windows 10, using `jdk-17.0.11+9` from https://learn.microsoft.com/en-gb/java/openjdk/download and the separately downloaded and extracted debug symbols.

The code is not pretty, but I've tried to keep as close to the original as possible.

Note the bug that I discovered while performing the tests; frida/frida-gum#811. This means that the target process needs to be restarted after detaching Frida, for the Java bridge (resolving of Symbols) to work.

This code currently does not work with OpenJDK21!

This code requires the 'manual' placement of the debug symbols, otherwise `jvm.ts` will be unable to find the functions it requires.
@CDuPlooy
Copy link

This is super cool, I managed to get it somewhat working by following your instructions and this gist. The example frida script from the gist did work, however if I try to write a hook for a basic class, I get the following:

Unable to make thread_from_jni_environment() helper for the current architecture

This was on an x64 machine, and is as far as I got with debugging; Curious if it works on your side, also happy to help out where possible :)

@FrankSpierings
Copy link
Contributor Author

You are right. I have basic functionality working, so you can create a new instance of a class and execute its methods, but I also noticed that once you attempt to start interception it breaks. Sorry, I should have tested more thoroughly before I went on vacation. I'll attempt to fix this functionality, although it appears more daunting then initially thought.

@oleavr oleavr merged commit b0baa48 into frida:main Aug 30, 2024
5 of 11 checks passed
@oleavr
Copy link
Member

oleavr commented Aug 30, 2024

Thanks! 🙌

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.

3 participants