Android security defense (2): seandroid bionic

Source: Internet
Author: User
Document directory
  • 1. Added system calls.
  • 2. Add at_secure to linker

Android security defense (2): seandroid bionic

Recently, seandroid will conduct comparative analysis on various modules, learn to transplant SELinux to Android, and learn program control policies.

As the first analysis module, bionic briefly describes seandroid for later understanding.

The differences between seandroid and Android are summarized as follows: seandroid = SELinux + Android controls applications through Mac to improve the security of native Android systems.

How to control programs in seandroid

In a word, the program sends a request to seandroid (SELinux). seandroid performs policy analysis based on the policy database, compares the security context, and controls the resource access of the application.

Seandroid bionic

Seandroid has the same architecture and mechanism as SELinux. Considering the characteristics of mobile devices, only a subset of SELinux is transplanted to seandroid.

1. Added system calls.

Compared with Android, seandroid bionic adds 12 system calls:

int fsetxattr(int, const char *, const void *, size_t, int)ssize_t fgetxattr(int, const char *, void *, size_t)ssize_t flistxattr(int, char *, size_t)int fremovexattr(int, const char *)int setxattr(const char *, const char *, const void *, size_t, int)int lsetxattr(const char *, const char *, const void *, size_t, int)ssize_t getxattr(const char *, const char *, void *, size_t)ssize_t lgetxattr(const char *, const char *, void *, size_t)ssize_t listxattr(const char *, char *, size_t)ssize_t llistxattr(const char *, char *, size_t)int removexattr(const char *, const char *)int lremovexattr(const char *, const char *)

2. Add at_secure to linker

SELinux sets the at_secure auxv flag for the loaded application, specifically in Bionic/linker. C:

/* Initialize environment functions, and get to the ELF aux vectors table */vecs = linker_env_init(vecs);/* Check auxv for AT_SECURE first to see if program is setuid, setgid,has file caps, or caused a SELinux/AppArmor domain transition. */for (v = vecs; v[0]; v += 2) {    if (v[0] == AT_SECURE) {    /* kernel told us whether to enable secure mode */        program_is_setuid = v[1];        goto sanitize;    }}/* Kernel did not provide AT_SECURE - fall back on legacy test. */program_is_setuid = (getuid() != geteuid()) || (getgid() != getegid());

To sum up, bionic is not very different, mainly because of the addition of at_secure, SELinux water is very deep, and we recommend you read the article:

Chapter 17th, program management and SELinux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.