2
2
3
3
import android .content .Context ;
4
4
import android .os .Build ;
5
+ import android .util .Log ;
5
6
6
7
import java .io .ByteArrayOutputStream ;
7
8
import java .io .File ;
32
33
33
34
public class CVE_2015_6608 implements VulnerabilityTest {
34
35
36
+ private static final String TAG = "CVE-2015-6608" ;
37
+
35
38
@ Override
36
39
public String getCVEorID () {
37
40
return "CVE-2015-6608" ;
@@ -50,6 +53,8 @@ public boolean isVulnerable(Context context) throws Exception {
50
53
51
54
File softAAClib = new File ("/system/lib/libstagefright_soft_aacdec.so" );
52
55
56
+ File libvorbisidec = new File ("/system/lib/libvorbisidec.so" );
57
+
53
58
if (!stagefrightlib .exists () || !stagefrightlib .isFile ()){
54
59
throw new Exception ("libstagefright.so doesn't exist or is not a file" );
55
60
}
@@ -58,6 +63,11 @@ public boolean isVulnerable(Context context) throws Exception {
58
63
throw new Exception ("libstagefright_soft_aacdec.so does not exist" );
59
64
}
60
65
66
+ if (!libvorbisidec .exists ()){
67
+ throw new Exception ("libvorbisidec.so does not exist" );
68
+ }
69
+
70
+
61
71
ByteArrayOutputStream libStageFrightBAOS = new ByteArrayOutputStream ((int )stagefrightlib .length ());
62
72
BinaryAssets .copy (new FileInputStream (stagefrightlib ), libStageFrightBAOS );
63
73
byte [] libstagefrightSO = libStageFrightBAOS .toByteArray ();
@@ -67,15 +77,25 @@ public boolean isVulnerable(Context context) throws Exception {
67
77
BinaryAssets .copy (new FileInputStream (softAAClib ), libaacdecBAOS );
68
78
byte [] libaacdecSO = libaacdecBAOS .toByteArray ();
69
79
80
+ ByteArrayOutputStream libvorbisidecBAOS = new ByteArrayOutputStream ((int )libvorbisidec .length ());
81
+ BinaryAssets .copy (new FileInputStream (libvorbisidec ), libvorbisidecBAOS );
82
+ byte [] libvorbisidecSO = libvorbisidecBAOS .toByteArray ();
83
+
84
+
70
85
71
86
KMPMatch binMatcher = new KMPMatch ();
72
87
73
88
int indexOf = binMatcher .indexOf (libstagefrightSO , "b/23680780" .getBytes ());
74
89
boolean libstagefrightVulnerableToBug23680780 = indexOf == -1 ;
75
- indexOf = binMatcher .indexOf (libstagefrightSO , "b/23881715" .getBytes ());
90
+ indexOf = binMatcher .indexOf (libvorbisidecSO , "b/23881715" .getBytes ());
76
91
boolean libstagefrightvulnerableToBug23881715 = indexOf == -1 ;
77
92
indexOf = binMatcher .indexOf (libaacdecSO , "b/23876444" .getBytes ());
78
- boolean libstagerightVulnerableToBug23876444 = indexOf == -1 ;
93
+ boolean libstagefrightVulnerableToBug23876444 = indexOf == -1 ;
94
+
95
+
96
+ Log .d (TAG , "libstagefrightVulnerableToBug23680780: " + libstagefrightVulnerableToBug23680780 );
97
+ Log .d (TAG , "libstagefrightvulnerableToBug23881715: " + libstagefrightvulnerableToBug23881715 );
98
+ Log .d (TAG , "libstagefrightVulnerableToBug23876444: " + libstagefrightVulnerableToBug23876444 );
79
99
80
100
//Only affects L and M
81
101
if (Build .VERSION .SDK_INT != Build .VERSION_CODES .M && Build .VERSION .SDK_INT != Build .VERSION_CODES .LOLLIPOP ){
@@ -84,7 +104,7 @@ public boolean isVulnerable(Context context) throws Exception {
84
104
85
105
return libstagefrightVulnerableToBug23680780 ||
86
106
libstagefrightvulnerableToBug23881715 ||
87
- libstagerightVulnerableToBug23876444 ;
107
+ libstagefrightVulnerableToBug23876444 ;
88
108
89
109
}
90
110
0 commit comments