CTS test for Android Security b/65540999
Bug: 65540999
Bug: 68653380
Test: Ran the new testcase on android-8.0.0_r2 (version without patch) and
on android-8.0.0_r30 (version with patch)
Change-Id: Ia89daca5737f23768f96be9af5dd50d53cf20379
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java b/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java
index a43163a..32bdaef 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java
@@ -25,6 +25,7 @@
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import static org.junit.Assert.*;
+import junit.framework.Assert;
@RunWith(DeviceJUnit4ClassRunner.class)
public class TestMedia extends SecurityTestCase {
@@ -121,6 +122,31 @@
}
/**
+ * b/65540999
+ * Vulnerability Behaviour: Assert failure
+ **/
+ @SecurityTest(minPatchLevel = "2017-11")
+ @Test
+ public void testPocCVE_2017_0847() throws Exception {
+ String cmdOut = AdbUtils.runCommandLine("ps -eo cmd,gid | grep mediametrics", getDevice());
+ if (cmdOut.length() > 0) {
+ String[] segment = cmdOut.split("\\s+");
+ if (segment.length > 1) {
+ int gid = -1;
+ if ((segment[1]).length() < Integer.toString(Integer.MAX_VALUE).length()) {
+ try {
+ gid = Integer.parseInt(segment[1]);
+ } catch (NumberFormatException e) {
+ }
+ }
+ if (gid == 0) {
+ fail("mediametrics has root group id");
+ }
+ }
+ }
+ }
+
+ /**
* b/112005441
* Vulnerability Behaviour: EXIT_VULNERABLE (113)
*/