package com.device.vulnerability.vulnerabilities.framework.jar;

import android.content.Context;

import com.device.vulnerability.vulnerabilities.VulnerabilityTest;

// https://android.googlesource.com/platform/libcore/+/cb11b9fff2a1af8bb4fcad18986003a7f59189c6 //Tests
// https://android.googlesource.com/platform/libcore/+/2bc5e811a817a8c667bca4318ae98582b0ee6dc6 //Fix
// http://bluebox.com/technical/android-fake-id-vulnerability/

public class JarBug13678484 implements VulnerabilityTest {

    @Override
    public String getName() {
        return "JarBug13678484";
    }

    @Override
    public boolean isVulnerable(Context context) throws Exception {


        return false;
    }

}

package com.device.vulnerability.vulnerabilities.framework.jar;

import android.content.Context;
import android.framework.util.jar.JarFile;
import android.util.Log;

import com.device.vulnerability.vulnerabilities.VulnerabilityTest;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.lang.reflect.Constructor;

// https://android.googlesource.com/platform/libcore/+/cb11b9fff2a1af8bb4fcad18986003a7f59189c6 //Tests
// https://android.googlesource.com/platform/libcore/+/2bc5e811a817a8c667bca4318ae98582b0ee6dc6 //Fix
// http://bluebox.com/technical/android-fake-id-vulnerability/

public class JarBug13678484 implements VulnerabilityTest {

    @Override
    public String getName() {
        return "JarBug13678484";
    }

    @Override
    public boolean isVulnerable(Context context) throws Exception {
        // Check for the existence of this constructor:
        // public JarFile(File file, boolean verify, int mode, boolean chainCheck)
        try {
            java.util.jar.JarFile.class.getConstructor(File.class, boolean.class, int.class, boolean.class);
            return false;
        } catch(NoSuchMethodException e) {
            return true;
        }
    }
}

Fix the device vulnerability detector for the Jar bug
Fix the device vulnerability detector for the Jar bug
