Native JNI Library Extractor

Native_Library_Dropper Malware MEDIUM +5 score

🎮 Minecraft Gameplay Impact

The Java Native Interface (JNI) allows Java programs to invoke compiled C, C++, or Rust code. Core Minecraft dependencies (such as LWJGL for OpenGL/Vulkan rendering and OpenAL for sound) rely on native libraries. Furthermore, several legitimate performance mods (e.g., memory allocators, input latency reducers) bundle native shared libraries for specific operating systems.

Native_Library_Dropper flags classes that extract binary files to temporary locations and load them via System.load(). While this pattern exists in benign system integrations, native libraries can also be used in hostile modifications to execute machine code directly within the process memory space. Native code runs outside the JVM bytecode interpreter, enabling direct memory manipulation and interaction with native operating system APIs.

Because unpacking native libraries is shared by both legitimate optimization libraries and hostile modules, detection severity is categorized as medium (score 5) and requires reviewing the binary payload itself.

🔍 Functions & APIs Analyzed

Files.createTempFile / Files.write

Creates temporary files on disk to receive extracted library bytes.

System.load / System.loadLibrary

Loads native machine-code libraries (.dll, .so, .dylib) into JVM memory.

💻 Mod Implementation (Dev Source / Mapped)

package com.example.nativeloader;

import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;

public class NativeLibraryUnpacker {
    public static void loadEmbeddedLibrary() {
        try {
            String os = System.getProperty("os.name").toLowerCase();
            String libResource = os.contains("win") ? "/natives/render_accel.dll" : "/natives/librender_accel.so";

            Path tempFile = Files.createTempFile("native_cache_", ".tmp");
            tempFile.toFile().deleteOnExit();

            try (InputStream in = NativeLibraryUnpacker.class.getResourceAsStream(libResource)) {
                if (in != null) {
                    byte[] data = in.readAllBytes();
                    Files.write(tempFile, data);
                    System.load(tempFile.toAbsolutePath().toString());
                }
            }
        } catch (Throwable ignored) {
            // Обработка ошибок загрузки библиотеки
        }
    }
}

🛡️ Bytecode Signature & Static Detection

The detector inspects class-level method references for the simultaneous presence of two operational groups:

  • Temporary file creation or writing methods: java/nio/file/Files.createTempFile or java/nio/file/Files.write.
  • Native code loading methods: java/lang/System.load or java/lang/System.loadLibrary.

This combination flags classes that prepare temporary files on disk and subsequently load native shared libraries into the Java Virtual Machine process. The main technical limitation of this static check is that legitimate optimization and hardware-acceleration mods (such as custom rendering engines or audio wrappers) also extract bundled native libraries on startup, which can trigger false positives if not cross-referenced with vendor reputation and package provenance.