Special Linux permission management derived from fastboot no permissions of Android: SUID, SGID, SBIT, and androidfastboot

Source: Internet
Author: User

Special Linux permission management derived from fastboot no permissions of Android: SUID, SGID, SBIT, and androidfastboot

Preface

These special permissions are mentioned because the fastboot command seems to be a bit of a breeze. It gives people the feeling that sometimes it can be used and sometimes it cannot be used to execute fastboot devicesErrorPrompt:

no permissions


I thought about the cause.


This problem generally occurs in the following two scenarios:

1. Copy and use the new fastboot Executable File

2. changed the environment variable of the fastboot executable file.


Why are such errors in the above two scenarios?

which fastbootll fastboot

After executing these two commands, we can see that the fastboot command was copied or used by others,As a result, the user and group to which fastboot belongs have changed, so that SUID and SGID are invalid.Because the user and group to which fastboot belongs are root.

Next, let's take a look at the knowledge points behind the no permissions caused by the failure of SUID and SGID.

SUID

Set UID, which appears on the execution bit of the file owner permission.The binary program is valid. The executor must have the x permission on the program.The executor has the permissions of the program owner while the program is running.

For example, a common user executes fastboot and passwd commands.

Many root tools on Android attack SUID or SGID permissions through some vulnerabilities (such as buffer overflow, in addition, the user or user group is the root binary program to temporarily obtain the root permission, and then execute a piece of pre-compiled malicious target platform code to achieve the root goal.

SGID

Set GID, which appears on the execution bit of the object group permission,Valid for both files and directories. The specific functions are as follows:

1. For Files

For a binary program, the program executor must have the x permission, and the executor will obtain the permissions of the program user group during execution (It is equivalent to a user group temporarily added to the program.)

2. For the Directory

The user has the rx permission to access the directory. After the user enters the directory, the valid user group will become the user group of the directory,If the user has the wx permission in this directory, the user group of the files created by the user is the same as the user group in this directory.

SBIT

Sticky BIT, which appears on the execution BIT of other user permissions,Valid only for directoriesWhen you have wx permission on a directory, only the user and root can delete the files or directories created in the directory.


How to set these special permissions

If the chmod is represented by numbers, there is a group more than the three normal groups of numbers. The meanings of the group more are as follows:

4: SUID2: SGID1: SBIT

Here is a simple example:

chmod 4777 test1
The above command adds SUID permission to test1, and other combinations can be freely used.


Note the following if the chmod is represented by the + and-letters,If you do not have the x permission, directly + s or + t will be displayed as uppercase S or TIn this case, you don't have to worry about it. Just give it the + x permission.

If you need to set the correct special permissions when using letters, you can refer to the following simple examples:

chmod u+x+s xxxxchmod g+x+s xxxxchmod o+x+t xxxx


There are also some important knowledge points hidden behind a small problem. They are good at discovering and summarizing and always have some gains.

Finally, we will record this issue and hope to help those who encounter similar problems in the future.


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.