android.security.cts.ListeningPortsTest#testNoListeningLoopbackTcp6Ports
android.security.cts.ListeningPortsTest#testNoListeningLoopbackUdp6Ports
android.security.cts.ListeningPortsTest#testNoRemotelyAccessibleListeningUdp6Ports
问题分析
本地测了一下,前两条没问题,那么下面重点先说下第三条的分析流程:
测试命令: run sts-userbuild -m CtsSecurityTestCases -t android.security.cts.ListeningPortsTest#testNoRemotelyAccessibleListeningUdp6Ports
测试结果:
1 2 |
Found port listening on addr=fe80::77b0:8288:f0d8:d4c6, port=40066, UID=1000 [com.miui.screenrecorder, com.qti.service.colorservice, com.qualcomm.atfwd, com.goodix.fingerprint, com.android.wallpaperbackup, com.xiaomi.powerchecker, com.qualcomm.qti.seemp.service, com.qualcomm.qti.smcinvokepkgmgr, com.miui.contentcatcher, com.qualcomm.qti.services.secureui, com.miui.securitycore, com.wapi.wapicertmanage, com.qualcomm.qti.qtisystemservice, com.xiaomi.mbnloader, com.dsi.ant.server, com.xiaomi.location.fused, com.qti.diagservices, com.qualcomm.qti.usta, com.fingerprints.extension.service, com.miui.cleanmaster, com.miui.daemon, com.android.settings, com.android.systemui, com.qti.dpmserviceapp, com.miui.freeform, com.qualcomm.wfd.service, com.xiaomi.bttester, com.quicinc.cne.CNEService, com.miui.powerkeeper, com.qualcomm.location, com.qualcomm.qti.poweroffalarm, com.miui.cloudservice.sysbase, com.qualcomm.qti.callenhancement, com.miui.cit, com.qualcomm.qti.qmmi, org.codeaurora.gps.gpslogsave, com.miui.system, com.miui.touchassistant, com.miui.klo.bugreport, com.android.inputdevices, com.android.providers.settings, com.miui.securitycenter, org.codeaurora.btmultisim, com.xiaomi.joyose, com.qualcomm.qti.seccamservice, com.miui.antispam, com.qualcomm.svi, com.qualcomm.cabl, com.miui.rom, com.miui.bugreport, android, org.simalliance.openmobileapi.service, com.qualcomm.qti.uceShimService, com.android.keychain, com.miui.sysopt, com.miui.wmsvc, com.android.server.telecom, com.miui.qr, com.qti.csm, com.android.provision, com.qualcomm.qti.sensors.qsensortest, com.xiaomi.drivemode, com.android.location.fused] in /proc/net/udp6 Found port listening on addr=fe80::77b0:8288:f0d8:d4c6, port=49636, UID=1000 [com.miui.screenrecorder, com.qti.service.colorservice, com.qualcomm.atfwd, com.goodix.fingerprint, com.android.wallpaperbackup, com.xiaomi.powerchecker, com.qualcomm.qti.seemp.service, com.qualcomm.qti.smcinvokepkgmgr, com.miui.contentcatcher, com.qualcomm.qti.services.secureui, com.miui.securitycore, com.wapi.wapicertmanage, com.qualcomm.qti.qtisystemservice, com.xiaomi.mbnloader, com.dsi.ant.server, com.xiaomi.location.fused, com.qti.diagservices, com.qualcomm.qti.usta, com.fingerprints.extension.service, com.miui.cleanmaster, com.miui.daemon, com.android.settings, com.android.systemui, com.qti.dpmserviceapp, com.miui.freeform, com.qualcomm.wfd.service, com.xiaomi.bttester, com.quicinc.cne.CNEService, com.miui.powerkeeper, com.qualcomm.location, com.qualcomm.qti.poweroffalarm, com.miui.cloudservice.sysbase, com.qualcomm.qti.callenhancement, com.miui.cit, com.qualcomm.qti.qmmi, org.codeaurora.gps.gpslogsave, com.miui.system, com.miui.touchassistant, com.miui.klo.bugreport, com.android.inputdevices, com.android.providers.settings, com.miui.securitycenter, org.codeaurora.btmultisim, com.xiaomi.joyose, com.qualcomm.qti.seccamservice, com.miui.antispam, com.qualcomm.svi, com.qualcomm.cabl, com.miui.rom, com.miui.bugreport, android, org.simalliance.openmobileapi.service, com.qualcomm.qti.uceShimService, com.android.keychain, com.miui.sysopt, com.miui.wmsvc, com.android.server.telecom, com.miui.qr, com.qti.csm, com.android.provision, com.qualcomm.qti.sensors.qsensortest, com.xiaomi.drivemode, com.android.location.fused] in /proc/net/udp6 |
因为报错的uid = 1000,所以共享这个uid的进程都会被打出来,影响真正的判断,因此需要通过下面的步骤找出真正的fail项:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
1. adb shell 2. su 3. polaris:/ # cat /proc/net/udp6 sl local_address remote_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode ref pointer drops 149: 00000000000000000000000000000000:A9CE 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38655 2 0000000000000000 0 841: 000080FE000000008882B077C6D4D8F0:9C82 00000000000000000000000000000000:0000 07 00000000:00000000 00:00000000 00000000 1000 0 35682 2 0000000000000000 0 926: 00000000000000000000000000000000:9CD7 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38659 2 0000000000000000 0 934: 00000000000000000000000000000000:9CDF 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38671 2 0000000000000000 0 1193: 00000000000000000000000000000000:9DE2 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38675 2 0000000000000000 0 2208: 00000000000000000000000000000000:A1D9 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38667 2 0000000000000000 0 2219: 000080FE000000008882B077C6D4D8F0:C1E4 00000000000000000000000000000000:0000 07 00000000:00000000 00:00000000 00000000 1000 0 35680 2 0000000000000000 0 2507: 00000000000000000000000000000000:A304 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38647 2 0000000000000000 0 2595: 00000000000000000000000000000000:C35C 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 37765 2 0000000000000000 0 2596: 00000000000000000000000000000000:C35D 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 37766 2 0000000000000000 0 2597: 00000000000000000000000000000000:C35E 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 37755 2 0000000000000000 0 2598: 00000000000000000000000000000000:C35F 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 37756 2 0000000000000000 0 2603: 00000000000000000000000000000000:C364 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38722 2 0000000000000000 0 2604: 00000000000000000000000000000000:C365 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38723 2 0000000000000000 0 2607: 00000000000000000000000000000000:C368 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38738 2 0000000000000000 0 2608: 00000000000000000000000000000000:C369 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38739 2 0000000000000000 0 2611: 00000000000000000000000000000000:C36C 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38758 2 0000000000000000 0 2612: 00000000000000000000000000000000:C36D 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38759 2 0000000000000000 0 2617: 00000000000000000000000000000000:C372 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 37747 2 0000000000000000 0 2618: 00000000000000000000000000000000:C373 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 37748 2 0000000000000000 0 2619: 00000000000000000000000000000000:C374 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38730 2 0000000000000000 0 2620: 00000000000000000000000000000000:C375 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38731 2 0000000000000000 0 2623: 00000000000000000000000000000000:C378 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38706 2 0000000000000000 0 2624: 00000000000000000000000000000000:C379 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38707 2 0000000000000000 0 2628: 00000000000000000000000000000000:A37D 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38683 2 0000000000000000 0 2629: 00000000000000000000000000000000:C37E 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38698 2 0000000000000000 0 2630: 00000000000000000000000000000000:C37F 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38699 2 0000000000000000 0 2639: 00000000000000000000000000000000:C388 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38768 2 0000000000000000 0 2640: 00000000000000000000000000000000:C389 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38769 2 0000000000000000 0 2641: 00000000000000000000000000000000:C38A 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38746 2 0000000000000000 0 2642: 00000000000000000000000000000000:C38B 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38747 2 0000000000000000 0 2643: 00000000000000000000000000000000:C38C 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38714 2 0000000000000000 0 2644: 00000000000000000000000000000000:C38D 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38715 2 0000000000000000 0 2783: 00000000000000000000000000000000:A418 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38691 2 0000000000000000 0 2925: 00000000000000000000000000000000:A4A6 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38687 2 0000000000000000 0 3446: 00000000000000000000000000000000:A6AF 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38663 2 0000000000000000 0 3497: 00000000000000000000000000000000:A6E2 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38679 2 0000000000000000 0 3771: 00000000000000000000000000000000:A7F4 00000000000000000000000000000000:0000 87 00000000:00000000 00:00000000 00000000 1001 0 38651 2 0000000000000000 0 |
找到uid=1000的行,找出其中的inode值,此处为35682
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
4. polaris:/ # ls -l /proc/*/fd | grep 35682 lrwx------ 1 root root 64 2018-08-13 12:20 26 -> socket:[35682] 5. polaris:/ # ls -l /proc/*/fd/26 l-wx------ 1 root root 64 2018-08-13 12:32 /proc/1018/fd/26 -> /dev/pmsg0 l-wx------ 1 gps gps 64 2018-08-13 12:20 /proc/1023/fd/26 -> pipe:[36017] lrwx------ 1 root root 64 2018-08-13 12:20 /proc/1182/fd/26 -> socket:[29611] lrwx------ 1 radio radio 64 2018-08-13 12:20 /proc/1207/fd/26 -> socket:[37162] lrwx------ 1 root root 64 2018-08-13 12:32 /proc/1222/fd/26 -> socket:[42078] lr-x------ 1 root root 64 2018-08-13 12:20 /proc/1224/fd/26 -> pipe:[33964] lr-x------ 1 system system 64 2018-08-13 12:32 /proc/1397/fd/26 -> /system/framework/android.hidl.manager-V1.0-java.jar lrwx------ 1 root root 64 2018-08-13 12:20 /proc/1725/fd/26 -> socket:[35682] lr-x------ 1 system system 64 2018-08-13 12:32 /proc/1947/fd/26 -> /system/framework/android.hidl.manager-V1.0-java.jar lr-x------ 1 root root 64 2018-08-13 12:20 /proc/1993/fd/26 -> /system/framework/android.hidl.manager-V1.0-java.jar lr-x------ 1 u0_a76 u0_a76 64 2018-08-13 12:32 /proc/2013/fd/26 -> /system/framework/android.hidl.manager-V1.0-java.jar 6. polaris:/ # ps -A | grep 1725 system 1725 1 47296 11704 binder_thread_read 0 S ims_rtp_daemo |
则找到影响的对应进程
问题总结
这个问题如果直接报出其他进程,其实非常好处理;但是报出uid=1000的项,就需要按照上面的步骤确认下再进行处理,后续考虑写成脚本处理