I'm looking to overwrite a method in the com.sun.crypto.provider.AESCryptclass at run time to aid in reverse engineering a piece of malware, the malware uses a custom AES implementation that I am trying to replicate in the expandToSubKey method. How would I go about overwriting the method at run time so that I could setup a standard AES decrypt method to use my modified function
This is possible. There seem to be two approaches.
com.sun.crypto.provider.AESCrypt class when you start the java process using java assist. There is a very good blog outlining everything you need to do here.You can create class with exactly same full name in your project, copy code from library's class into your new class and change pieces of code you want to change. When JVM classloader will be asked to load AESCrypt class it will first look for it in classes inside your project so your custom version of AESCrypt will be loaded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With