Skip to content

Java 9-23 Hackery, destroys module system + reflection filters

License

Notifications You must be signed in to change notification settings

Rongmario/ImagineBreaker

Repository files navigation

Imagine Breaker [幻想殺し]

I will destroy that illusion of yours.

With the love of JNI Unsafe & MethodHandles/VarHandles API from Java 9 - 23, this provides:

  1. Public-facing sun.misc.Unsafe API instance & maximum priviledge (TRUSTED) MethodHandles$Lookup instance.

  2. Breaking down the Java Platform Module System (JPMS) to open up any specified module

  3. Disguise as any specified Module, in order to fool @CallerSensitive methods

  4. Removal of Reflection Filters, allows retrieval of any fields from classes that were previously blocked:

    • jdk.internal.reflect.ConstantPool
    • jdk.internal.reflect.Reflection
    • jdk.internal.reflect.UnsafeStaticFieldAccessorImpl
    • java.lang.Class
    • java.lang.ClassLoader
    • java.lang.reflect.Constructor
    • java.lang.reflect.Field
    • java.lang.reflect.Method
    • java.lang.Module
    • java.lang.System
    • java.lang.invoke.MethodHandles$Lookup
    • java.lang.reflect.AccessibleObject

Usage

build.gradle:

repositories {
    maven {
        url 'https://maven.cleanroommc.com'
    }
}

dependencies {
    implementation 'zone.rong:imaginebreaker:2.1'
}

Namesake: Toaru Majutsu no Index