|
| 1 | +package fuzion24.device.vulnerability.vulnerabilities.framework.media; |
| 2 | + |
| 3 | +import android.content.Context; |
| 4 | + |
| 5 | +import java.io.ByteArrayOutputStream; |
| 6 | +import java.io.File; |
| 7 | +import java.io.FileInputStream; |
| 8 | +import java.util.ArrayList; |
| 9 | +import java.util.List; |
| 10 | + |
| 11 | +import fuzion24.device.vulnerability.util.CPUArch; |
| 12 | +import fuzion24.device.vulnerability.vulnerabilities.VulnerabilityTest; |
| 13 | +import fuzion24.device.vulnerability.vulnerabilities.helper.BinaryAssets; |
| 14 | +import fuzion24.device.vulnerability.vulnerabilities.helper.KMPMatch; |
| 15 | + |
| 16 | +/** |
| 17 | + * Created by fuzion24 on 12/14/15. |
| 18 | + */ |
| 19 | +public class CVE_2015_6616 implements VulnerabilityTest { |
| 20 | + |
| 21 | +/* |
| 22 | + CVE Bug(s) with AOSP links Severity Affected versions Date reported |
| 23 | + CVE-2015-6616 |
| 24 | + ANDROID-24630158 Critical 6.0 and below Google Internal |
| 25 | + ANDROID-23882800 Critical 6.0 and below Google Internal |
| 26 | + ANDROID-17769851 Critical 5.1 and below Google Internal |
| 27 | + ANDROID-24441553 Critical 6.0 and below Sep 22, 2015 |
| 28 | + ANDROID-24157524 Critical 6.0 Sep 08, 2015 |
| 29 | +
|
| 30 | + ANDROID-24630158 https://android.googlesource.com/platform%2Fframeworks%2Fav/+/77c185d5499d6174e7a97b3e1512994d3a803151 |
| 31 | + ANDROID-23882800 https://android.googlesource.com/platform%2Fframeworks%2Fav/+/0d35dd2068d6422c3c77fb68f248cbabf3d0b10c |
| 32 | + ANDROID-17769851 https://android.googlesource.com/platform%2Fframeworks%2Fav/+/dedaca6f04ac9f95fabe3b64d44cd1a2050f079e |
| 33 | + ANDROID-24441553 https://android.googlesource.com/platform%2Fframeworks%2Fav/+/5d101298d8b0a78a1dc5bd26dbdada411f4ecd4d |
| 34 | + ANDROID-24157524 https://android.googlesource.com/platform%2Fexternal%2Flibavc/+/2ee0c1bced131ffb06d1b430b08a202cd3a52005 |
| 35 | +*/ |
| 36 | + |
| 37 | + @Override |
| 38 | + public String getCVEorID() { |
| 39 | + return "CVE-2015-6616"; |
| 40 | + } |
| 41 | + |
| 42 | + @Override |
| 43 | + public boolean isVulnerable(Context context) throws Exception { |
| 44 | + File stagefrightlib = new File("/system/lib/libstagefright.so"); |
| 45 | + if(!stagefrightlib.exists() || !stagefrightlib.isFile()){ |
| 46 | + throw new Exception("libstagefright.so doesn't exist or is not a file"); |
| 47 | + } |
| 48 | + |
| 49 | + ByteArrayOutputStream libStageFrightBAOS = new ByteArrayOutputStream((int)stagefrightlib.length()); |
| 50 | + BinaryAssets.copy(new FileInputStream(stagefrightlib), libStageFrightBAOS); |
| 51 | + byte[] libstagefrightSO = libStageFrightBAOS.toByteArray(); |
| 52 | + |
| 53 | + KMPMatch binMatcher = new KMPMatch(); |
| 54 | + |
| 55 | + int indexOf = binMatcher.indexOf(libstagefrightSO, "b/24445127".getBytes()); |
| 56 | + boolean libstagefrightVulnerableToBug24445127 = indexOf == -1; |
| 57 | + |
| 58 | + indexOf = binMatcher.indexOf(libstagefrightSO, "bogus max input size: %zu".getBytes()); |
| 59 | + boolean libstagefrightVulnerableToBug17769851 = indexOf == -1; |
| 60 | + |
| 61 | + indexOf = binMatcher.indexOf(libstagefrightSO, "b/24441553, b/24445122".getBytes()); |
| 62 | + boolean libstagefrightVulnerableToBug24441553 = indexOf == -1; |
| 63 | + |
| 64 | + |
| 65 | + return libstagefrightVulnerableToBug24445127 || |
| 66 | + libstagefrightVulnerableToBug17769851 || |
| 67 | + libstagefrightVulnerableToBug24441553; |
| 68 | + } |
| 69 | + |
| 70 | + @Override |
| 71 | + public List<CPUArch> getSupportedArchitectures() { |
| 72 | + List<CPUArch> archs = new ArrayList<>(); |
| 73 | + archs.add(CPUArch.ALL); |
| 74 | + return archs; |
| 75 | + } |
| 76 | +} |
0 commit comments