WO2014183391A1 - 沙箱内安装软件的方法和系统、计算机存储介质 - Google Patents

沙箱内安装软件的方法和系统、计算机存储介质 Download PDF

Info

Publication number
WO2014183391A1
WO2014183391A1 PCT/CN2013/086713 CN2013086713W WO2014183391A1 WO 2014183391 A1 WO2014183391 A1 WO 2014183391A1 CN 2013086713 W CN2013086713 W CN 2013086713W WO 2014183391 A1 WO2014183391 A1 WO 2014183391A1
Authority
WO
WIPO (PCT)
Prior art keywords
content
file
sandbox
code
super
Prior art date
Application number
PCT/CN2013/086713
Other languages
English (en)
French (fr)
Inventor
龙磊
邱金涛
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2014183391A1 publication Critical patent/WO2014183391A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/51Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems at application loading time, e.g. accepting, rejecting, starting or inhibiting executable software based on integrity or source reliability
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • G06F21/53Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow by executing in a restricted environment, e.g. sandbox or secure virtual machine

Definitions

  • the present invention relates to the field of software installation, and in particular to a method and system for installing software in a sandbox, and a computer storage medium.
  • Debian software refers to an operating system installed on a computer.
  • Cydia refers to a cracking software used on ipone, ipad, etc.
  • a sandbox is a secure environment in which the code running can't modify or view the user's system.
  • a method of installing software in a sandbox comprising the following steps:
  • the injection code content including the super-privileged to-be-installed code and the super-privileged wake-up process identifier
  • a system for installing software in a sandbox comprising:
  • a detection module for detecting whether there is super authority for installing software
  • the search module is configured to search for a file with normal permissions in the sandbox when detecting the super permission of the installed software
  • a backup module for backing up the file
  • a replacement module configured to replace the content of the file with the pre-selected injection code content and the sandbox process identifier, where the injection code content includes a super-privileged to-be-installed code and a super-privileged wake-up process identifier;
  • An injection module configured to activate a super-privileged sandbox process in the sandbox, execute the injected code content, and inject the to-be-installed code into the wake-up process;
  • An execution module configured to activate the wake-up process, and execute the to-be-installed code
  • One or more computer storage media containing computer executable instructions for executing a method of installing software in a sandbox, the method comprising the steps of:
  • the injection code content including the super-privileged to-be-installed code and the super-privileged wake-up process identifier
  • the method and system for installing software in the sandbox described above by replacing the content of the injected code and the sandbox process identifier with the file of the common authority in the sandbox, and then injecting the super-privileged code to be installed into the wake-up process to implement installation and installation.
  • the code implements the installation of super-privileged software in the sandbox, making the installation of the super-privileged software more flexible. It is no longer limited to adding software sources in jailbreak situations, obtaining updated software, searching for the required software, and then searching for the required software. Download to install this installation method.
  • FIG. 1 is a schematic flow chart of a method for installing software in a sandbox in an embodiment
  • FIG. 2 is a schematic flow chart of replacing the content of the pre-selected injection code and the sandbox process identifier with the content of the file;
  • FIG. 3 is a schematic diagram showing the internal structure of a system for installing software in a sandbox in an embodiment
  • FIG. 4 is a schematic diagram showing the internal structure of a system in which software is installed in a sandbox in another embodiment.
  • a method for installing software in a sandbox includes the following steps:
  • step S102 it is detected whether there is super authority for installing software, and if yes, step S104 is performed, otherwise it ends.
  • a jailbroken plugin can be installed on the terminal.
  • the terminal can be a smart phone, a palmtop computer, a personal digital assistant, and the like.
  • the jailbreak plugin can be MobileSubstrate, which can automatically load dynamic libraries under the /Library/MobileSubstrate/DynamicLibraries directory, such as:
  • the dylib file is the execution file, which contains the executed content;
  • the plist file is the file that specifies the injection process identifier to declare the process ID to be injected.
  • the injection process identifier can be the name or number of the injection process.
  • Super privilege refers to the highest privilege that can be used for any operation.
  • Step S104 searching for a file with normal authority in the sandbox.
  • the normal privilege is a relative super privilege, and its privilege range is small, and some operations can be completed.
  • Super system permissions are required for the installation of general system software. Because you cannot change the super-privileged files in the sandbox, you need to search for files with normal permissions.
  • the file that can be written in the /Library/MobileSubstrate/DynamicLibraries directory is searched as a file with normal permissions, such as MobileSafety.dylib and MobileSafety.plist.
  • step S106 the file is backed up.
  • the file includes an execution file and a file specifying the injection process identifier.
  • the injection process identifier can be the name or number of the injection process, and the like. Back up MobileSafety.dylib to backup1 and MobileSafety.plist to backup2 as backup2 file.
  • Step S108 replacing the content of the file with the pre-selected injection code content and the sandbox process identifier.
  • the injection code content includes a super-privileged to-be-installed code and a super-privileged wake-up process identifier.
  • the code to be installed may be Detian software code or Windows operating system code or Android system code.
  • Super-privileged code to be installed and wake-up process means that you need to run under super-privilege.
  • the wakeup process identifier may be a wakeup process name or number, and the corresponding wakeup process may be obtained according to the wakeup process name or number.
  • the sandbox process ID can be the sandbox process name or number, and so on.
  • step S108 includes:
  • Step S208 replacing the content of the injection code with the content of the execution file.
  • the injected code content is compiled to generate an executable file, and the content of the executable file is serialized, the serialized content of the executable file is read, and the content of the executable file is overwritten by the content of the executable file.
  • the string formed by serialization of the contents of the executable file is deserialized and then written into the execution file.
  • the content of the injected code is abcdef
  • the content of the MobileSafety.dylib file is fedcba
  • the content of the MobileSafety.dylib file is overwritten by the injected code content
  • the content of the MobileSafety.dylib file is abcdef.
  • Step S218, replacing the sandbox process identifier with the content of the file of the specified injection process identifier.
  • Step S110 Activate a super-privileged sandbox process in the sandbox, execute the injected code content, and inject the to-be-installed code into the wake-up process.
  • the sandboxd process is responsible for controlling the operation of the sandbox.
  • the process is not a resident process and needs to be started under certain circumstances. For example, in an App (Applicant, Application) entering the sandbox, the sandbox App is retired. Go to the background, as well as some operations of the sandbox app. Start the sandboxd process, load the injected code content, and execute the super permission code into the sandboxd process.
  • the super privilege code includes the code to be installed (dpkg) and the reboot code (reboot). Because the sandboxd process has an unstable and automatic exit mechanism, the wake-up process is used to perform the operation on the installed code.
  • the corresponding sandbox process can be obtained, and the corresponding sandbox process can be obtained according to the sandbox process name or number.
  • the wakeup process can be a Locationd process or a Configd process.
  • Step S112 the wakeup process is activated, and the code to be installed is executed.
  • the wakeup process is a Locationd process
  • the Locationd process is activated
  • the detian software is installed using the dpkg command.
  • the corresponding wakeup process can be obtained, and the corresponding wakeup process can be obtained according to the wakeup process name or number.
  • Step S114 restoring the backed up file after the installation is completed.
  • the method further includes the steps of: restarting or deregistering the terminal.
  • the terminal can be automatically restarted or logged out by the reboot or killallSpringBoard command.
  • SpringBoard belongs to the Dock structure, including iDevice's unlocked main menu interface, Spotlight search interface and multi-tasking switch menu. It exists in the iDevice process and can be restarted through killallSpringBoard. The installation is complete after restarting or logging out.
  • the method for installing software in the above sandbox by replacing the injecting code content and the sandbox process identifier with the file of the common authority in the sandbox, and then injecting the super-privileged to-be-installed code into the wake-up process, thereby implementing the installation of the to-be-installed code,
  • the software for installing super-privilege in the sandbox is realized, which makes the installation of the super-privileged software more flexible, and the installation method is suitable for promoting the application of the debtian software.
  • a system for installing software in a sandbox includes a detection module 102, a search module 104, a backup module 106, a replacement module 108, an injection module 110, an execution module 112, and a recovery module 114. . among them:
  • the detection module 102 is configured to detect whether there is super authority to install the software.
  • Super privilege root privilege refers to the highest privilege that can be used for any operation.
  • the search module 104 is configured to search for a file with normal permissions in the sandbox when it is detected that the software is installed.
  • the normal privilege is a relative super privilege, and its privilege range is small, and some operations can be completed.
  • Super system permissions are required for the installation of general system software. Because you cannot change the super-privileged files in the sandbox, you need to search for files with normal permissions.
  • the file that can be written in the /Library/MobileSubstrate/DynamicLibraries directory is searched as a file with normal permissions, such as MobileSafety.dylib and MobileSafety.plist.
  • the dylib file is the execution file, which contains the executed content;
  • the plist file is the file that specifies the injection process identifier to declare the process ID to be injected.
  • the injection process identifier can be the name or number of the injection process.
  • the backup module 106 is used to back up the file.
  • the file includes an execution file and a file specifying the injection process identifier.
  • the injection process identifier can be the name or number of the injection process, and the like. Back up MobileSafety.dylib to backup1 and MobileSafety.plist to backup2 as backup2 file.
  • the replacement module 108 is configured to replace the pre-selected injection code content and the sandbox process identifier with the content of the file, the injection code content including the super-privileged to-be-installed code and the super-privileged wake-up process identifier.
  • the code to be installed may be Detian software code or Windows operating system code or Android system code.
  • Super-privileged code to be installed and wake-up process means that you need to run under super-privilege.
  • the wakeup process identifier may be a wakeup process name or number, and the corresponding wakeup process may be obtained according to the wakeup process name or number.
  • the sandbox process ID can be the sandbox process name or number, and so on.
  • the replacement module 108 is further configured to replace the content of the injection code with the content of the execution file, and replace the sandbox process identifier with the content of the file of the specified injection process identifier.
  • the replacement module 108 is further configured to compile the injected code content to generate an executable file, serialize the content of the executable file, read the serialized content of the executable file, and overwrite the content of the executable file. The content of the executable file.
  • the content of the injected code is abcdef
  • the content of the MobileSafety.dylib file is fedcba
  • the content of the MobileSafety.dylib file is overwritten by the injected code content
  • the content of the MobileSafety.dylib file is abcdef.
  • the sandbox process ID can be the sandbox process name or number, and so on.
  • the injection module 110 is configured to activate a super-privileged sandbox process in the sandbox, execute the injected code content, and inject the to-be-installed code into the wake-up process.
  • the sandboxd process is responsible for controlling the operation of the sandbox.
  • the process is not a resident process and needs to be started under certain circumstances. For example, in an App (Applicant, Application) entering the sandbox, the sandbox App is retired. Go to the background, as well as some operations of the sandbox app. Start the sandboxd process, load the injected code content, and execute the super permission code into the sandboxd process.
  • the super privilege code includes the code to be installed (dpkg) and the reboot code (reboot). Because the sandboxd process has an unstable and automatic exit mechanism, the wake-up process is used to perform the operation on the installed code.
  • the corresponding sandbox process can be obtained, and the corresponding sandbox process can be obtained according to the sandbox process name or number.
  • the wakeup process can be a Locationd process or a Configd process.
  • the execution module 112 is configured to activate the wakeup process and execute the to-be-installed code.
  • the wakeup process is a Locationd process
  • the Locationd process is activated
  • the detian software is installed using the dpkg command.
  • the corresponding wakeup process can be obtained, and the corresponding wakeup process can be obtained according to the wakeup process name or number.
  • the recovery module 114 is used to restore the backed up files after the installation is completed.
  • the system in which the software is installed in the sandbox replaces the common permission file in the sandbox by injecting the code content and the sandbox process identifier, and then injecting the super-privileged to-be-installed code into the wake-up process to implement the installation of the to-be-installed code.
  • the software for installing super-privilege in the sandbox is realized, which makes the installation of the super-privileged software more flexible, and the installation method is suitable for promoting the application of the debtian software.
  • the system for installing software in the sandbox includes a detection module 102, a search module 104, a backup module 106, a replacement module 108, an injection module 110, an execution module 112, and a recovery module 114.
  • a plug-in installation module 116 and a restart/logout module 118 are also included. among them:
  • the plugin installation module 116 is used to install the jailbreak plugin.
  • the terminal can be a smart phone, a palmtop computer, a personal digital assistant, and the like.
  • the jailbreak plugin can be MobileSubstrate, which can automatically load dynamic libraries under the /Library/MobileSubstrate/DynamicLibraries directory, such as:
  • the restart/logout module 118 is used to restart or log off the terminal.
  • the terminal can be automatically restarted or logged out by the reboot or killallSpringBoard command.
  • SpringBoard belongs to the Dock structure, including iDevice's unlocked main menu interface, Spotlight search interface and multi-tasking switch menu. It exists in the iDevice process and can be restarted through killallSpringBoard. The installation is complete after restarting or logging out.
  • the storage medium may be a magnetic disk, an optical disk, or a read-only storage memory (Read-Only) Memory, ROM) or Random Access Memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Stored Programmes (AREA)

Abstract

本发明涉及一种沙箱内安装软件的方法和系统、计算机存储介质。所述方法包括以下步骤:检测是否有安装软件的超级权限,若有,则搜索得到沙箱内普通权限的文件;备份所述文件;将预先选择的注入代码内容和沙箱进程标识替换所述文件的内容,所述注入代码内容包括超级权限的待安装代码和超级权限的唤醒进程标识;在沙箱内激活超级权限的沙箱进程,执行所述注入代码内容,将所述待安装代码注入到唤醒进程中;激活所述唤醒进程,执行所述待安装代码;安装完成后恢复备份的文件。上述沙箱内安装软件的方法和系统、计算机存储介质,实现了在沙箱内安装超级权限的软件,使得超级权限的软件的安装方式更灵活。

Description

沙箱内安装软件的方法和系统、计算机存储介质
本申请要求于2013年5月17日提交中国专利局、申请号为201310185825.0、发明名称为“沙箱内安装软件的方法和系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
【技术领域】
本发明涉及软件安装领域,特别是涉及一种沙箱内安装软件的方法和系统、计算机存储介质。
【背景技术】
随着智能手机的发展,智能手机的市场占有率逐步提高。由于智能手机内的操作系统的封闭性,为了安装很多软件,需要对智能手机进行越狱,以获得超级权限(即root权限)。
传统安装软件的方法,以安装Debian软件为例,主要是通过Cydia使得用户拥有超级权限,然后经过添加软件源,获取更新的软件,搜索得到所需的软件,然后下载进行安装,这一系列的操作过程繁琐。很多用户借助软件安装助手进行搜索和安装软件,但在常规方式下,沙箱内只拥有普通权限,无法安装root权限的软件。其中,Debian软件是指一款安装在计算机上使用的操作系统。Cydia是指在ipone、ipad等上使用的一种破解软件。沙箱是指运行的安全环境,在其中运行的代码不能修改或查看用户系统。
【发明内容】
基于此,有必要提供一种沙箱内安装软件的方法,能实现在沙箱内安装root权限软件,使得软件安装方式灵活。
此外,还有必要提供一种沙箱内安装软件的系统,能实现在沙箱内安装root权限软件,使得软件安装方式灵活。
一种沙箱内安装软件的方法,包括以下步骤:
检测是否有安装软件的超级权限,若有,则搜索得到沙箱内普通权限的文件;
备份所述文件;
将预先选择的注入代码内容和沙箱进程标识替换所述文件的内容,所述注入代码内容包括超级权限的待安装代码和超级权限的唤醒进程标识;
在沙箱内激活超级权限的沙箱进程,执行所述注入代码内容,将所述待安装代码注入到唤醒进程中;
激活所述唤醒进程,执行所述待安装代码;
安装完成后恢复备份的文件。
一种沙箱内安装软件的系统,包括:
检测模块,用于检测是否有安装软件的超级权限;
搜索模块,用于在检测到有安装软件的超级权限时,搜索得到沙箱内普通权限的文件;
备份模块,用于备份所述文件;
替换模块,用于将预先选择的注入代码内容和沙箱进程标识替换所述文件的内容,所述注入代码内容包括超级权限的待安装代码和超级权限的唤醒进程标识;
注入模块,用于在沙箱内激活超级权限的沙箱进程,执行所述注入代码内容,将所述待安装代码注入到唤醒进程中;
执行模块,用于激活所述唤醒进程,执行所述待安装代码;
恢复模块,用于在安装完成后恢复备份的文件。
此外,还有必要提供一种计算机存储介质。
一个或多个包含计算机可执行指令的计算机存储介质,所述计算机可执行指令用于执行一种沙箱内安装软件的方法,其特征在于,所述方法包括以下步骤:
检测是否有安装软件的超级权限,若有,则搜索得到沙箱内普通权限的文件;
备份所述文件;
将预先选择的注入代码内容和沙箱进程标识替换所述文件的内容,所述注入代码内容包括超级权限的待安装代码和超级权限的唤醒进程标识;
在沙箱内激活超级权限的沙箱进程,执行所述注入代码内容,将所述待安装代码注入到唤醒进程中;
激活所述唤醒进程,执行所述待安装代码;
安装完成后恢复备份的文件。
上述沙箱内安装软件的方法和系统,通过将注入代码内容和沙箱进程标识替换沙箱内的普通权限的文件,然后再将超级权限的待安装代码注入到唤醒进程中,以实现安装待安装代码,实现了在沙箱内安装超级权限的软件,使得超级权限的软件的安装方式更灵活,不再局限于在越狱情况下添加软件源,获取更新的软件,搜索得到所需的软件,然后下载进行安装这一安装方式。
【附图说明】
图1为一个实施例中沙箱内安装软件的方法的流程示意图;
图2为将预先选择的注入代码内容和沙箱进程标识替换该文件的内容的流程示意图;
图3为一个实施例中沙箱内安装软件的系统的内部结构示意图;
图4为另一个实施例中沙箱内安装软件的系统的内部结构示意图。
【具体实施方式】
下面结合具体的实施例及附图对沙箱内安装软件的方法和系统的技术方案进行详细的描述,以使其更加清楚。
如图1所示,在一个实施例中,一种沙箱内安装软件的方法,包括以下步骤:
步骤S102,检测是否有安装软件的超级权限,若有,执行步骤S104,否则结束。
具体的,在步骤S102之前,可在终端上安装越狱插件。该终端可为智能手机、掌上电脑、个人数字助理等。以智能手机为例,该越狱插件可为MobileSubstrate,该插件能够自动对/Library/MobileSubstrate/DynamicLibraries目录下面的动态库进行加载,如:
/Library/MobileSubstrate/DynamicLibraries/MobileSafety.dylib,及其对应的plist,如MobileSafety.plist。
其中,dylib文件为执行文件,其内包含执行的内容;plist文件为指定注入进程标识的文件,以声明要注入的进程标识。注入进程标识可为注入进程名称或编号等。
超级权限(root权限)指可进行任意操作的最高权限。
步骤S104,搜索得到沙箱内普通权限的文件。
具体的,普通权限(mobile权限)是相对超级权限,其权限范围小,能完成部分操作。一般系统软件的安装等需要超级权限。因在沙箱内无法对超级权限的文件进行变更操作,需要搜索得到普通权限的文件。本实施例中,搜索得到/Library/MobileSubstrate/DynamicLibraries目录下可进行写入的文件作为普通权限的文件,如MobileSafety.dylib和MobileSafety.plist。
步骤S106,备份该文件。
具体的,该文件包括执行文件和指定注入进程标识的文件。该注入进程标识可为注入进程的名称或编号等。将MobileSafety.dylib备份为backup1,MobileSafety.plist备份为backup2文件。
步骤S108,将预先选择的注入代码内容和沙箱进程标识替换该文件的内容。
具体的,该注入代码内容包括超级权限的待安装代码和超级权限的唤醒进程标识。该待安装代码可为Detian软件代码或Windows操作系统代码或安卓系统代码。超级权限的待安装代码和唤醒进程是指需要在超级权限下才能运行。
唤醒进程标识可为唤醒进程名称或编号,根据唤醒进程名称或编号可得到对应的唤醒进程。沙箱进程标识可为沙箱进程名称或编号等。
在一个实施例中,如图2所示,步骤S108包括:
步骤S208,将该注入代码内容替换该执行文件的内容。
具体的,将注入代码内容编译生成可执行文件,并该可执行文件的内容序列化,读取序列化后的该可执行文件的内容,将该可执行文件的内容覆盖该执行文件的内容。
进一步的,将可执行文件的内容的序列化形成的字符串反序列化,然后写入该执行文件中。
例如注入代码内容为abcdef,MobileSafety.dylib文件的内容为fedcba,则将注入代码内容覆盖MobileSafety.dylib文件的内容,得到MobileSafety.dylib文件的内容为abcdef。
步骤S218,将该沙箱进程标识替换该指定注入进程标识的文件的内容。
具体的,将沙箱进程(sandboxd进程)标识替换MobileSafety. plist文件的内容。
步骤S110,在沙箱内激活超级权限的沙箱进程,执行该注入代码内容,将该待安装代码注入到唤醒进程中。
具体的,sandboxd进程是负责控制对沙箱的操作,该进程不属于常驻进程,需在特定的情况下才会启动,如在进入沙箱的App(Applicant,应用)里面,沙箱App退到后台,以及沙箱App的一些操作。启动sandboxd进程,会加载注入代码内容,执行超级权限代码到sandboxd进程中。该超级权限代码包括待安装代码(dpkg)和重启代码(reboot)。因sandboxd进程具有不稳定及自动退出的机制,采用唤醒进程对待安装代码执行操作。
根据沙箱进程标识可得到对应的沙箱进程,即可根据沙箱进程名称或编号获得对应的沙箱进程。
将待安装代码替换MobileSafety.dylib文件的内容,将唤醒进程标识替换MobileSafety. plist文件的内容。该唤醒进程可为Locationd进程或Configd进程。
将待安装代码注入到唤醒进程后,执行killall 唤醒进程指令,杀掉唤醒进程,然后再重新唤醒,如此唤醒进程中注入了待安装代码。
步骤S112,激活该唤醒进程,执行该待安装代码。
本实施例中,唤醒进程为Locationd进程,激活Locationd进程,使用dpkg指令对detian软件进行安装。
根据唤醒进程标识可得到对应的唤醒进程,即可根据唤醒进程名称或编号获得对应的唤醒进程。
步骤S114,安装完成后恢复备份的文件。
具体的,安装完成后通过备份的两个文件backup1和 backup2进行恢复,恢复得到原始的MobileSafety.dylib文件和MobileSafety.plist文件。
进一步的,所述方法还包括步骤:对终端进行重启或注销。
具体的,可通过reboot或者killallSpringBoard命令自动对终端进行重启或注销。SpringBoard属于Dock结构,包括iDevice的解锁后主菜单界面、Spotlight搜索界面和多任务切换菜单,其存在于iDevice进程中,可通过killallSpringBoard重启终端。重启或注销后安装完成。
上述沙箱内安装软件的方法,通过将注入代码内容和沙箱进程标识替换沙箱内的普通权限的文件,然后再将超级权限的待安装代码注入到唤醒进程中,以实现安装待安装代码,实现了在沙箱内安装超级权限的软件,使得超级权限的软件的安装方式更灵活,且该安装方式适用于推广debtian软件的应用。
如图3所示,在一个实施例中,一种沙箱内安装软件的系统,包括检测模块102、搜索模块104、备份模块106、替换模块108、注入模块110、执行模块112和恢复模块114。其中:
检测模块102用于检测是否有安装软件的超级权限。超级权限(root权限)指可进行任意操作的最高权限。
搜索模块104用于在检测到有权限安装软件时,搜索得到沙箱内普通权限的文件。具体的,普通权限(mobile权限)是相对超级权限,其权限范围小,能完成部分操作。一般系统软件的安装等需要超级权限。因在沙箱内无法对超级权限的文件进行变更操作,需要搜索得到普通权限的文件。本实施例中,搜索得到/Library/MobileSubstrate/DynamicLibraries目录下可进行写入的文件作为普通权限的文件,如MobileSafety.dylib和MobileSafety.plist。
其中,dylib文件为执行文件,其内包含执行的内容;plist文件为指定注入进程标识的文件,以声明要注入的进程标识。注入进程标识可为注入进程名称或编号等。
备份模块106用于备份该文件。
具体的,该文件包括执行文件和指定注入进程标识的文件。该注入进程标识可为注入进程的名称或编号等。将MobileSafety.dylib备份为backup1,MobileSafety.plist备份为backup2文件。
替换模块108用于将预先选择的注入代码内容和沙箱进程标识替换该文件的内容,该注入代码内容包括超级权限的待安装代码和超级权限的唤醒进程标识。
该待安装代码可为Detian软件代码或Windows操作系统代码或安卓系统代码。超级权限的待安装代码和唤醒进程是指需要在超级权限下才能运行。唤醒进程标识可为唤醒进程名称或编号,根据唤醒进程名称或编号可得到对应的唤醒进程。沙箱进程标识可为沙箱进程名称或编号等。
进一步的,替换模块108还用于将该注入代码内容替换该执行文件的内容,以及将该沙箱进程标识替换该指定注入进程标识的文件的内容。
具体的,替换模块108还用于将注入代码内容编译生成可执行文件,并该可执行文件的内容序列化,读取序列化后的该可执行文件的内容,将该可执行文件的内容覆盖该执行文件的内容。
例如注入代码内容为abcdef,MobileSafety.dylib文件的内容为fedcba,则将注入代码内容覆盖MobileSafety.dylib文件的内容,得到MobileSafety.dylib文件的内容为abcdef。将沙箱进程(sandboxd进程)标识替换MobileSafety. plist文件的内容。沙箱进程标识可为沙箱进程名称或编号等。
注入模块110用于在沙箱内激活超级权限的沙箱进程,执行该注入代码内容,将该待安装代码注入到唤醒进程中。
具体的,sandboxd进程是负责控制对沙箱的操作,该进程不属于常驻进程,需在特定的情况下才会启动,如在进入沙箱的App(Applicant,应用)里面,沙箱App退到后台,以及沙箱App的一些操作。启动sandboxd进程,会加载注入代码内容,执行超级权限代码到sandboxd进程中。该超级权限代码包括待安装代码(dpkg)和重启代码(reboot)。因sandboxd进程具有不稳定及自动退出的机制,采用唤醒进程对待安装代码执行操作。
根据沙箱进程标识可得到对应的沙箱进程,即可根据沙箱进程名称或编号获得对应的沙箱进程。
将待安装代码替换MobileSafety.dylib文件的内容,将唤醒进程标识替换MobileSafety. plist文件的内容。该唤醒进程可为Locationd进程或Configd进程。
将待安装代码注入到唤醒进程后,执行killall 唤醒进程指令,杀掉唤醒进程,然后再重新唤醒,如此唤醒进程中注入了待安装代码。
执行模块112用于激活该唤醒进程,执行该待安装代码。
本实施例中,唤醒进程为Locationd进程,激活Locationd进程,使用dpkg指令对detian软件进行安装。
根据唤醒进程标识可得到对应的唤醒进程,即可根据唤醒进程名称或编号获得对应的唤醒进程。
恢复模块114用于在安装完成后恢复备份的文件。
具体的,安装完成后通过备份的两个文件backup1和 backup2进行恢复,恢复得到原始的MobileSafety.dylib文件和MobileSafety.plist文件。
上述沙箱内安装软件的系统,通过将注入代码内容和沙箱进程标识替换沙箱内的普通权限的文件,然后再将超级权限的待安装代码注入到唤醒进程中,以实现安装待安装代码,实现了在沙箱内安装超级权限的软件,使得超级权限的软件的安装方式更灵活,且该安装方式适用于推广debtian软件的应用。
如图4所示,在一个实施例中,上述沙箱内安装软件的系统,除了包括检测模块102、搜索模块104、备份模块106、替换模块108、注入模块110、执行模块112和恢复模块114,还包括插件安装模块116和重启/注销模块118。其中:
插件安装模块116用于安装越狱插件。该终端可为智能手机、掌上电脑、个人数字助理等。以智能手机为例,该越狱插件可为MobileSubstrate,该插件能够自动对/Library/MobileSubstrate/DynamicLibraries目录下面的动态库进行加载,如:
/Library/MobileSubstrate/DynamicLibraries/MobileSafety.dylib,及其对应的plist,如MobileSafety.plist。
重启/注销模块118用于对终端进行重启或注销。
具体的,可通过reboot或者killallSpringBoard命令自动对终端进行重启或注销。SpringBoard属于Dock结构,包括iDevice的解锁后主菜单界面、Spotlight搜索界面和多任务切换菜单,其存在于iDevice进程中,可通过killallSpringBoard重启终端。重启或注销后安装完成。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。
以上所述实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。

Claims (18)

  1. 一种沙箱内安装软件的方法,包括以下步骤:
    检测是否有安装软件的超级权限,若有,则搜索得到沙箱内普通权限的文件;
    备份所述文件;
    将预先选择的注入代码内容和沙箱进程标识替换所述文件的内容,所述注入代码内容包括超级权限的待安装代码和超级权限的唤醒进程标识;
    在沙箱内激活超级权限的沙箱进程,执行所述注入代码内容,将所述待安装代码注入到唤醒进程中;
    激活所述唤醒进程,执行所述待安装代码;
    安装完成后恢复备份的文件。
  2. 根据权利要求1所述的沙箱内安装软件的方法,其特征在于,在所述检测是否有安装软件的超级权限的步骤之前,还包括:
    安装越狱插件。
  3. 根据权利要求1所述的沙箱内安装软件的方法,其特征在于,所述文件包括执行文件和指定注入进程标识的文件;
    所述将预先选择的注入代码内容和沙箱进程标识替换所述文件的内容的步骤包括:
    将所述注入代码内容替换所述执行文件的内容;
    将所述沙箱进程标识替换所述指定注入进程名称的文件的内容。
  4. 根据权利要求3所述的沙箱内安装软件的方法,其特征在于,将所述注入代码内容替换所述执行文件的内容的步骤包括:
    将注入代码内容编译生成可执行文件,并将所述可执行文件的内容序列化,读取序列化后的所述可执行文件的内容,将所述可执行文件的内容覆盖所述执行文件的内容。
  5. 根据权利要求4所述的沙箱内安装软件的方法,其特征在于,所述将注入代码内容编译生成可执行文件,并将所述可执行文件的内容序列化,读取序列化后的所述可执行文件的内容,将所述可执行文件的内容覆盖所述执行文件的内容的步骤包括:
    将可执行文件的内容序列化形成的字符串反序列化,并写入所述执行文件中。
  6. 根据权利要求1至5中任一项所述的沙箱内安装软件的方法,其特征在于,所述方法还包括:
    对终端进行重启或注销。
  7. 一种沙箱内安装软件的系统,其特征在于,包括:
    检测模块,用于检测是否有安装软件的超级权限;
    搜索模块,用于在检测到有安装软件的超级权限时,搜索得到沙箱内普通权限的文件;
    备份模块,用于备份所述文件;
    替换模块,用于将预先选择的注入代码内容和沙箱进程标识替换所述文件的内容,所述注入代码内容包括超级权限的待安装代码和超级权限的唤醒进程标识;
    注入模块,用于在沙箱内激活超级权限的沙箱进程,执行所述注入代码内容,将所述待安装代码注入到唤醒进程中;
    执行模块,用于激活所述唤醒进程,执行所述待安装代码;
    恢复模块,用于在安装完成后恢复备份的文件。
  8. 根据权利要求7所述的沙箱内安装软件的系统,其特征在于,所述系统还包括:
    插件安装模块,用于安装越狱插件。
  9. 根据权利要求7所述的沙箱内安装软件的系统,其特征在于,所述文件包括执行文件和指定注入进程标识的文件;
    所述替换模块还用于将所述注入代码内容替换所述执行文件的内容,以及将所述沙箱进程标识替换所述指定注入进程名称的文件的内容。
  10. 根据权利要求9所述的沙箱内安装软件的系统,其特征在于,所述替换模块还用于将注入代码内容编译生成可执行文件,并将所述可执行文件的内容序列化,读取序列化后的所述可执行文件的内容,将所述可执行文件的内容覆盖所述执行文件的内容。
  11. 根据权利要求10所述的沙箱内安装软件的系统,其特征在于,所述替代模块还用于将可执行文件的内容序列化形成的字符串反序列化,并写入所述执行文件中。
  12. 根据权利要求7至11中任一项所述的沙箱内安装软件的系统,其特征在于,所述系统还包括:
    重启/注销模块,用于对终端进行重启或注销。
  13. 一个或多个包含计算机可执行指令的计算机存储介质,所述计算机可执行指令用于执行一种沙箱内安装软件的方法,其特征在于,所述方法包括以下步骤:
    检测是否有安装软件的超级权限,若有,则搜索得到沙箱内普通权限的文件;
    备份所述文件;
    将预先选择的注入代码内容和沙箱进程标识替换所述文件的内容,所述注入代码内容包括超级权限的待安装代码和超级权限的唤醒进程标识;
    在沙箱内激活超级权限的沙箱进程,执行所述注入代码内容,将所述待安装代码注入到唤醒进程中;
    激活所述唤醒进程,执行所述待安装代码;
    安装完成后恢复备份的文件。
  14. 根据权利要求13所述的计算机存储介质,其特征在于,在所述检测是否有安装软件的超级权限的步骤之前,还包括:
    安装越狱插件。
  15. 根据权利要求13所述的计算机存储介质,其特征在于,所述文件包括执行文件和指定注入进程标识的文件;
    所述将预先选择的注入代码内容和沙箱进程标识替换所述文件的内容的步骤包括:
    将所述注入代码内容替换所述执行文件的内容;
    将所述沙箱进程标识替换所述指定注入进程名称的文件的内容。
  16. 根据权利要求15所述的计算机存储介质,其特征在于,将所述注入代码内容替换所述执行文件的内容的步骤包括:
    将注入代码内容编译生成可执行文件,并将所述可执行文件的内容序列化,读取序列化后的所述可执行文件的内容,将所述可执行文件的内容覆盖所述执行文件的内容。
  17. 根据权利要求16所述的计算机存储介质,其特征在于,所述将注入代码内容编译生成可执行文件,并将所述可执行文件的内容序列化,读取序列化后的所述可执行文件的内容,将所述可执行文件的内容覆盖所述执行文件的内容的步骤包括:
    将可执行文件的内容序列化形成的字符串反序列化,并写入所述执行文件中。
  18. 根据权利要求13至17中任一项所述的计算机存储介质,其特征在于,所述方法还包括:
    对终端进行重启或注销。
PCT/CN2013/086713 2013-05-17 2013-11-07 沙箱内安装软件的方法和系统、计算机存储介质 WO2014183391A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310185825.0A CN104036183B (zh) 2013-05-17 2013-05-17 沙箱内安装软件的方法和系统
CN201310185825.0 2013-05-17

Publications (1)

Publication Number Publication Date
WO2014183391A1 true WO2014183391A1 (zh) 2014-11-20

Family

ID=51466951

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/086713 WO2014183391A1 (zh) 2013-05-17 2013-11-07 沙箱内安装软件的方法和系统、计算机存储介质

Country Status (2)

Country Link
CN (1) CN104036183B (zh)
WO (1) WO2014183391A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105512548A (zh) * 2015-12-02 2016-04-20 湘潭大学 基于隐藏可执行镜像并注入dll保护镜像代码的方法
CN110837383A (zh) * 2019-09-30 2020-02-25 奇安信科技集团股份有限公司 应用免安装升级方法及装置
US11698966B2 (en) 2020-04-13 2023-07-11 Capital One Services, Llc Systems and methods for code injection detection

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104091132B (zh) * 2014-06-17 2017-07-28 小米科技有限责任公司 在路由设备上运行插件的方法、装置及路由设备
CN106155808B (zh) * 2015-04-16 2020-10-13 腾讯科技(深圳)有限公司 计算机系统资源的管理方法及装置
CN106293667B (zh) * 2015-05-27 2020-01-21 阿里巴巴集团控股有限公司 一种应用程序修改检测方法及装置

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101253487A (zh) * 2005-09-01 2008-08-27 微软公司 基于资源的动态安全授权
CN101425016A (zh) * 2007-11-01 2009-05-06 珠海金山软件股份有限公司 运行安装软件的方法和系统
CN102184356A (zh) * 2011-04-21 2011-09-14 奇智软件(北京)有限公司 利用沙箱技术进行防御的方法、装置及安全浏览器

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7685638B1 (en) * 2005-12-13 2010-03-23 Symantec Corporation Dynamic replacement of system call tables
CN102542187B (zh) * 2010-12-23 2016-06-15 盛趣信息技术(上海)有限公司 基于安全沙盒提高计算机安全性能的方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101253487A (zh) * 2005-09-01 2008-08-27 微软公司 基于资源的动态安全授权
CN101425016A (zh) * 2007-11-01 2009-05-06 珠海金山软件股份有限公司 运行安装软件的方法和系统
CN102184356A (zh) * 2011-04-21 2011-09-14 奇智软件(北京)有限公司 利用沙箱技术进行防御的方法、装置及安全浏览器

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105512548A (zh) * 2015-12-02 2016-04-20 湘潭大学 基于隐藏可执行镜像并注入dll保护镜像代码的方法
CN110837383A (zh) * 2019-09-30 2020-02-25 奇安信科技集团股份有限公司 应用免安装升级方法及装置
CN110837383B (zh) * 2019-09-30 2023-10-31 奇安信科技集团股份有限公司 应用免安装升级方法及装置
US11698966B2 (en) 2020-04-13 2023-07-11 Capital One Services, Llc Systems and methods for code injection detection

Also Published As

Publication number Publication date
CN104036183B (zh) 2015-04-08
CN104036183A (zh) 2014-09-10

Similar Documents

Publication Publication Date Title
WO2014183391A1 (zh) 沙箱内安装软件的方法和系统、计算机存储介质
WO2013149460A1 (zh) 一种Android手持设备连续增量的空中升级方法
Corina et al. Difuze: Interface aware fuzzing for kernel drivers
US11120130B2 (en) Method and apparatus for protecting kernel control-flow integrity using static binary instrumentation
WO2013182048A1 (zh) 清除恶意程序的方法和系统、计算机存储介质
WO2017177769A1 (zh) Ogg 版本部署方法、系统、服务器和存储介质
US7676508B2 (en) Method and system for recording and replaying input-output requests issued by a user-mode program
Krishnan et al. Trail of bytes: efficient support for forensic analysis
WO2018233037A1 (zh) 数据库集成测试方法、装置、服务器及存储介质
WO2016095551A1 (zh) 一种MySQL数据库监控选项脚本的实现方法及装置
WO2012119446A1 (zh) 一种内存监控方法及装置
CN108182129B (zh) 一种基于移动终端镜像还原数据信息的数字取证系统及方法
WO2018000675A1 (zh) 一种后台应用管理装置、终端及后台应用管理方法
WO2016086558A1 (zh) 智能终端信息显示方法及智能终端
CN103838624A (zh) 一种基于Linux消息队列的日志处理方法
CN112269547A (zh) 无需操作系统的、主动、可控硬盘数据删除方法及装置
WO2009136740A2 (ko) OSGi 서비스 플랫폼에 원격으로 설치된 번들에 대한 바인딩 정보를 관리하는 방법 및 장치
WO2018018820A1 (zh) 处理器工作频率和/或工作核数的调整方法、装置和终端
WO2018090759A1 (zh) 一种系统启动文件的校验及编译方法
WO2010002185A2 (ko) 응용프로그램에서 사용되는 임시 파일의 자동 완전 삭제 방법
JP2004303114A (ja) インタープリタおよびネイティブコード実行方法
Freiling et al. Forensic analysis of smartphones: The android data extractor lite (adel)
WO2014185627A1 (ko) 데이터 프로세싱 시스템 보안 장치와 보안방법
WO2024128533A1 (ko) 난독화 장치 및 방법
WO2021020859A1 (ko) 외장형 운영체제 구동 장치 및 그 방법

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13884689

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: COMMUNICATION NOT DELIVERED. NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 30.03.2016)

122 Ep: pct application non-entry in european phase

Ref document number: 13884689

Country of ref document: EP

Kind code of ref document: A1