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

ZKM reference obfuscation #13

Open
skidunion opened this issue May 9, 2020 · 20 comments
Open

ZKM reference obfuscation #13

skidunion opened this issue May 9, 2020 · 20 comments
Labels
bug Something isn't working

Comments

@skidunion
Copy link

Describe what's not working
The jar is obfuscated by ZKM (unknown version) and has string encryption + reference obfuscation applied. Only the calls to the string decryption method are encrypted. The tool is unable to deobfuscate it.

Java archive
v4_dumpfile.zip

Log / Screenshots
https://hasteb.in/xipijatu.kotlin

Please complete the following information:

  • OS: Windows 10
  • Java version: JRE 8 231
@skidunion skidunion added the bug Something isn't working label May 9, 2020
@GraxCode
Copy link
Owner

GraxCode commented May 9, 2020

Try to use commit 18425c9. There was a bug that blocked reflection where it shouldn't get blocked.

@skidunion
Copy link
Author

Still don't get to deobfuscate it
2020-12-09-02-12.log

@GraxCode
Copy link
Owner

GraxCode commented May 9, 2020

Seems like it is a variant of ZKM invokedynamic obfuscation that doesn't take (J), but instead takes (IJ). I can try to implement that.

@GraxCode
Copy link
Owner

GraxCode commented May 9, 2020

I tried to implement this variant of invokedynamics but it seems like there are some classes missing in your file and therefore it cannot be decrypted :/

@skidunion
Copy link
Author

Oh, that's unfortunate. Anyway, I've made a sample with reference obfuscation, that the tool is unable to deobfuscate, maybe you can take a look
Test.zip
Log: https://hasteb.in/jelumoxe.lua

@GraxCode
Copy link
Owner

GraxCode commented May 9, 2020

Which obfuscator and version is it?

@skidunion
Copy link
Author

ZKM 14

@skidunion
Copy link
Author

Still doesn't work (just compiled the latest version, 2.5.0)
Log: https://hasteb.in/enivotal.makefile

@GraxCode GraxCode reopened this May 12, 2020
@GraxCode
Copy link
Owner

I will have to update the regex for ZKM_INVOKEDYNAMIC_REAL_BOOTSTRAP_DESC. Seems like ZKM implemented multiple decryption longs / ints. You can add a long as last parameter to ZKM_INVOKEDYNAMIC_REAL_BOOTSTRAP_DESC and your Test.jar will probably decrypt.

@GraxCode
Copy link
Owner

Please test if it works.

@skidunion
Copy link
Author

Yep, it works, but some references aren't decrypted sucessfully
Here is the deobfuscated result
image

@skidunion
Copy link
Author

Because of the failures in some cases, it still isn't perfect. Here is another sample with the same reference obfuscation. Only ~30% of the references are decrypted sucessfully

irc-1.0.jar.zip

@GraxCode
Copy link
Owner

Improved it to about 42%. Decryption class often throws NPEs -> i think the cause is that there are some class files / libraries missing.

@DarkyCat
Copy link

I am writing to you again asking for help in decrypting ZKM. Here is the link: https://workupload.com/file/ZhbjSnnnb5K

@d4ft1337
Copy link

d4ft1337 commented Jun 1, 2020

Improved it to about 42%. Decryption class often throws NPEs -> i think the cause is that there are some class files / libraries missing.

Hi, Does ZKM work for 14.0.5? I really need.

@GraxCode
Copy link
Owner

GraxCode commented Jun 4, 2020

Fixed a bug that caused encrypted references with longs or ints as first arguments to fail decryption

@skidunion
Copy link
Author

skidunion commented Jun 10, 2020

I am writing to you again asking for help in decrypting ZKM. Here is the link: https://workupload.com/file/ZhbjSnnnb5K

The following jar uses ZKM's method parameter change (aka hardening string encryption), so its not directly reference obfuscation. With the current build, no strings or references can be decrypted

Edit:
String decryption logs: https://hasteb.in/koqanudi.pl
Reference decryption logs: https://hastebin.com/nejumileni.cs

@GraxCode
Copy link
Owner

I am writing to you again asking for help in decrypting ZKM. Here is the link: https://workupload.com/file/ZhbjSnnnb5K

The following jar uses ZKM's method parameter change (aka hardening string encryption), so its not directly reference obfuscation. With the current build, no strings or references can be decrypted

Edit:
String decryption logs: https://hasteb.in/koqanudi.pl
Reference decryption logs: https://hastebin.com/nejumileni.cs

Seems like a known invalid array index crashes the ConstantTracker. Will fix.

@skidunion
Copy link
Author

skidunion commented Jun 10, 2020

No strings have been decrypted
https://hasteb.in/inudakop.sql

edit: same with references https://hastebin.com/ikekumuqab.cs

@GraxCode
Copy link
Owner

I only fixed the analyzer bugs, I didn't implement ZKM 13+ support yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants