How to Do Android App Security Testing: A Guide for Developers and Testers

WBOY
Release: 2024-07-18 00:40:31
Original
712 people have browsed it

소개

Android 휴대폰의 열렬한 팬으로서 휴대폰이 갑자기 떨어지면 가장 먼저 "맙소사!"라고 생각하시겠습니까? 아니면 Google Pay나 Paypal에 있는 돈이 안전하지 않다고요? 최신에 다운로드한 앱에서 지루한 각종 광고는 물론 예상치 못한 알림까지 뜬다면 피싱 시도라고 생각하고 즉시 앱을 삭제하시겠습니까?

Android 보안 취약점에 대한 인식이 부족한 사용자에게 우리 앱이 안전한 환경을 제공하도록 어떻게 보장할 수 있나요? Android 생태계의 보안 취약점은 무엇입니까? 새로운 Android 보안 테스트 기술을 어디에서 살펴볼 수 있나요? 보안 테스트 프로세스를 어떻게 간소화할 수 있나요?

일반적인 Android 보안 취약점

첫째, Android 운영 체제의 오픈 소스 개발 장점은 Android 시스템의 샌드박스 시스템(즉, 가상 머신)과 같은 개발 시 내재된 보안 문제도 숨깁니다. 그러나 기본 계층에는 취약점이 하나씩 있어 악성 프로그램(또는 도구)이 루트 액세스 권한을 얻고 샌드박스의 제한 사항을 깨뜨릴 수 있습니다. PC 시대와 마찬가지로 절대적으로 안전한 PC 운영 체제는 없습니다. 모바일 인터넷 시대에도 절대적으로 안전한 모바일 운영체제는 없습니다. Android 오픈소스 생태계의 보안 위험은 피묻은 경보종과 같아서 모든 Android 개발자의 마음을 강타합니다.

둘째, Android APP/SDK 개발 과정의 보안 위험은 알려지지 않은 블랙홀과 같습니다. 보안 대결의 종착점이 어디인지, 공격자가 누구인지, 터미네이터가 누구인지, 어떻게 방어해야 하는지 우리는 결코 알 수 없습니다.

마지막으로, 사용자 수준에서 일반적이고 인식할 수 있는 보안 동작 취약점은 무엇입니까?

Android 앱과 SDK 모두 어느 정도 보안 취약점을 갖고 있습니다. 아마도 어느 날 귀하의 애플리케이션이 위의 보안 취약점 중 하나의 영향을 받을 수도 있습니다. 공교롭게도 최근 Android SDK를 테스트하던 중 Android 애플리케이션 구성 요소와 관련된 보안 취약점을 발견했습니다. 이 예를 바탕으로 Android SDK 보안 테스트를 위한 방법, 기술 및 프로세스가 요약되어 있습니다.

Android 앱의 보안 테스트 예

취약성 원인 개요
애플리케이션(이하 애플리케이션)의 선택적 구성 요소인 Android SDK는 Java 계층 서비스가 활성 상태인지 모니터링하기 위해 로컬에서 임의의 포트를 열었습니다. 그러나 Java 레이어는 컴포넌트와 통신할 때 입력 매개변수를 엄격하게 확인하지 않기 때문에 Linux 시스템의 "system()" 함수 호출 시 공격 코드가 가득 차고 악성 공격이 발생할 가능성이 있습니다.

다음 스크린샷은 시뮬레이션 포트가 공격받은 후 통신 중에 애플리케이션 구성 요소 의도가 URL 콘텐츠를 수정하고 Webview에 잘못된 코드가 표시되는 것을 보여줍니다.

Garbled code

취약점으로 인한 잠재적인 보안 위험

Android 앱의 4가지 주요 애플리케이션 구성 요소인 활동, 수신자, 서비스 및 콘텐츠 제공자와 IPC용 인텐트를 통해 통신하는 애플리케이션 구성 요소의 보안 역할에 대해서는 여기서 자세히 논의하지 않습니다. 위 예시의 구성요소 관련 취약점을 활용하여 다음 다이어그램은 단말 APP 측과 관련된 공격 차원을 보여줍니다.

Attack dimensions

Android 앱의 로컬 애플리케이션 환경으로 인해 네트워크 소켓에는 본질적으로 세분화된 인증 및 권한 부여 메커니즘이 부족합니다. 따라서 안드로이드 클라이언트를 서버로 사용하고 역코드를 이용해 애플리케이션의 로컬 랜덤 포트 번호를 검색해 적극적으로 해당 포트로 공격을 보내면 다음과 같은 보안 위험이 도사리고 있다.

  1. 로컬 명령 실행: 내장된 애플리케이션의 패키지 이름을 애플리케이션 자체로 지정하고 구성 요소 이름을 애플리케이션의 활동으로 지정하면 보호된 비내보내기 활동을 포함하여 애플리케이션의 모든 활동을 시작할 수 있습니다. 활동으로 인해 보안 위험이 발생합니다. 예를 들어 HTTP 요청을 통해 내보내지 않은 여러 활동을 하나씩 시작하면 서비스 거부 취약점을 찾을 수 있습니다.

  2. Command control to modify application permissions: Pass in the intention to start Android application components through the open socket port, and then execute operations such as starting activity and sending broadcast with the permissions of the attacked application. Because the intents passed in through the socket cannot perform fine-grained checks on the identity and permissions of the sender, bypassing the permission protection provided by Android for application components, and can start the unexported and permission-protected application components, posing a security hazard

  3. Sensitive information disclosure, mobile phone control: A local service opens the UDP port to listen, and after receiving a specific command word, it can return the sensitive information of the mobile phone. For example, Baidu mobile phone butler can remotely manage the cell phone's secretKey, and then unauthorized attackers can fully manage the cell phone through the network.

Android Security Testing Execution

Android Security Hardening Version Optimization

  1. Add checks for system commands and special character filtering in both the Native and Java layers.

  2. Encrypt socket communication for JNI Watchdog daemon process.

  3. Add feature verification for URLs, intents, and activities in local notification functions to prevent redirection to malicious links when clicking on notifications.

  4. Change the storage location of Package name in the app's local storage.

  5. Add online configuration functionality.

These are the important requirements for this security hardening optimization.

Special Security Testing

If you follow conventional system testing or performance testing, you only need to perform forward testing based on the changing requirements. However, for security testing, ensuring the robustness of the SDK's security requires reverse special testing, simulating various security attack methods, and diverging test cases for the modified points.

Android Regular Security Regression Testing

  1. Privacy data: External storage security and internal storage security; check if user names, passwords, chat records, configuration information, and other private information are saved locally and encrypted; verify the integrity of the information before using it.

  2. Permission attacks: Check the app's directory and ensure that its permissions do not allow other group members to read or write; check if system permissions are under attack.

  3. Android component permission protection: Prevent app internal components from being arbitrarily called by third-party programs: prevent Activities from being called by third-party programs, prevent Activity hijacking; ensure Broadcast reception and transmission security, only receive broadcasts sent out by the app, and prevent third parties from receiving transmitted content; prevent maliciously starting or stopping services; check Content Provider operation permissions; if components need to be called externally, verify if signature restrictions have been applied to the caller.

  4. Upgrades: Check the integrity and legality of the upgrade package to avoid hijacking.

  5. 3rd-party libraries: If third-party libraries are used, follow up on their updates and check their security.

  6. ROM security: Use official ROMs or ROMs provided by authoritative teams to avoid the addition of implanted ads, Trojans, etc.

  7. Anti-cracking countermeasures: Counteract decompilation, making it impossible to decompile using decompilation tools or obtain the correct disassembly code after decompilation; counteract static analysis by using code obfuscation and encryption; counteract dynamic debugging by adding code to detect debuggers and emulators; prevent recompilation by checking signatures and verifying the hash value of the compiled dex file.

After completing the security special testing and regular process testing, perform rolling regression testing for the app's existing features, compatibility between new and old versions, and compatibility with different Android operating system versions.

Wrap-up

Compared to ordinary performance and system functionality test cases, security test cases require a more comprehensive understanding of the Android ecosystem, such as: covering user security appearance level, application system local and remote attack level, and operating system vulnerability level, with more focus on designing reverse attack thinking test cases.

如果说开发的出发点是安全防御,那么测试的出发点就是黑客攻击思维。针对攻击场景设计测试用例并实施攻击测试技术决定了SDK安全性的稳健性。

为了确保您的应用程序具有最高级别的安全性,请考虑使用 WeTest 应用程序安全测试。该服务对应用程序中的安全问题进行全面评估,及时发现程序漏洞,并提供代码修复示例,协助漏洞修复。

相信 WeTest 能够保护您的应用程序免受潜在威胁并保持安全的用户体验。

Image description

The above is the detailed content of How to Do Android App Security Testing: A Guide for Developers and Testers. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!