A Linux operating system DBus service security management method, device and product
By loading credit programs and environment variable control plug-ins in the Linux operating system, using whitelists and blacklists to perform security control of DBus services, the security and ease of use of DBus services are solved, and more efficient security policies and generalizations are achieved reduces the security attack surface.
Patent Information
- Application Number
- CN202411347348.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-09-26
AI Technical Summary
Due to its openness and simplicity, DBus services in Linux operating systems are vulnerable to security attacks. The authentication and encryption schemes of the existing technology affect their ease of use and universality. The whitelisting mechanism is easily bypassed, resulting in greater security risks.
Load the credit program and environment variable control plug-in when the DBus service is started, and authenticate and check through the whitelist of credit program and the blacklist of environment variables, realize security control of DBus services, reduce the security attack surface, and optimize security through service grading strategies Control strategy.
It improves the ease of use of front-end applications and the universality of DBus services, significantly reduces the security attack surface, resists program counterfeiting attacks, and balances security and ease of use.
Smart Images

Figure CN118862050B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Linux operating system process communication and network security, and in particular to a Linux operating system DBus service security management and control method, device and product. Background Art
[0002] With the development of information technology and the promotion and popularization of trusted operating systems, the importance of network security and host security of Linux operating systems has been increasingly valued. The DBus bus technology of the Linux operating system has become the most widely used standard process communication mechanism in the Linux operating system due to its many advantages such as simple and easy-to-use framework, open interface, flexible configuration, and convenient permission isolation. It has also incubated many DBus monitoring and debugging tools, such as gdbus and dbus-monitor. Because of these advantages, many background services use the DBus bus to provide service interfaces, and these services are usually run by root privileged processes. However, due to the openness, simplicity, and rich tool characteristics of the DBus bus, many security attack methods targeting DBus system services have been generated, bringing greater security risks to the operating system. According to relevant data statistics, about 50%-60% of the local privilege escalation vulnerabilities exposed by trusted operating systems are attacked through the DBus service interface with root privileges.
[0003] In the Linux operating system, the security solutions for DBus services mainly adopt the following solutions:
[0004] 1. Authentication of the caller for the methods provided by the DBus service: The most commonly used authentication scheme is to add polkit authentication to the service method interface, requiring verification of the user's sudo password before calling the privileged method interface.
[0005] 2. Use customized encryption schemes to ensure communication security: The front-end and back-end programs agree on a mutually known encryption scheme and protect the communication keys. Only the caller who has obtained the key and encryption scheme can call the DBus service method normally.
[0006] For the polkit authentication solution, since polkit authentication causes a pop-up window on the interface, the method call can only be completed after the user enters the sudo password and completes the administrator identity authentication. This solution will affect the usability of the application. In addition, a DBus service usually provides many method interfaces. polkit authentication can only be added to the method interface that actually uses privileges. For other method interfaces, privileges are not actually used, so it is inappropriate to add polkit authentication, which will cause the application to repeatedly pop up an authentication window, or pop up an authentication window when using non-privileged functions. This type of method interface cannot use polkit authentication to ensure its security.
[0007] For customized encryption schemes, the versatility of DBus services will be sacrificed, resulting in only front-end programs that know the key and encryption scheme being able to use the DBus service method. It is impossible for a front-end program with permission to easily call the DBus service method. The front-end program needs a complex encryption scheme integration debugging process to implement interface calls.
[0008] In addition, there is also a technical solution in the prior art for DBus service authorization control through a trusted program whitelist mechanism. However, since there are many whitelist bypass attack methods, programs in the trusted program whitelist can be counterfeited, thus rendering the control ineffective. Summary of the invention
[0009] The purpose of the present invention is to provide a Linux operating system DBus service security management method, device and product, which can effectively reduce the security attack surface of the DBus service through simple configuration and realize the security management of the root privilege DBus service.
[0010] In order to achieve the above object, the technical solution of the present invention is as follows:
[0011] A Linux operating system DBus service security management and control method, comprising:
[0012] S1. The DBus service loads the trusted program control plug-in and the environment variable control plug-in when it starts;
[0013] S2. Authenticate the program that calls the DBus service through the trusted program control plug-in at the method interface of the DBus service;
[0014] S3. After authentication, the environment variables of the program are checked through the environment variable control plug-in at the method interface of the DBus service.
[0015] Furthermore, in step S1, when the DBus service is started, a service classification control module is also loaded to classify the DBus service and determine the control strategy of the authentication and the inspection.
[0016] Furthermore, the specific authentication method of step S2 includes:
[0017] S201, configuring a credit program control vector table for the DBus service;
[0018] S202, when the DBus service is started, the credit program control plug-in initialization function is loaded;
[0019] S203, the credit program control plug-in initialization function finds the credit program control vector table and completes the credit program control vector table initialization;
[0020] S204, when a method call occurs in the DBus service, the trusted program control plug-in authentication interface is called at the method interface, and the trusted program is authenticated according to the trusted program control vector table. If the program calling the DBus service is not in the whitelist of the trusted program control vector table, the method call is prohibited.
[0021] Furthermore, the method for checking the environment variables in step S3 includes:
[0022] S301, configure an environment variable control vector table for the DBus service;
[0023] S302, load the environment variable control plug-in initialization function when the DBus service starts;
[0024] S303, the environment variable control plug-in initialization function finds the environment variable control vector table and completes the initialization of the environment variable control vector table;
[0025] S304, when a method call occurs in the DBus service, after the authentication is passed, the environment variable control plug-in inspection interface is called at the method interface, and the environment variables of the program calling the DBus service are checked according to the environment variable control vector table. If the environment variable is in the blacklist of the environment variable control vector table, the check fails and the method call is prohibited; otherwise, the check passes and the method call is allowed.
[0026] Another aspect of the present invention further provides a Linux operating system DBus service security management and control device, comprising:
[0027] Loading module: used for loading the credit program control plug-in and environment variable control plug-in when the DBus service starts;
[0028] Authentication module: used to authenticate the program that calls the DBus service through the trusted program control plug-in at the method interface of the DBus service;
[0029] Environment detection module: After authentication, it is used to check the environment variables of the program through the environment variable control plug-in at the method interface of the DBus service.
[0030] Furthermore, in the loading module, the DBus service also loads a service classification control module when it is started, which is used to classify the DBus service and determine the control strategy of the authentication and the inspection.
[0031] Furthermore, the authentication module includes:
[0032] Credit control vector table unit: configure the credit program control vector table for DBus service;
[0033] Credit control loading unit: used to load the credit program control plug-in initialization function when the DBus service starts;
[0034] Credit control initialization unit: the credit program control plug-in initialization function finds the credit program control vector table and completes the credit program control vector table initialization;
[0035] Authentication unit: When a method call occurs in the DBus service, the trusted program control plug-in authentication interface is called at the method interface, and the trusted program is authenticated according to the trusted program control vector table. If the program calling the DBus service is not in the whitelist of the trusted program control vector table, the method call is prohibited.
[0036] Furthermore, the environment detection module includes:
[0037] Environment variable vector table unit: configures the environment variable control vector table for DBus service;
[0038] Environment variable control loading unit: loads the environment variable control plug-in initialization function when the service starts;
[0039] Environment variable control initialization unit: the environment variable control plug-in initialization function finds the environment variable control vector table and completes the initialization of the environment variable control vector table;
[0040] Environment detection unit: When a method call occurs in the DBus service, after the authentication is passed, the environment variable control plug-in inspection interface is called at the method interface, and the environment variables of the program calling the DBus service are checked according to the environment variable control vector table. If the environment variable is in the blacklist of the environment variable control vector table, the check fails and the method call is prohibited; otherwise, the check passes and the method call is allowed.
[0041] The present invention also provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the above-mentioned Linux operating system DBus service security management and control method.
[0042] The present invention also provides a computer program product, including a computer program, which implements the above-mentioned Linux operating system DBus service security management and control method when executed by a processor.
[0043] Compared with the prior art, the present invention has the following beneficial effects:
[0044] 1. Increase the usability of front-end applications:
[0045] The present invention performs security management and control through a whitelist of trusted programs, avoids the troubles caused to users by frequent pop-up authorization boxes, and better balances security and ease of use.
[0046] 2. Increase the versatility of DBus services:
[0047] The present invention can realize the non-sensing calling of the application program to the DBus service method by adding an application program to the white list, and has good versatility.
[0048] 3. Reduce the security attack surface of DBus service:
[0049] The present invention only opens the DBus service method to a small number of trusted applications, and the security attack surface is greatly reduced. Only indirect security attacks can be launched through front-end code vulnerabilities of trusted applications to attack the backend DBus service.
[0050] 4. Defend against program phishing attacks:
[0051] The present invention performs strict blacklist control on the environment variables set by the front-end application program that calls the DBus service method, and refuses the program that sets the dangerous environment variables to call the DBus service method, thereby eliminating the whitelist program counterfeit attack. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 is a control structure block diagram of an embodiment of the present invention;
[0053] Figure 2 It is a schematic diagram of the control process of an embodiment of the present invention. DETAILED DESCRIPTION
[0054] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0055] The whitelist mechanism is a common control solution, but there are many whitelist bypass attack methods that can imitate the whitelist, thus making the control ineffective. The design idea of the present invention is based on the whitelist mechanism combined with environmental variable control, and invents and innovates in the following aspects:
[0056] 1. Implement security control in each DBus service method, with flexible configuration, and you can set different control configurations for each method.
[0057] 2. Trusted application whitelist control: The present invention adopts a trusted application whitelist control function, which can achieve simple configuration, take effect in time, and is safe and reliable and cannot be tampered with.
[0058] 3. Environment variable blacklist control: The environment variable blacklist control function adopted by the present invention can effectively resist the counterfeit attack of the trusted application program and ensure the reliability of the security control mechanism.
[0059] 4. DBus service hierarchical control strategy: The operating system DBus service hierarchical control strategy adopted by the present invention classifies DBus services according to several security dimensions and provides a hierarchical control strategy.
[0060] like Figure 1 As shown, the scheme of the present invention specifically includes: the DBus service that needs to be controlled loads and initializes the credit program control plug-in, the environment variable control plug-in, and the service classification control plug-in at startup, and respectively establishes a credit program control vector table, an environment variable control vector table, and a service classification control vector table. Each vector table can be a database or a configuration file, which is transferred to the corresponding control plug-in for initialization and loaded through DBus_name.
[0061] The trusted program control plug-in describes a whitelist of trusted programs. Its control function is: when the front-end application calls the DBus service method, control is implemented in the method interface of the DBus service to prohibit untrusted programs from accessing the DBus service method.
[0062] The environment variable control vector table describes a blacklist of dangerous environment variables. Its control function is: when the front-end application calls the DBus service method, control is implemented in the DBus service method interface to prohibit programs that use dangerous environment variables from accessing the DBus service method.
[0063] The service classification control vector table describes the classification policy configuration. Its control function is to implement different security level control requirements for services with different classification identifiers.
[0064] In this embodiment, the classification strategy divides DBus services into four types, and the management and control strategies are as follows:
[0065] (1) DBus service, a core self-developed component: mandatory control;
[0066] (2) Core open source component DBus service: mandatory control;
[0067] (3) Non-core self-developed component DBus service: optional control;
[0068] (4) Non-core open source component DBus service: optional management.
[0069] Mandatory control: The DBus service is required to configure a control configuration file (trusted program control vector table, environment variable control vector table). If the above control configuration file is missing, the default trusted program whitelist is empty, and no program is allowed to access the DBus service method.
[0070] Optional control strategy: It is not mandatory to configure a control configuration file for the DBus service. If there is a control configuration file, security control is performed according to the control vector in the control configuration file, otherwise no control is performed.
[0071] The standards for grading core self-developed components, core open source components, non-core self-developed components, and non-core open source components can be defined as follows:
[0072] The basic functions that support the operation of the system include: kernel components, system background programs, windows, menus, settings, GUI, network, device management, time, update, security, account management and other components involving the basic functions of the operating system are defined as core components. Then these core components are divided into core self-developed and core open source according to whether the components are open source or self-developed.
[0073] All components except core components are defined as non-core components, and then divided into non-core open source and non-core self-developed components based on whether they are open source or self-developed.
[0074] The method proposed by the present invention is as follows Figure 2 As shown, specifically including:
[0075] 1. Service level management and control:
[0076] The service hierarchical control function is implemented through the service hierarchical control plug-in. When the DBus service process starts, it loads the service hierarchical control plug-in and completes the initialization of the service hierarchical control function.
[0077] The implementation process is as follows:
[0078] 1. Configure a service level control vector table for a DBus service that needs to be controlled; load the service level control plug-in when the DBus service process starts, and pass in the service name, for example: DBus_level_control_init(xxxserver); the service level control plug-in initialization function automatically finds the service level control vector table in the system agreed directory and completes the initialization of the service level control vector table;
[0079] 2. When the front-end application calls the method of the DBus service, the DBus message is forwarded or enters the method function of the DBus service process, triggering the DBus service hierarchical management and control logic.
[0080] 3. The DBus service hierarchical management plug-in obtains the service name of the DBus service that the front-end application wants to access from the message.
[0081] 4. The DBus service hierarchical control plug-in searches for the control policy of the DBus service in the service hierarchical control vector table through the service name. If not found, the default control policy is executed.
[0082] 5. If a DBus service control policy is mandatory control, then if the DBus service is not configured with the trusted program whitelist of the trusted program control vector table and the environment variable blacklist of the environment variable control vector table, any front-end application is prohibited from accessing the DBus service method.
[0083] 6. If a DBus service control policy is optional control, then if the DBus service has a trusted program whitelist configured in the trusted program control vector table and an environment variable blacklist configured in the environment variable control vector table, security control will be performed according to the configuration file, otherwise no control will be performed.
[0084] 2. Credit granting procedure control:
[0085] The credit program control function is implemented through the credit program control plug-in. When the DBus service process starts, it loads the credit program control plug-in and completes the initialization of the credit program control function.
[0086] The implementation process is as follows:
[0087] 1. Configure the credit program control vector table for a DBus service that needs to be controlled; for example, xxxserver_auth_whlist.conf; Load the credit program control plug-in when the DBus service process starts, and pass in the service name and control policy, for example: DBus_auth_control_init(xxxserver, level_control()); xxxserver is the service name, and level_control() is the control policy provided by the service level control plug-in; The credit program control plug-in initialization function automatically finds xxxserver_auth_whlist.conf in the system agreed directory to complete the credit program control vector table initialization;
[0088] 2. When the front-end application calls the method of the DBus service, the DBus message is forwarded or enters the method function of the DBus service process, triggering the DBus service trust program control logic. At the method interface, the trust program control plug-in authentication interface auth_check is called;
[0089] 3. The DBus service trusted program management plug-in obtains the PID information of the front-end application from the DBusConnection handle.
[0090] 4. The DBus service trust program control plug-in is accessed through the / proc / <pid> / exe file obtains the absolute path of the executable program of the front-end application.
[0091] 5. The DBus service trust program management plug-in obtains the service name of the DBus service that the front-end application wants to access from the message.
[0092] 6. The DBus service trusted program control plug-in searches the whitelist in the authorized program control vector table of the DBus service through the service name.
[0093] 7. If the absolute path of the executable program of the front-end application exists in the whitelist of the DBus service, the authentication is passed and the next step of environment variable control is entered; otherwise, the authentication fails and the method call is prohibited.
[0094] 3. Environmental variable control:
[0095] The essence of environment variable control is to perform environment variable blacklist control. Its function is realized through the environment variable control plug-in. When the DBus service process starts, it loads the environment variable control plug-in and completes the initialization of the environment variable control function.
[0096] The implementation process is as follows:
[0097] 1. Configure the environment variable control vector table for a DBus service that needs to be controlled; load the environment variable control plug-in during the DBus service process, and pass in the service name and control strategy, for example: DBus_env_control_init(xxxserver, level_control()); xxxserver is the service name, and level_control() is the control strategy provided by the service hierarchical control plug-in; the environment variable control plug-in initialization function automatically finds the environment variable control vector table in the system agreed directory and completes the initialization of the environment variable control vector table;
[0098] 2. When the front-end application calls the method of the DBus service, the DBus message is forwarded or enters the method function of the DBus service process, triggering the DBus service environment variable control logic. At the method interface, the environment variable control plug-in check interface env_check is called;
[0099] 3. The environment variable control plug-in obtains the PID information of the front-end application from the DBusConnection handle
[0100] 4. The environment variable control plug-in is through the / proc / <pid> / environ file to get a snapshot of the environment variables when the front-end application starts.
[0101] 5 The environment variable control plug-in obtains the service name of the DBus service that the front-end application wants to access from the message.
[0102] 6. The environment variable control plug-in searches the blacklist in the environment variable control vector table by service name.
[0103] 7. If the dangerous environment variables in the environment variable blacklist do not exist in the environment variable snapshot of the front-end application, the check passes and the DBus service method call is allowed. Otherwise, the check fails and the method call is prohibited.
[0104] The above-mentioned embodiments are only preferred implementations of the present invention, and are only used to help understand the method and core ideas of the present application. The protection scope of the present invention is not limited to the above-mentioned embodiments. All technical solutions under the idea of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.< / pid> < / pid>
Claims
1. A Linux operating system DBus service security management and control method, characterized in that: include: S1. The DBus service loads the trusted program control plug-in and the environment variable control plug-in when it starts; S2. Authenticate the program that calls the DBus service through the trusted program control plug-in at the method interface of the DBus service; S3. After authentication, the environment variables of the program are checked through the environment variable control plug-in at the method interface of the DBus service; The specific authentication method of step S2 includes: S201, configuring a credit program control vector table for the DBus service; the credit program control vector table describes a credit program whitelist; S202, when the DBus service is started, the credit program control plug-in initialization function is loaded; S203, the credit program control plug-in initialization function finds the credit program control vector table and completes the credit program control vector table initialization; S204, when a method call occurs in the DBus service, the trusted program control plug-in authentication interface is called at the method interface, and the trusted program authentication is performed according to the trusted program control vector table. If the program calling the DBus service is not in the whitelist of the trusted program control vector table, the method call is prohibited; otherwise, the authentication is passed; The method for checking the environment variables in step S3 includes: S301, configuring an environment variable control vector table for the DBus service; the environment variable control vector table describes a blacklist of dangerous environment variables; S302, load the environment variable control plug-in initialization function when the DBus service starts; S303, the environment variable control plug-in initialization function finds the environment variable control vector table and completes the initialization of the environment variable control vector table; S304, when a method call occurs in the DBus service, after the authentication is passed, the environment variable control plug-in inspection interface is called at the method interface, and the environment variables of the program calling the DBus service are checked according to the environment variable control vector table. If the environment variable is in the blacklist of the environment variable control vector table, the check fails and the method call is prohibited; otherwise, the check passes and the method call is allowed.
2. The Linux operating system DBus service security management and control method according to claim 1 is characterized in that: In step S1, when the DBus service is started, the service classification control module is also loaded to classify the DBus service and determine the control strategy of the authentication and the inspection.
3. A Linux operating system DBus service security management and control device, characterized in that it includes: Loading module: used for loading the credit program control plug-in and environment variable control plug-in when the DBus service starts; Authentication module: used to authenticate the program that calls the DBus service through the trusted program control plug-in at the method interface of the DBus service; Environment detection module: used to check the environment variables of the program through the environment variable control plug-in at the method interface of the DBus service after authentication; The authentication module comprises: Credit control vector table unit: configures a credit program control vector table for the DBus service; the credit program control vector table describes a credit program whitelist; Credit control loading unit: used to load the credit program control plug-in initialization function when the DBus service starts; Credit control initialization unit: the credit program control plug-in initialization function finds the credit program control vector table and completes the credit program control vector table initialization; Authentication unit: When a method call occurs in the DBus service, the authentication interface of the trusted program control plug-in is called at the method interface, and the trusted program is authenticated according to the trusted program control vector table. If the program calling the DBus service is not in the whitelist of the trusted program control vector table, the method call is prohibited; otherwise, the authentication is passed; The environment detection module comprises: Environment variable vector table unit: configures an environment variable control vector table for the DBus service; the environment variable control vector table describes a blacklist of dangerous environment variables; Environment variable control loading unit: loads the environment variable control plug-in initialization function when the service starts; Environment variable control initialization unit: the environment variable control plug-in initialization function finds the environment variable control vector table and completes the initialization of the environment variable control vector table; Environment detection unit: When a method call occurs in the DBus service, after the authentication is passed, the environment variable control plug-in inspection interface is called at the method interface, and the environment variables of the program calling the DBus service are checked according to the environment variable control vector table. If the environment variable is in the blacklist of the environment variable control vector table, the check fails and the method call is prohibited; otherwise, the check passes and the method call is allowed.
4. According to claim 3, the Linux operating system DBus service security management and control device is characterized in that, in the loading module, the DBus service also loads a service classification management and control module when it is started, which is used to classify the DBus service and determine the management and control strategy of the authentication and the inspection.
5. A computer-readable storage medium storing a computer program, characterized in that: The computer program is used to execute the Linux operating system DBus service security management and control method as described in any one of claims 1-2.
6. A computer program product comprising a computer program, characterized in that When the computer program is executed by the processor, the Linux operating system DBus service security management and control method as described in any one of claims 1-2 is implemented.
Citation Information
Patent Citations
Application program authority control method and device and electronic device
CN108985086A
Inter-application data encryption communication method, system and device based on dbus
CN116455638A