Android는 Android 보안 모델의 일부로 보안 강화 Linux(SELinux)를 사용하여 루트 및 수퍼유저 권한으로 실행되는 프로세스(Linux 기능)를 포함한 모든 프로세스에 강제 액세스 제어(MAC)를 적용합니다. 많은 회사와 조직이 Android의 SELinux 구현에 기여했습니다. SELinux를 통해 Android는 시스템 서비스를 더 안전하게 보호하고 제한하며 애플리케이션 데이터 및 시스템 로그 액세스를 제어하고 악성 소프트웨어의 영향을 줄이며 휴대기기의 잠재적인 코드 결함을 방지할 수 있습니다.
SELinux는 기본 거부 원칙에 따라 작동합니다. 명시적으로 허용되지 않은 것은 거부됩니다. SELinux는 다음과 같이 두 가지 전체 모드로 작동할 수 있습니다.
허용 모드로, 허용 거부가 로깅되지만 적용되지 않습니다.
강제 적용 모드로, 허용 거부가 모두 로깅 및 강제 적용됩니다.
Android에는 강제 적용 모드의 SELinux와 AOSP에서 기본적으로 작동하며 상응하는 보안 정책이 포함됩니다. 강제 적용 모드에서는 허용되지 않는 작업이 방지되고 모든 위반 시도를 커널이 dmesg 및 logcat에 로깅합니다. 개발할 때 이러한 오류를 사용하여 소프트웨어 및 SELinux 정책을 구체화한 후에 적용해야 합니다. 자세한 내용은 SELinux 구현을 참조하세요.
또한 SELinux는 도메인별 허용 모드를 지원합니다. 이 모드에서는 특정 도메인(프로세스)을 허용으로 설정하고 시스템의 나머지 부분을 전체 적용 모드로 설정할 수 있습니다. 도메인은 단순히 보안 정책의 프로세스를 알려 주는 라벨로서
동일한 도메인으로 라벨이 지정된 모든 프로세스는
보안 정책에 따라 동일하게 처리됩니다. 도메인별
허용 모드에서는 새 서비스를 위해 점차 증가하는
시스템 및 정책 개발에 SELinux를 점진적으로 적용하면서
시스템의 나머지 부분을 적용 상태로 유지할 수 있습니다.
백그라운드
Android 보안 모델은 애플리케이션 샌드박스 개념에 부분적으로 기반합니다. 각 애플리케이션은 자체 샌드박스에서 실행됩니다. Android 4.3 이전에는 설치 시 각 애플리케이션의 고유한 Linux UID를 생성하여 샌드박스를 정의했습니다.
Android 4.3 이상은 SELinux를 사용하여 Android 애플리케이션 샌드박스의 경계를 더욱 자세히 정의합니다.
Android 5.0 이상에서 SELinux는 Android 4.3의 허용 버전 및 Android 4.4의 부분 적용을 바탕으로 완전히 적용됩니다.
이번 변경에 따라 Android에서 중요한 도메인 몇 개(installd, netd, vold, zygote)에서 전체 도메인(60개 이상)으로 적용 범위가 확대되었습니다. 구체적인 사항은 다음과 같습니다.
Android 5.x 이상에서는 모든 도메인이 강제 적용 모드로 설정됩니다.
init 이외의 프로세스는 init 도메인에서 실행될 수 없습니다.
모든 제네릭 거부(block_device,
socket_device, default_service)는 기기에
특수 도메인이 필요하다는 것을 나타냅니다.
Android 6.0에서는 정책 허용 범위를 줄이는 방식으로 시스템을 강화하여 보다 효과적인 사용자 간 격리, IOCTL 필터링, 노출된 서비스의 위협 감소, SELinux 도메인의 더 긴밀한 연결, 매우 제한된 /proc 액세스를 포함했습니다.
Android 7.0에서는 SELinux 구성을 업데이트하여 애플리케이션 샌드박스에 추가적인 잠금 기능을 제공하고 공격 표면을 줄였습니다. 또한 이 버전은 모놀리식 미디어 서버 스택을 작은 프로세스로 분할하여 권한 범위를 줄였습니다. 자세한 내용은
추가 Linux 커널 방어 조치를 통한
Android 보호 및
미디어 스택 강화를 참조하세요.
Android 8.0에서는 하위 시스템 공급업체 코드와 Android 시스템 프레임워크를 구분하는 Treble과 호환되도록 SELinux를 업데이트했습니다. 이 버전은 SELinux 정책을 업데이트하여 기기 제조업체와 SOC 공급업체가 정책 일부를 업데이트하고 이미지(vendor.img, boot.img 등)를 빌드하여 플랫폼과 독립적으로 이미지를 업데이트하거나 이미지와 독립적으로 플랫폼을 업데이트하도록 허용합니다.
더 높은 버전 또는 최신 버전의 플랫폼이나 프레임워크가
기기에서 실행될 수 있지만 반대의 경우는 지원되지 않습니다.
공급업체 이미지(vendor.img/odm.img)는 플랫폼(system.img)보다
최신 버전일 수 없습니다. 따라서 최신 플랫폼 버전에서 플랫폼 SELinux
정책이 공급업체 SELinux 정책보다 최신 버전이기 때문에
SELinux 호환성 문제가 발생할 수 있습니다. Android 8.0 모델은 불필요한 동시 OTA를 방지하기 위해 호환성 유지 메서드를 제공합니다.
추가 리소스
유용한 SELinux 정책을 구성하는 방법은 다음 리소스를 참고하세요.
SELinux 노트, SELinux에 대한 최신 참조입니다. 이 문서에는
정책 언어, 각 키워드의 의미, 보안 컨텍스트 계산 방법이 자세히
설명되어 있습니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Security-Enhanced Linux in Android\n\nAs part of the Android [security model](/docs/security), Android uses Security-Enhanced Linux (SELinux) to enforce\nmandatory access control (MAC) over all processes, even processes running with\nroot/superuser privileges (Linux capabilities). Many companies and organizations\nhave contributed to Android's\n[SELinux\nimplementation](https://android.googlesource.com/platform/external/selinux/). With SELinux, Android can better protect and confine system\nservices, control access to application data and system logs, reduce the effects\nof malicious software, and protect users from potential flaws in code on mobile\ndevices.\n\nSELinux operates on the principle of default denial: Anything not explicitly\nallowed is denied. SELinux can operate in two global modes:\n\n- *Permissive* mode, in which permission denials are logged but not enforced.\n- *Enforcing* mode, in which permissions denials are both logged **and** enforced.\n\nAndroid includes SELinux in enforcing mode and a corresponding security\npolicy that works by default across AOSP. In enforcing mode, disallowed\nactions are prevented and all attempted violations are logged by the kernel to\n`dmesg` and `logcat`. When developing, you should\nuse these errors to refine your software and SELinux policies before enforcing\nthem. For more details, see [Implementing\nSELinux](/docs/security/features/selinux/implement).\n\nSELinux also supports a *per-domain permissive* mode in which specific\ndomains (processes) can be made permissive while placing the rest of the system\nin global enforcing mode. A domain is simply a label identifying a process or\nset of processes in the security policy, where all processes labeled with the\nsame domain are treated identically by the security policy. Per-domain\npermissive mode enables incremental application of SELinux to an ever-increasing\nportion of the system and policy development for new services (while keeping\nthe rest of the system enforcing).\n\nBackground\n----------\n\nThe Android security model is based in part on the concept of\n[application sandboxes](/docs/security/app-sandbox). Each application\nruns in its own sandbox. Prior to Android 4.3, these sandboxes were defined by\nthe creation of a unique Linux UID for each application at time of installation.\nAndroid 4.3 and later uses SELinux to further define the boundaries of the\nAndroid application sandbox.\n\nIn Android 5.0 and later, SELinux is fully enforced, building on the\npermissive release of Android 4.3 and the partial enforcement of Android 4.4.\nWith this change, Android shifted from enforcement on a limited set of crucial\ndomains (`installd`, `netd`, `vold` and\n`zygote`) to everything (more than 60 domains). Specifically:\n\n- Everything is in enforcing mode in Android 5.x and higher.\n- No processes other than `init` should run in the `init` domain.\n- Any generic denial (for a `block_device`, `socket_device`, `default_service`) indicates that device needs a special domain.\n\nAndroid 6.0 hardened the system by reducing the permissiveness of our\npolicy to include better isolation between users, IOCTL filtering, reduced\nthreat of exposed services, further tightening of SELinux domains, and\nextremely limited `/proc` access.\n\nAndroid 7.0 updated SELinux configuration to further lock down the\napplication sandbox and reduce attack surface. This release also broke up the\nmonolithic mediaserver stack into smaller processes to reduce the scope of\ntheir permissions. For more details, see\n[Protecting\nAndroid with more Linux kernel defenses](https://android-developers.googleblog.com/2016/07/protecting-android-with-more-linux.html) and\n[Hardening the media stack](https://android-developers.googleblog.com/2016/05/hardening-media-stack.html).\n\nAndroid 8.0 updated SELinux to work with [Treble](/docs/core/architecture#hidl), which separates the lower-level\nvendor code from the Android system framework. This release updated SELinux\npolicy to allow device manufacturers and SOC vendors to update their parts of\nthe policy, build their images (`vendor.img`, `boot.img`,\netc.), then update those images independent of the platform or vice versa.\n\nWhile it is possible to have higher/newer platform (framework) version\nrunning on the device, the opposite case is not supported; the vendor images\n(`vendor.img/odm.img`) cannot have a newer version than the platform\n(`system.img`). So, a newer platform version might introduce SELinux\ncompatibility issues because the platform SELinux policy is at a newer version\nthan vendor SELinux parts of the policy. The Android 8.0 model provides a method\nto [retain compatibility](/docs/security/features/selinux/compatibility) to prevent\nunnecessary simultaneous OTAs.\n\nAdditional resources\n--------------------\n\nFor help constructing useful SELinux policies, refer to the following\nresources.\n\n| **Note:** Some SELinux concepts are not used by Android. For further details, see [Specificity](/docs/security/features/selinux/concepts#specificity).\n\n\u003cbr /\u003e\n\n- [The SELinux Notebook](https://github.com/SELinuxProject/selinux-notebook), up-to-date reference for SELinux. This document contains further details on the policy language, the meaning of each of the keywords and how security contexts are computed.\n- [Your visual how-to guide for SELinux policy enforcement](https://opensource.com/business/13/11/selinux-policy-guide)\n- [Security Enhancements for Linux](https://events.static.linuxfound.org/sites/events/files/slides/abs2014_seforandroid_smalley.pdf)\n- [Security Enhanced (SE) Android: Bringing Flexible MAC to Android](http://www.cs.columbia.edu/~lierranli/coms6998-7Spring2014/papers/SEAndroid-NDSS2013.pdf)\n- [Implementing SELinux as a Linux Security Module](https://www.nsa.gov/resources/everyone/digital-media-center/publications/research-papers/assets/files/implementing-selinux-as-linux-security-module-report.pdf)\n- [Configuring the SELinux Policy](https://www.nsa.gov/resources/everyone/digital-media-center/publications/research-papers/assets/files/configuring-selinux-policy-report.pdf)"]]