1 /* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.security.cts; 18 19 import static com.android.sts.common.NativePoc.Bitness.ONLY64; 20 import static com.android.sts.common.NativePocCrashAsserter.assertNoCrash; 21 22 import static com.google.common.truth.TruthJUnit.assume; 23 24 import android.platform.test.annotations.AsbSecurityTest; 25 26 import com.android.sts.common.NativePoc; 27 import com.android.sts.common.tradefed.testtype.NonRootSecurityTestCase; 28 import com.android.sts.common.util.TombstoneUtils; 29 import com.android.sts.common.util.TombstoneUtils.Config.BacktraceFilterPattern; 30 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner; 31 32 import org.junit.Test; 33 import org.junit.runner.RunWith; 34 35 @RunWith(DeviceJUnit4ClassRunner.class) 36 public class CVE_2020_0039 extends NonRootSecurityTestCase { 37 38 @Test 39 @AsbSecurityTest(cveBugId = 143155861) testPocCVE_2020_0039()40 public void testPocCVE_2020_0039() { 41 try { 42 AdbUtils.assumeHasNfc(getDevice()); 43 44 final String binaryName = "CVE-2020-0039"; 45 final TombstoneUtils.Config crashConfig = 46 new TombstoneUtils.Config() 47 .setProcessPatterns(binaryName) 48 .setBacktraceIncludes( 49 new BacktraceFilterPattern( 50 "libnfc-nci", "rw_i93_sm_update_ndef")); 51 52 NativePoc.builder() 53 .bitness(ONLY64) 54 .pocName(binaryName) 55 .asserter(assertNoCrash(crashConfig)) 56 .build() 57 .run(this); 58 } catch (Exception e) { 59 assume().that(e).isNull(); 60 } 61 } 62 } 63