CN116975869A - Attack defense method and device based on address processing, electronic equipment and medium - Google Patents
Attack defense method and device based on address processing, electronic equipment and medium Download PDFInfo
- Publication number
- CN116975869A CN116975869A CN202211609733.6A CN202211609733A CN116975869A CN 116975869 A CN116975869 A CN 116975869A CN 202211609733 A CN202211609733 A CN 202211609733A CN 116975869 A CN116975869 A CN 116975869A
- Authority
- CN
- China
- Prior art keywords
- address
- storage space
- component
- information
- updated
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/50—Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F21/57—Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
- G06F21/577—Assessing vulnerabilities and evaluating computer system security
Landscapes
- Engineering & Computer Science (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Computing Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Storage Device Security (AREA)
Abstract
Description
技术领域Technical field
本申请涉及计算机安全领域,具体涉及一种基于地址处理的攻击防御方法、装置、电子设备及介质。The present application relates to the field of computer security, and specifically relates to an attack defense method, device, electronic equipment and medium based on address processing.
背景技术Background technique
相关技术中,在软件开发过程中,大量软件使用组件化的开发模式,日常使用的应用程序中包含大量开源或自实现的模块化组件。由于对使用组件开发时没有对其进行安全检查,或者对披露的公开组件漏洞缺少迭代修复,导致软件攻击面进一步扩大,攻击者很容易利用已经公开或未知的组件漏洞对使用这些应用程序的用户进行攻击,软件数据的安全性较差。In related technologies, during the software development process, a large amount of software uses a component-based development model, and daily-used applications contain a large number of open source or self-implemented modular components. Due to the lack of security checks on components when they are developed, or the lack of iterative fixes for disclosed public component vulnerabilities, the software attack surface is further expanded, and attackers can easily exploit the disclosed or unknown component vulnerabilities to target users of these applications. To carry out attacks, the security of software data is poor.
发明内容Contents of the invention
本申请实施例提供一种基于地址处理的攻击防御方法、装置、电子设备及介质,可以提高应用程序中组件数据的安全性。Embodiments of the present application provide an attack defense method, device, electronic device, and medium based on address processing, which can improve the security of component data in an application program.
一方面,提供一种基于地址处理的攻击防御方法,所述方法包括:On the one hand, an attack defense method based on address processing is provided, and the method includes:
获取第一组件对应的第一数据中的第一地址信息;Obtain the first address information in the first data corresponding to the first component;
在所述第一地址信息指向的第一地址为第二组件对应的存储空间中的地址时,获取所述第一地址对应的第一预设标识,所述第二组件与所述第一组件不同;When the first address pointed by the first address information is an address in the storage space corresponding to the second component, the first preset identifier corresponding to the first address is obtained, and the second component and the first component different;
将所述第一地址与所述第一预设标识的第一关联关系存储至第一存储空间,所述第一存储空间为所述第一组件对应的目标存储空间外的存储空间;Store the first association relationship between the first address and the first preset identification in a first storage space, where the first storage space is a storage space outside the target storage space corresponding to the first component;
根据所述第一预设标识与所述第一关联关系更新所述第一地址信息与用于访问所述第一地址的第一对象的第一访问信息,使得所述第一对象在访问所述第一地址时,根据所述更新后的第一地址信息、更新后的第一访问信息,以及所述第一关联关系查找到所述第一地址。The first address information and the first access information of the first object used to access the first address are updated according to the first preset identification and the first association relationship, so that when the first object accesses the first address When the first address is found, the first address is found based on the updated first address information, the updated first access information, and the first association relationship.
另一方面,提供一种基于地址处理的攻击防御装置,包括:On the other hand, an attack defense device based on address processing is provided, including:
获取单元,用于获取第一组件对应的第一数据中的第一地址信息;The acquisition unit is used to acquire the first address information in the first data corresponding to the first component;
所述获取单元,用于在所述第一地址信息指向的第一地址为第二组件对应的存储空间中的地址时,获取所述第一地址对应的第一预设标识,所述第二组件与所述第一组件不同;The acquisition unit is configured to acquire the first preset identifier corresponding to the first address when the first address pointed to by the first address information is an address in the storage space corresponding to the second component, and the second The component is different from said first component;
存储单元,用于将所述第一地址与所述第一预设标识的第一关联关系存储至第一存储空间,所述第一存储空间为所述第一组件对应的目标存储空间外的存储空间;A storage unit configured to store the first association relationship between the first address and the first preset identification in a first storage space, where the first storage space is outside the target storage space corresponding to the first component. storage;
更新单元,用于根据所述第一预设标识与所述第一关联关系更新所述第一地址信息与用于访问所述第一地址的第一对象的第一访问信息,使得所述第一对象在访问所述第一地址时,根据所述更新后的第一地址信息、更新后的第一访问信息,以及所述第一关联关系查找到所述第一地址。An update unit configured to update the first address information and the first access information for accessing the first object at the first address according to the first preset identification and the first association relationship, so that the first When an object accesses the first address, it searches for the first address based on the updated first address information, the updated first access information, and the first association relationship.
另一方面,提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序适于处理器进行加载,以执行如上任一实施例所述的方法。On the other hand, a computer-readable storage medium is provided, the computer-readable storage medium stores a computer program, and the computer program is suitable for loading by a processor to execute the method as described in any of the above embodiments.
另一方面,提供一种计算机设备,所述计算机设备包括处理器和存储器,所述存储器中存储有计算机程序,所述处理器通过调用所述存储器中存储的所述计算机程序,用于执行如上任一实施例所述的方法。On the other hand, a computer device is provided. The computer device includes a processor and a memory. A computer program is stored in the memory. The processor is used to execute the following by calling the computer program stored in the memory. The method described in any of the above embodiments.
另一方面,提供一种计算机程序产品,包括计算机指令,所述计算机指令被处理器执行时实现如上任一实施例所述的方法。On the other hand, a computer program product is provided, including computer instructions. When the computer instructions are executed by a processor, the method as described in any of the above embodiments is implemented.
本申请实施例通过获取第一组件对应的第一数据中的第一地址信息;在所述第一地址信息指向的第一地址为第二组件对应的存储空间中的地址时,获取所述第一地址对应的第一预设标识,所述第二组件与所述第一组件不同;将所述第一地址与所述第一预设标识的第一关联关系存储至第一存储空间,所述第一存储空间为所述第一组件对应的目标存储空间外的存储空间;根据所述第一预设标识与所述第一关联关系更新所述第一地址信息与用于访问所述第一地址的第一对象的第一访问信息,使得所述第一对象在访问所述第一地址时,根据所述更新后的第一地址信息、更新后的第一访问信息,以及所述第一关联关系查找到所述第一地址的方案,可以从组件地址的角度出发,在组件数据中包含指向组件对应的存储空间外部地址的地址信息的情况下,将该地址信息指向的地址和预设标识的第一关联关系存储至组件对应的存储空间外的独立存储空间中,并对该组件数据进行更新,以使得在访问外部地址时,可以通过预设标识以及独立存储空间中的预设标识和外部地址的第一关联关系查找到外部地址,避免攻击者通过对组件数据中包含的指向组件对应的存储空间外部地址的地址信息,查找到其他组件的组件数据,对应用程序的其他组件的组件数据进行攻击,有效提高组件数据的安全性。In this embodiment of the present application, the first address information in the first data corresponding to the first component is obtained; when the first address pointed to by the first address information is an address in the storage space corresponding to the second component, the first address information is obtained. A first preset identification corresponding to an address, the second component is different from the first component; the first association relationship between the first address and the first preset identification is stored in the first storage space, so The first storage space is a storage space outside the target storage space corresponding to the first component; the first address information is updated according to the first preset identification and the first association relationship and is used to access the third The first access information of the first object at an address enables the first object to access the first address according to the updated first address information, the updated first access information, and the third The solution to find the first address through an association relationship can be from the perspective of the component address. When the component data contains address information pointing to the external address of the storage space corresponding to the component, the address pointed by the address information and the predetermined address can be used to find the first address. Assume that the first association relationship of the identifier is stored in an independent storage space outside the storage space corresponding to the component, and the component data is updated, so that when accessing the external address, the preset identifier and the preset in the independent storage space can be accessed. The first association relationship between the identifier and the external address finds the external address, preventing the attacker from finding the component data of other components through the address information contained in the component data pointing to the external address of the storage space corresponding to the component, and attacking other components of the application. Attack the component data, effectively improving the security of the component data.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can also be obtained based on these drawings without exerting creative efforts.
图1a为本申请实施例提供的基于地址处理的攻击防御方法的第一流程示意图;Figure 1a is a first flow diagram of an attack defense method based on address processing provided by an embodiment of the present application;
图1b为本申请实施例提供的基于地址处理的攻击防御方法的第二流程示意图;Figure 1b is a second flow diagram of an attack defense method based on address processing provided by an embodiment of the present application;
图2为本申请实施例提供的基于地址处理的攻击防御方法的第三流程示意图;Figure 2 is a third flow diagram of an attack defense method based on address processing provided by an embodiment of the present application;
图3为本申请实施例提供的将第一数据转移至第一存储空间的流程示意图;Figure 3 is a schematic flowchart of transferring first data to the first storage space provided by an embodiment of the present application;
图4为本申请实施例提供的针对不同类型的访问请求的数据处理方法的示意图;Figure 4 is a schematic diagram of a data processing method for different types of access requests provided by an embodiment of the present application;
图5为本申请实施例提供的触发对所述目标存储空间进行垃圾回收的流程示意图;Figure 5 is a schematic flowchart of triggering garbage collection on the target storage space provided by an embodiment of the present application;
图6为本申请实施例提供的基于地址处理的攻击防御方法的第四流程示意图;Figure 6 is a schematic flowchart of the fourth method of attack defense based on address processing provided by an embodiment of the present application;
图7为本申请实施例提供的基于地址处理的攻击防御装置的结构示意图;Figure 7 is a schematic structural diagram of an attack defense device based on address processing provided by an embodiment of the present application;
图8为本申请实施例提供的计算机设备的结构示意图。Figure 8 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts fall within the scope of protection of this application.
本申请实施例可应用于数据安全、应用程序开发、内存管理等各种场景。The embodiments of this application can be applied to various scenarios such as data security, application development, and memory management.
本申请实施例提供一种基于地址处理的攻击防御方法、装置、电子设备及介质。具体地,本申请实施例的前述基于地址处理的攻击防御方法可以由计算机设备执行,其中,该计算机设备可以为终端或者服务器等设备。该终端可以为智能手机、平板电脑、笔记本电脑、智能语音交互设备、智能家电、穿戴式智能设备、飞行器、智能车载终端等设备,终端还可以包括客户端,该客户端可以是视频客户端、浏览器客户端或即时通信客户端等。服务器可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、内容分发网络(Content Delivery Network,CDN)、以及大数据和人工智能平台等基础云计算服务的云服务器。Embodiments of the present application provide an attack defense method, device, electronic device, and medium based on address processing. Specifically, the aforementioned attack defense method based on address processing in the embodiment of the present application can be executed by a computer device, where the computer device can be a device such as a terminal or a server. The terminal can be a smartphone, tablet, laptop, intelligent voice interaction device, smart home appliance, wearable smart device, aircraft, smart vehicle terminal and other devices. The terminal can also include a client, which can be a video client, Browser client or instant messaging client, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, and middleware. Cloud servers for basic cloud computing services such as software services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms.
例如,当该方法运行于终端时,终端可下载安装相应的应用程序,终端在实际运行前述方法时,用于显示图形用户界面并通过图形用户界面与用户进行交互。具体地,终端将图形用户界面展示于给用户的方式可以包括多种,例如,可以渲染显示在终端的显示屏上,或者,通过全息投影呈现图形用户界面。例如,终端可以包括触控显示屏和处理器,该触控显示屏用于呈现图形用户界面以及接收用户作用于图形用户界面产生的操作指令,该处理器用于运行前述数据处理方法、生成图形用户界面、响应操作指令以及控制图形用户界面在触控显示屏上的显示。For example, when this method is run on a terminal, the terminal can download and install the corresponding application program. When the terminal actually runs the foregoing method, it is used to display a graphical user interface and interact with the user through the graphical user interface. Specifically, the terminal may display the graphical user interface to the user in a variety of ways, for example, it may be rendered and displayed on the display screen of the terminal, or the graphical user interface may be presented through holographic projection. For example, the terminal may include a touch display screen and a processor. The touch display screen is used to present a graphical user interface and receive operating instructions generated by the user acting on the graphical user interface. The processor is used to run the aforementioned data processing method and generate a graphical user interface. interface, respond to operating instructions, and control the display of the graphical user interface on the touch display.
首先,在对本申请实施例进行描述的过程中出现的部分名词或者术语作如下解释:First, some nouns or terms that appear in the description of the embodiments of this application are explained as follows:
组件化:对某些可以进行复用的功能进行封装的标准化工作。组件内包5含内部UI(User Interface,用户界面)元素、样式和JavaScript逻辑代码,便Componentization: The standardization work of encapsulating certain functions that can be reused. The component contains internal UI (User Interface, user interface) elements, styles and JavaScript logic code, which is convenient
于在应用程序的任何地方进行快速的嵌入。for fast embedding anywhere in the application.
程序插桩,是在保证被测程序原有逻辑完整性的基础上在程序中插入一些探针(又称为“探测仪”,本质上就是进行信息采集的代码段,可以是赋Program instrumentation is to insert some probes (also called "detectors") into the program on the basis of ensuring the original logical integrity of the program under test. They are essentially code segments for information collection, which can be assigned
值语句或采集覆盖信息的函数调用),通过探针的执行并抛出程序运行的特0征数据,通过对这些数据的分析,可以获得程序的控制流和数据流信息,进value statement or function call to collect coverage information), through the execution of the probe and throw out the characteristic data of the program running, through the analysis of these data, the control flow and data flow information of the program can be obtained, and
而得到逻辑覆盖等动态信息,从而实现测试目的的方法。It is a method to obtain dynamic information such as logic coverage to achieve testing purposes.
二进制漏洞:二进制漏洞是可执行文件因编码时考虑不周,导致攻击者通过恶意修改程序执行内存状态,改变程序原有正常的行为,最终执行攻击Binary vulnerabilities: Binary vulnerabilities are caused by improper coding of executable files, which allows attackers to maliciously modify the execution memory state of the program, change the original normal behavior of the program, and finally execute the attack.
者的任意命令的一类漏洞。常见的二进制漏洞包括栈溢出漏洞5(Stack-Overflow)、堆溢出漏洞(Heap-Overflow)、释放后重引用漏洞A type of vulnerability caused by the arbitrary command of the user. Common binary vulnerabilities include stack overflow vulnerability (Stack-Overflow), heap overflow vulnerability (Heap-Overflow), and reference-after-free vulnerability.
(Use-After-Free)、双重释放漏洞(Double-Free)、越界访问漏洞(Use-After-Free), double-free vulnerability (Double-Free), out-of-bounds access vulnerability
(Out-of-bounds)等。(Out-of-bounds) etc.
垃圾回收:在计算机科学中,垃圾回收(英语:Garbage Collection,缩Garbage Collection: In computer science, garbage collection (English: Garbage Collection, abbreviated
写为GC)是指一种自动的存储器管理机制。当某个程序占用的一部分内存空0间不再被这个程序访问时,这个程序会借助垃圾回收算法向操作系统归还这Written as GC) refers to an automatic memory management mechanism. When a part of the memory space occupied by a program is no longer accessed by the program, the program will use the garbage collection algorithm to return the memory space to the operating system.
部分内存空间。目前许多语言如Smalltalk、Java、C#、Go和D语言都支持垃圾回收器。part of the memory space. Currently, many languages such as Smalltalk, Java, C#, Go and D language support garbage collectors.
Shellcode是一段用于利用软件漏洞而执行的代码,shellcode为16进制Shellcode is a piece of code used to exploit software vulnerabilities. The shellcode is hexadecimal.
的机器码,因为经常让攻击者获得shell而得名。shellcode常常使用机器语言5编写,可在控制程序执行流后,插入一段可让中央处理器(central processing unit,CPU)执行的机器码,让受害者可以执行攻击者的任意指令。machine code, so named because it often allows attackers to obtain a shell. Shellcode is often written in machine language 5. After controlling the program execution flow, it can insert a piece of machine code that can be executed by the central processing unit (CPU), allowing the victim to execute any instructions of the attacker.
面向返回的编程(Return-oriented Programming,ROP)是一种新型的基于代码复用技术的攻击,攻击者从已有的库或可执行文件中提取指令片段,构建恶意代码。Return-oriented Programming (ROP) is a new type of attack based on code reuse technology. The attacker extracts instruction fragments from existing libraries or executable files to construct malicious code.
0控制流完整性(Control-Flow Integrity)是一种针对控制流劫持攻击的防御方法。0Control-Flow Integrity is a defense method against control flow hijacking attacks.
AddressSanitizer(ASan)是一种基于编译器的快速检测工具,用于检测原生代码中的内存错误。ASan可以检测以下问题:堆栈和堆缓冲区上溢/下溢释放之后的堆使用情况,超出范围的堆栈使用情况,重复释放/错误释放。AddressSanitizer (ASan) is a fast compiler-based detection tool for detecting memory errors in native code. ASan can detect the following issues: heap usage after stack and heap buffer overflow/underflow free, out-of-range stack usage, duplicate free/bad free.
5堆喷射(Heap Spraying)是一种较易获得任意代码执行漏洞利用(Exploit)的技术手段。堆喷射代码试图将自身大面积地分配在进程堆栈中,并且以正确的方式将命令写满该区域,以此实现在目标进程的内存中预定的位置写入一串命令。5 Heap spraying is a technical means that makes it easier to obtain arbitrary code execution vulnerabilities (Exploits). The heap spray code attempts to allocate itself in a large area on the process stack and fill the area with commands in the correct way, thereby writing a series of commands to a predetermined location in the target process's memory.
相关技术中,一般通过在应用程序处于开发阶段时,在编译阶段,通过插桩对内存的状态进行检测,以实现对数据安全的管理,但是,通过该方式编译得到的应用程序的数据量很大,从用户角度来讲,需要更多的磁盘空间进行存储,并且对于日常更新等行为,也会使服务器和客户端的通信流量剧增。根据AddressSanitizer方案文档,存储开销增大了0.5到2倍。并且,在应用程序运行时需要占用大量内存存储内存状态,并且已释放内存不能及时复用,从而导致运行时内存开销增加。并且需要在每次内存访问时都需要运行大量额外指令进行合法性检查,导致CPU运算资源增加。根据AddressSanitizer方案文档,CPU开销与内存开销约为之前的2倍。In related technologies, data security management is generally achieved by detecting the state of the memory through instrumentation during the compilation phase when the application is in the development stage. However, the amount of data in the application compiled in this way is very large. Large, from the user's perspective, more disk space is required for storage, and for daily updates and other behaviors, the communication traffic between the server and the client will also increase dramatically. According to the AddressSanitizer solution documentation, storage overhead increases by 0.5 to 2 times. Moreover, a large amount of memory is required to store the memory state when the application is running, and the released memory cannot be reused in time, resulting in an increase in runtime memory overhead. And a large number of additional instructions need to be run for legality checks every time memory is accessed, resulting in an increase in CPU computing resources. According to the AddressSanitizer solution documentation, the CPU overhead and memory overhead are approximately 2 times that of before.
另外,相关技术中,从通用漏洞防御方法原理来看,主要通过检测程序默认的内存分配、释放函数来对内存使用状态进行更新,但一些通用组件使用了自实现的分配、释放函数进行内存管理,因此通用的漏洞防御方法无法进行检测,从而可以通过这部分内存相关的漏洞对防御方法绕过,具有较大安全性隐患。并且,在应用程序开发过程中,大量软件使用组件化的开发模式,日常使用的应用程序中包含大量开源或自实现的模块化组件。由于对使用组件开发时没有对其进行安全检查,或者对披露的公开组件漏洞缺少迭代修复,导致软件攻击面进一步扩大,攻击者很容易利用已经公开或未知的组件漏洞对使用这些应用程序的用户进行攻击,软件数据的安全性较差。In addition, in related technologies, from the perspective of the principle of general vulnerability defense methods, the memory usage status is mainly updated by detecting the program's default memory allocation and release functions, but some general components use self-implemented allocation and release functions for memory management. , so general vulnerability defense methods cannot be detected, so the defense methods can be bypassed through this part of memory-related vulnerabilities, which has great security risks. Moreover, in the application development process, a large amount of software uses the component development model, and daily-used applications contain a large number of open source or self-implemented modular components. Due to the lack of security checks on components when they are developed, or the lack of iterative fixes for disclosed public component vulnerabilities, the software attack surface is further expanded, and attackers can easily exploit the disclosed or unknown component vulnerabilities to target users of these applications. To carry out attacks, the security of software data is poor.
本申请提供一种方案可解决前述技术问题中的至少一个问题,以下分别进行详细说明。需说明的是,以下实施例的描述顺序不作为对实施例优先顺序的限定。This application provides a solution that can solve at least one of the aforementioned technical problems, which will be described in detail below. It should be noted that the description order of the following embodiments is not used to limit the priority order of the embodiments.
本申请各实施例提供了一种基于地址处理的攻击防御方法,该方法可以由终端或服务器执行。可选地,终端可具体为相关人员开发相应应用程序时使用的终端。Each embodiment of the present application provides an attack defense method based on address processing, which can be executed by a terminal or a server. Optionally, the terminal may be specifically a terminal used by relevant personnel when developing corresponding applications.
本申请主要针对的目标是保护应用程序中的易受攻击模块化组件,因此在应用程序场景上较为广泛,适用于各操作系统平台使用复杂组件的各类应用程序保护,以引擎组件为例:引擎组件是浏览器组件的一个子模块,浏览器组件在应用程序开发中常被用于作为界面展示交互的载体,在桌面端、移动端应用程序非常广泛开发者通过将本方案加入到使用的浏览器组件中编译、发布程序,用户通过在地址栏输入URL或者在应用程序内部点击链接,启动包含本申请的方案对浏览器组件对网页进行加载。针对引擎组件的方案可以应用于Windows端、安卓端的多类应用程序上,应用程序包括但不限于:电脑桌面浏览器、移动端浏览器、即时通信工具、会议类工具等。The main goal of this application is to protect vulnerable modular components in applications. Therefore, it is relatively broad in application scenarios and is suitable for various types of application protection using complex components on various operating system platforms. Take the engine component as an example: The engine component is a sub-module of the browser component. The browser component is often used as a carrier for interface display interaction in application development. It is very common in desktop and mobile applications. Developers add this solution to the browser they use. The program is compiled and published in the browser component. The user starts the program including this application to load the web page by the browser component by entering the URL in the address bar or clicking the link within the application. Solutions for engine components can be applied to many types of applications on Windows and Android. Applications include but are not limited to: computer desktop browsers, mobile browsers, instant messaging tools, conferencing tools, etc.
图1a为本申请实施例提供的基于地址处理的攻击防御方法的第一流程示意图,该方法包括S101-S104:Figure 1a is a first flow diagram of an attack defense method based on address processing provided by an embodiment of the present application. The method includes S101-S104:
S101、获取第一组件对应的第一数据中的第一地址信息;S101. Obtain the first address information in the first data corresponding to the first component;
可选地,第一组件对应的第一数据可以为第一组件中的数据。Optionally, the first data corresponding to the first component may be data in the first component.
可选地,第一地址信息可以为指针。Optionally, the first address information may be a pointer.
可选地,第一地址信息指向的第一地址可以为第一组件对应的目标存储空间内的地址,也可以为第一组件对应的目标存储空间外的地址。当第一地址信息在攻击者的漏洞的影响范围内,且第一地址信息指向的第一地址为第一组件对应的目标存储空间外(如其他组件对应的存储空间)的地址时,攻击者可能对第一地址信息(如指针)进行修改,以获得针对其他组件中数据的读写能力,进而对目标应用程序的其他组件进行攻击。因此,攻击者容易使用目标应用程序的多个组件中包含地址信息的组件对其他组件进行攻击。Optionally, the first address pointed by the first address information may be an address within the target storage space corresponding to the first component, or may be an address outside the target storage space corresponding to the first component. When the first address information is within the impact range of the attacker's vulnerability, and the first address pointed to by the first address information is an address outside the target storage space corresponding to the first component (such as the storage space corresponding to other components), the attacker The first address information (such as a pointer) may be modified to obtain the ability to read and write data in other components, and then attack other components of the target application. Therefore, an attacker can easily use a component containing address information in multiple components of a target application to attack other components.
可选地,第一组件可以为目标应用程序的多个组件中,包含地址信息的组件。在本申请提供的一些可选的实施例中,针对第一组件的确定,所述方法还包括S01-S03:Optionally, the first component may be a component containing address information among multiple components of the target application. In some optional embodiments provided in this application, for determining the first component, the method further includes S01-S03:
S01、获取目标应用程序的多个组件;S01. Obtain multiple components of the target application;
S02、确定所述多个组件中,包含地址信息的至少部分组件;S02. Determine at least some of the components that contain address information among the multiple components;
S03、根据所述至少部分组件确定所述第一组件。S03. Determine the first component according to at least some of the components.
本申请中,仅针对包含地址信息的第一组件进行特殊编译,可以起到节约防御成本的作用。In this application, only the first component containing address information is specially compiled, which can save defense costs.
可选地,S03、根据所述至少部分组件确定所述第一组件,可包括:将至少部分组件中的任一组件或各组件作为第一组件。Optionally, S03. Determining the first component according to the at least part of the components may include: using any one or each component of at least some of the components as the first component.
在本申请提供的另一些可选的实施例中,针对第一组件的确定,所述方法还包括:获取用户针对从目标应用程序的多个组件中选择出第一组件的选择指令;根据所述选择指令确定所述第一组件。In some other optional embodiments provided by this application, for determining the first component, the method further includes: obtaining the user's selection instruction for selecting the first component from multiple components of the target application; The selection instructions determine the first component.
在一些场景中,用户可以为操作上述终端或服务器的相关人员,上述终端中可以安装有相关的风险预测模型,风险预测模型用于对目标应用程序的多个组件进行安全性评估,并筛选出存在攻击风险的第一组件;用户进一步通过终端触发从目标应用程序的多个组件中选择出第一组件的选择指令。In some scenarios, users can be relevant personnel who operate the above terminals or servers. The above terminals can be installed with relevant risk prediction models. The risk prediction models are used to conduct security assessments on multiple components of the target application and filter out The first component with an attack risk; the user further triggers a selection instruction to select the first component from multiple components of the target application through the terminal.
S102、在所述第一地址信息指向的第一地址为第二组件对应的存储空间中的地址时,获取所述第一地址对应的第一预设标识,所述第二组件与所述第一组件不同;S102. When the first address pointed by the first address information is an address in the storage space corresponding to the second component, obtain the first preset identifier corresponding to the first address. The second component and the third component One component is different;
可选地,第二组件可以为目标应用程序的多个组件中,除第一组件以外的任意组件。Optionally, the second component may be any component among multiple components of the target application except the first component.
可选地,第二组件对应的存储空间用于存储所述第二组件对应的数据。Optionally, the storage space corresponding to the second component is used to store data corresponding to the second component.
可选地,第一预设标识可以为预先设置的与第一地址对应的索引信息,索引信息可以使用数字、字母等表示。Optionally, the first preset identification may be preset index information corresponding to the first address, and the index information may be represented by numbers, letters, etc.
可选地,在所述第一地址信息指向的第一地址为目标存储空间中的地址时,不处理。Optionally, when the first address pointed to by the first address information is an address in the target storage space, no processing is performed.
S103、将所述第一地址与所述第一预设标识的第一关联关系存储至第一存储空间,所述第一存储空间为第一组件对应的目标存储空间外的存储空间;S103. Store the first association relationship between the first address and the first preset identification in a first storage space, where the first storage space is a storage space outside the target storage space corresponding to the first component;
可选地,所述第一存储空间除了为第一组件对应的目标存储空间外的存储空间,还为第二组件对应的存储空间外的存储空间。Optionally, the first storage space is not only a storage space other than the target storage space corresponding to the first component, but also a storage space other than the storage space corresponding to the second component.
具体地,第一存储空间处于第一组件所属的应用程序对应的存储空间中除了目标存储空间与第二组件对应的存储空间外的剩余空间内。Specifically, the first storage space is located in the remaining space in the storage space corresponding to the application program to which the first component belongs, except for the target storage space and the storage space corresponding to the second component.
可选地,可以基于硬件的内存加密技术将所述第一地址与所述第一预设标识的第一关联关系存储至上述终端或服务器中的相关芯片中。Optionally, a hardware-based memory encryption technology may be used to store the first association relationship between the first address and the first preset identification in the relevant chip in the above-mentioned terminal or server.
S104、根据所述第一预设标识与所述第一关联关系更新所述第一地址信息与用于访问所述第一地址的第一对象的第一访问信息,使得所述第一对象在访问所述第一地址时,根据所述更新后的第一地址信息、更新后的第一访问信息,以及所述第一关联关系查找到所述第一地址。S104. Update the first address information and the first access information of the first object used to access the first address according to the first preset identification and the first association relationship, so that the first object is in When accessing the first address, the first address is found based on the updated first address information, updated first access information, and the first association relationship.
在本申请提供的一些可选的实施例中,在S104中,根据所述第一预设标识与所述第一关联关系更新所述第一地址信息与用于访问所述第一地址的第一对象的第一访问信息,包括:使用所述第一预设标识替换所述第一地址,以及根据所述第一预设标识与所述第一关联关系更新用于访问所述第一地址的第一对象的第一访问信息。In some optional embodiments provided by this application, in S104, the first address information and the first address information used to access the first address are updated according to the first preset identification and the first association relationship. The first access information of an object includes: using the first preset identifier to replace the first address, and updating the first address for accessing the first address according to the first preset identifier and the first association relationship. The first access information of the first object.
可选地,第一对象通过第一访问信息访问所述第一地址,以调用所述第一地址中的数据。Optionally, the first object accesses the first address through the first access information to call the data in the first address.
可选地,所述第一对象可以为调用函数。Optionally, the first object may be a calling function.
在一些实施例中,根据所述第一预设标识与所述第一关联关系更新用于访问所述第一地址的第一对象的第一访问信息,可包括:将所述第一预设标识与所述第一关联关系相应的代码添加至用于访问所述第一地址的第一对象的第一访问信息中,使得在接收到更新后的所述第一访问信息对应的第一访问请求时,根据所述第一预设标识与所述第一关联关系确定出所述第一地址;将所述第一地址中的数据确定为所述第一访问请求对应的访问结果。其中,第一对象的第一访问信息可以为相关的访问函数。In some embodiments, updating the first access information for accessing the first object at the first address according to the first preset identification and the first association relationship may include: changing the first preset The code identifying the first association relationship is added to the first access information used to access the first object at the first address, so that after receiving the updated first access information corresponding to the first access information When requesting, the first address is determined according to the first preset identification and the first association relationship; the data in the first address is determined as the access result corresponding to the first access request. The first access information of the first object may be a related access function.
相应地,所述方法还包括:在接收到更新后的所述第一访问信息对应的第一访问请求时,根据所述第一预设标识与所述第一关联关系确定出所述第一地址;将所述第一地址中的数据确定为所述第一访问请求对应的访问结果。Correspondingly, the method further includes: upon receiving the first access request corresponding to the updated first access information, determining the first access request based on the first preset identification and the first association relationship. Address; determine the data in the first address as the access result corresponding to the first access request.
具体地,参见图1b所示,图1b为本申请实施例提供的基于地址处理的攻击防御方法的第二流程示意图,第一组件对应的第二数据包括第一组件对应的第一数据与组件代码段,组件代码段包括前述第一对象,第一组件对应的存储空间可包括用于存储组件代码段的组件代码段空间,以及用于存储第一组件对应的第一数据的目标存储空间,其中,第一组件对应的第一数据可以为供组件代码段调用的数据。当第一组件对应的第一数据中包含的第一地址信息指向的第一地址为第二组件对应的存储空间中的地址:地址A时,则将第一地址对应的第一预设标识“1”与地址A的第一关联关系存储至第一存储空间。并将第一地址信息中的“地址A”替换为“1”,并且,将所述“1”与所述第一关联关系相应的代码添加至用于访问所述第一地址的第一对象的第一访问信息(可包含于组件代码段)中,使得在终端接收到更新后的所述第一访问信息对应的第一访问请求时,根据所述“1”与所述第一关联关系确定出地址A;将所述地址A中的数据确定为所述第一访问请求对应的访问结果。Specifically, see Figure 1b, which is a second flow diagram of an attack defense method based on address processing provided by an embodiment of the present application. The second data corresponding to the first component includes the first data and components corresponding to the first component. Code segment, the component code segment includes the aforementioned first object, the storage space corresponding to the first component may include a component code segment space used to store the component code segment, and a target storage space used to store the first data corresponding to the first component, The first data corresponding to the first component may be data for calling by the component code segment. When the first address pointed to by the first address information contained in the first data corresponding to the first component is the address in the storage space corresponding to the second component: address A, then the first preset identification corresponding to the first address is " The first association relationship between 1" and address A is stored in the first storage space. And replace "address A" in the first address information with "1", and add the code corresponding to the "1" and the first association relationship to the first object used to access the first address. in the first access information (which may be included in the component code segment), so that when the terminal receives the first access request corresponding to the updated first access information, according to the "1" and the first association relationship Address A is determined; the data in address A is determined as the access result corresponding to the first access request.
本申请实施例通过获取第一组件对应的第一数据中的第一地址信息;在所述第一地址信息指向的第一地址为第二组件对应的存储空间中的地址时,获取所述第一地址对应的第一预设标识,所述第二组件与所述第一组件不同;将所述第一地址与所述第一预设标识的第一关联关系存储至第一存储空间,所述第一存储空间为所述第一组件对应的目标存储空间外的存储空间;根据所述第一预设标识与所述第一关联关系更新所述第一地址信息与用于访问所述第一地址的第一对象的第一访问信息,使得所述第一对象在访问所述第一地址时,根据所述更新后的第一地址信息、更新后的第一访问信息,以及所述第一关联关系查找到所述第一地址的方案,可以在组件数据中包含指向组件对应的存储空间外部地址的地址信息的情况下,将该地址信息指向的地址和预设标识的第一关联关系存储至组件对应的存储空间外的独立存储空间中,并对该组件数据进行更新,以使得在访问外部地址时,可以通过预设标识以及独立存储空间中的预设标识和外部地址的第一关联关系查找到外部地址,实现对攻击者攻击路径的阻断,增大漏洞利用难度,减小攻击者通过对组件数据中包含的指向组件对应的存储空间外部地址的地址信息,对应用程序的其他组件的组件数据进行攻击的可能性,有效提高组件数据的安全性。In this embodiment of the present application, the first address information in the first data corresponding to the first component is obtained; when the first address pointed to by the first address information is an address in the storage space corresponding to the second component, the first address information is obtained. A first preset identification corresponding to an address, the second component is different from the first component; the first association relationship between the first address and the first preset identification is stored in the first storage space, so The first storage space is a storage space outside the target storage space corresponding to the first component; the first address information is updated according to the first preset identification and the first association relationship and is used to access the third The first access information of the first object at an address enables the first object to access the first address according to the updated first address information, the updated first access information, and the third An association relationship can be used to find the first address. When the component data contains address information pointing to the external address of the storage space corresponding to the component, the first association relationship between the address pointed by the address information and the preset identification can be used. Store it in an independent storage space outside the storage space corresponding to the component, and update the component data so that when accessing the external address, you can use the preset identification and the preset identification in the independent storage space and the first of the external address. The association relationship finds the external address, blocking the attacker's attack path, increasing the difficulty of exploiting the vulnerability, and reducing the attacker's impact on the application by accessing the address information contained in the component data that points to the external address of the storage space corresponding to the component. The possibility of attack on the component data of other components effectively improves the security of component data.
在本申请提供的另一些可选的实施例中,上述第一组件对应的第一数据还可以为从第一组件对应的原始存储空间转移至原始存储空间外的目标存储空间中的数据,参见图2,图2为本申请实施例提供的基于地址处理的攻击防御方法的第三流程示意图,所述方法还包括S201-S203:In other optional embodiments provided by this application, the first data corresponding to the first component may also be data transferred from the original storage space corresponding to the first component to a target storage space outside the original storage space, see Figure 2. Figure 2 is a third flow diagram of an attack defense method based on address processing provided by an embodiment of the present application. The method also includes S201-S203:
S201、获取所述第一组件对应的第一数据;S201. Obtain the first data corresponding to the first component;
S202、获取预设偏移量;S202. Obtain the preset offset;
S203、根据所述预设偏移量将所述第一组件对应的第一数据自第一组件对应的原始存储空间转移至目标存储空间,所述目标存储空间为所述原始存储空间外的存储空间。S203. Transfer the first data corresponding to the first component from the original storage space corresponding to the first component to the target storage space according to the preset offset. The target storage space is storage outside the original storage space. space.
可选地,所述预设偏移量可以为目标存储空间的首地址与原始存储空间的首地址的偏移量。Optionally, the preset offset may be an offset between the first address of the target storage space and the first address of the original storage space.
可选地,所述预设偏移量可以由相关人员设定。Optionally, the preset offset can be set by relevant personnel.
可选地,所述预设偏移量还可以根据获取到的内存申请请求确定。Optionally, the preset offset can also be determined based on the obtained memory application request.
在本申请提供的一些可选的实施例中,参见上述图2,所述方法还包括S301-S303:In some optional embodiments provided by this application, referring to the above-mentioned Figure 2, the method also includes S301-S303:
S301、确定第一地址信息指向的第一地址是否为目标存储空间内的地址;S301. Determine whether the first address pointed to by the first address information is an address in the target storage space;
S302、在所述第一地址信息指向的第一地址为所述目标存储空间内的地址时,获取所述第一地址相对于第一地址信息的地址的偏移量;S302. When the first address pointed by the first address information is an address in the target storage space, obtain the offset of the first address relative to the address of the first address information;
可选地,所述第一地址相对于第一地址信息的地址的偏移量,可以为在目标存储空间中,第一地址与第一地址信息的地址之间的差值。Optionally, the offset of the first address relative to the address of the first address information may be a difference between the first address and the address of the first address information in the target storage space.
S303、根据所述偏移量更新所述第一地址信息,得到更新后的第一地址信息;S303. Update the first address information according to the offset to obtain updated first address information;
可选地,在S303中,根据所述偏移量更新所述第一地址信息,得到更新后的第一地址信息,包括:Optionally, in S303, update the first address information according to the offset to obtain updated first address information, including:
根据所述偏移量确定对应的标识;Determine the corresponding identifier according to the offset;
使用所述标识替换所述第一地址信息指向的第一地址,得到更新后的第一地址信息。Use the identifier to replace the first address pointed by the first address information to obtain updated first address information.
S304、根据所述更新后的第一地址信息与所述第一地址信息的地址更新用于访问所述第一地址的第二对象的第二访问信息,使得所述第二对象在访问所述第一地址时,根据所述更新后的第一地址信息、所述更新后的第二访问信息查找到所述第一地址。S304. Update the second access information of the second object used to access the first address according to the updated first address information and the address of the first address information, so that the second object accesses the first address when accessing the first address information. When the first address is the first address, the first address is found according to the updated first address information and the updated second access information.
可选地,S304、根据所述更新后的第一地址信息与所述第一地址信息的地址更新用于访问所述第一地址的第二对象的第二访问信息,包括:Optionally, S304. Update the second access information for accessing the second object of the first address according to the updated first address information and the address of the first address information, including:
将所述更新后的第一地址信息与所述第一地址信息的地址的第二关联关系相应的代码添加至用于访问所述第一地址的第二对象的第二访问信息中,使得在终端接收到更新后的所述第二访问信息对应的第二访问请求时,根据所述更新后的第一地址信息与所述第二关联关系确定出所述第一地址;将所述第一地址中的数据确定为所述第二访问请求对应的访问结果。其中,第二对象的第二访问信息可以相关的访问函数。Code corresponding to the second association relationship between the updated first address information and the address of the first address information is added to the second access information for accessing the second object of the first address, so that in When the terminal receives the second access request corresponding to the updated second access information, the terminal determines the first address based on the updated first address information and the second association relationship; The data in the address is determined to be the access result corresponding to the second access request. The second access information of the second object may be related to the access function.
具体地,参见图3所示,图3为本申请实施例提供的基于地址处理的攻击防御方法的另一流程示意图,当第一地址信息指向的第一地址为所述目标存储空间内的地址:地址a时,获取所述地址a相对于第一地址信息的地址的偏移量;根据所述偏移量更新所述第一地址信息,得到更新后的第一地址信息。例如,当第一地址信息的地址为0190,地址a为0194时,偏移量为4。Specifically, see Figure 3, which is another schematic flowchart of an attack defense method based on address processing provided by an embodiment of the present application. When the first address pointed to by the first address information is an address in the target storage space, : When the address is a, obtain the offset of the address a relative to the address of the first address information; update the first address information according to the offset to obtain the updated first address information. For example, when the address of the first address information is 0190 and the address a is 0194, the offset is 4.
可选地,第一组件对应的第一数据中可包括多个第一地址信息时,具体可根据第一地址信息指向的第一地址位于第一组件对应的目标存储空间内,还是位于其他组件(第二组件)对应的存储空间内,做出相应的处理,如:第一地址信息add1指向的第一地址位于所述目标存储空间内时,获取所述第一地址相对于add1的地址的偏移量;根据所述偏移量更新所述add1,得到更新后的add1;根据所述更新后的add1与所述add1的地址更新用于访问所述第一地址的第二对象的第二访问信息,使得所述第二对象在访问所述第一地址时,根据所述更新后的add1、所述更新后的第二访问信息查找到所述第一地址。另一第一地址信息add2指向的第一地址位于其他组件(如第二组件)对应的存储空间中的地址时,获取所述第一地址对应的第一预设标识;将所述第一地址与所述第一预设标识的第一关联关系存储至第一存储空间,所述第一存储空间为所述第一组件对应的目标存储空间外的存储空间;根据所述第一预设标识与所述第一关联关系更新所述add2与用于访问所述第一地址的第一对象的第一访问信息,使得所述第一对象在访问所述第一地址时,根据所述更新后的add2、更新后的第一访问信息,以及所述第一关联关系查找到所述第一地址。Optionally, when the first data corresponding to the first component may include multiple first address information, it may be determined based on whether the first address pointed to by the first address information is located in the target storage space corresponding to the first component or is located in another component. (Second component) perform corresponding processing in the corresponding storage space, such as: when the first address pointed to by the first address information add1 is located in the target storage space, obtain the first address relative to the address of add1. Offset; update the add1 according to the offset to obtain the updated add1; update the second object used to access the second object of the first address according to the updated add1 and the address of the add1. Access information allows the second object to find the first address based on the updated add1 and the updated second access information when accessing the first address. When the first address pointed to by another first address information add2 is located in the address in the storage space corresponding to other components (such as the second component), obtain the first preset identification corresponding to the first address; The first association relationship with the first preset identification is stored in a first storage space, and the first storage space is a storage space outside the target storage space corresponding to the first component; according to the first preset identification Update the add2 and the first access information of the first object used to access the first address with the first association, so that when the first object accesses the first address, the first access information is updated according to the updated The first address is found using add2, the updated first access information, and the first association relationship.
可选地,上述方法还包括:在所述第一地址信息指向的第一地址不为所述目标存储空间外的地址时,则获取第一地址对应的第一预设标识,并执行前述S103至S104。在本申请提供的一些可选的实施例中,所述方法还包括S501-S502:Optionally, the above method also includes: when the first address pointed by the first address information is not an address outside the target storage space, obtain the first preset identification corresponding to the first address, and perform the aforementioned S103 Go to S104. In some optional embodiments provided in this application, the method also includes S501-S502:
S501、在接收到更新后的所述第一访问信息对应的第一访问请求时,根据所述第一预设标识与所述第一关联关系确定出所述第一地址;S501. When receiving the first access request corresponding to the updated first access information, determine the first address according to the first preset identification and the first association relationship;
可选地,其中,第一关联关系中可以包括多个预设标识,与各预设标识对应的地址,在S501中,在接收到更新后的所述第一访问信息对应的第一访问请求时,根据所述第一预设标识与所述第一关联关系确定出所述第一地址,包括:将所述第一关联关系中,与所述第一预设标识相同的预设标识对应的地址,作为所述第一地址。Optionally, the first association relationship may include multiple preset identifiers and addresses corresponding to each preset identifier. In S501, after receiving the first access request corresponding to the updated first access information, When, determining the first address according to the first preset identification and the first association relationship includes: corresponding to the preset identification in the first association relationship that is the same as the first preset identification. address as the first address.
S502、将所述第一地址中的数据确定为所述第一访问请求对应的访问结果。S502. Determine the data in the first address as the access result corresponding to the first access request.
可选地,进一步参见图4所示,图4为针对不同的类型的访问请求的数据处理方法示意图;上述方法还包括以下S41-S44:Optionally, refer further to Figure 4, which is a schematic diagram of a data processing method for different types of access requests; the above method also includes the following S41-S44:
S41、获取待处理的访问请求;S41. Obtain the pending access request;
可选地,该访问请求可以为相关的目标应用程序上线后,在执行第一组件的功能时调用数据的请求。Optionally, the access request can be a request for calling data when executing the function of the first component after the relevant target application is online.
S41、确定所述待处理的访问请求的类型;S41. Determine the type of the pending access request;
其中,待处理的访问请求的类型可以为用于访问第一组件对应的目标存储空间外的第一存储空间内存储的第一地址的第一访问请求,其中,第一访问请求具体为访问第一地址的第一对象的第一访问信息对应的访问请求。其中,第一访问请求中可包括第一对象的第一访问信息,其中,第一访问信息可以为相关的访问函数。The type of the access request to be processed may be a first access request for accessing the first address stored in the first storage space outside the target storage space corresponding to the first component, where the first access request is specifically for accessing the first address. An access request corresponding to the first access information of the first object at an address. The first access request may include first access information of the first object, where the first access information may be a relevant access function.
另外,待处理的访问请求的类型还可以为用于访问更新后的第二访问信息对应的第二访问请求。In addition, the type of the access request to be processed may also be a second access request corresponding to the updated second access information.
可选地,可通过待处理的访问请求中用于指示待处理的访问请求的类型的标识确定待处理的访问请求的类型。S41、若所述待处理的访问请求的类型为前述第一访问请求,则根据所述第一预设标识与所述第一关联关系确定出所述第一地址;将所述第一地址中的数据确定为所述第一访问请求对应的访问结果;Optionally, the type of the pending access request may be determined by an identifier in the pending access request that indicates the type of the pending access request. S41. If the type of the access request to be processed is the aforementioned first access request, determine the first address according to the first preset identifier and the first association relationship; add the first address to the first access request. The data is determined to be the access result corresponding to the first access request;
可选地,第一关联关系中可存储有多个已存标识,与各已存标识对应的第一目标地址;根据所述第一预设标识与所述第一关联关系确定出所述第一地址可包括:将所述第一关联关系中与所述第一预设标识相同的已存标识对应的第一目标地址作为第一地址。Optionally, a plurality of stored identifiers may be stored in the first association relationship, and the first target address corresponding to each stored identifier; the first target address may be determined based on the first preset identifier and the first association relationship. An address may include: using the first target address corresponding to the existing identifier that is the same as the first preset identifier in the first association relationship as the first address.
S41、若所述待处理的访问请求的类型为前述第二访问请求,则根据所述更新后的第一地址信息与所述第二关联关系确定出所述第一地址;并将所述第一地址中的数据确定为所述第二访问请求对应的访问结果。S41. If the type of the access request to be processed is the aforementioned second access request, determine the first address according to the updated first address information and the second association relationship; The data in an address is determined to be the access result corresponding to the second access request.
可选地,第二关联关系中可包括多个已存地址信息与各已存地址信息的第二目标地址;根据所述更新后的第一地址信息与所述第二关联关系确定出所述第一地址包括:将第二关联关系中,与所述更新后的第一地址信息相同的已存地址信息对应的第二目标地址作为第一地址。在本申请提供的一些可选的实施例中,所述方法还包括:Optionally, the second association relationship may include a plurality of stored address information and a second target address of each stored address information; the determined address is determined based on the updated first address information and the second association relationship. The first address includes: using the second target address corresponding to the stored address information that is the same as the updated first address information in the second association relationship as the first address. In some optional embodiments provided in this application, the method further includes:
当确定出针对所述目标存储空间的内存分配请求的次数大于第一预设次数时,和/或当确定出目标存储空间中被占用的存储空间的空间大小相对于目标存储空间的空间大小的占比大于第一预设占比时,对所述目标存储空间进行垃圾回收。When it is determined that the number of memory allocation requests for the target storage space is greater than the first preset number of times, and/or when it is determined that the space size of the occupied storage space in the target storage space is relative to the space size of the target storage space. When the proportion is greater than the first preset proportion, garbage collection is performed on the target storage space.
可选地,所述针对所述目标存储空间的内存分配请求可以为第一组件对应的第一数据需要申请占用目标存储空间中未占用的内存时,生成的内存分配请求。Optionally, the memory allocation request for the target storage space may be a memory allocation request generated when the first data corresponding to the first component needs to apply for occupying unoccupied memory in the target storage space.
具体地,针对触发对所述目标存储空间进行垃圾回收的方式,所述方法还包括S601-S603:Specifically, with regard to triggering garbage collection on the target storage space, the method further includes S601-S603:
S601、获取第一预设次数;S601. Obtain the first preset number of times;
可选地,第一预设次数为相关人员设定的次数。Optionally, the first preset number of times is the number set by the relevant person.
可选地,第一预设次数还可以为自动生成的随机次数。Optionally, the first preset number of times may also be an automatically generated random number of times.
S602、当接收到一次针对所述目标存储空间的内存分配请求时,确定所述内存分配请求的累积次数;S602. When receiving a memory allocation request for the target storage space, determine the cumulative number of memory allocation requests;
可选地,可设置一用于记录已获取到的针对所述目标存储空间的内存分配请求的次数的参数,该参数的数值则为内存分配请求的累计次数。每接收到一次针对所述目标存储空间的内存分配请求时,控制内存分配请求的累积次数增1。Optionally, a parameter may be set for recording the number of obtained memory allocation requests for the target storage space, and the value of the parameter is the cumulative number of memory allocation requests. Each time a memory allocation request for the target storage space is received, the cumulative number of memory allocation requests is controlled to increase by one.
可选地,可在执行前述增1以后执行确定内存分配请求的累积次数。Optionally, determining the cumulative number of memory allocation requests may be performed after performing the foregoing incrementing by one.
S603、当所述累积次数大于所述第一预设次数时,确定针对所述目标存储空间的内存分配请求的次数大于第一预设次数,并将所述内存分配请求的累积次数清零,获取第二预设次数,将所述第二预设次数作为新的第一预设次数,对所述目标存储空间进行垃圾回收;其中,所述第一预设次数和所述第二预设次数均为正整数。S603. When the accumulated number is greater than the first preset number, determine that the number of memory allocation requests for the target storage space is greater than the first preset number, and clear the accumulated number of memory allocation requests to zero. Obtain a second preset number of times, use the second preset number of times as a new first preset number of times, and perform garbage collection on the target storage space; wherein the first preset number of times and the second preset number of times are The times are all positive integers.
可选地,第二预设次数为相关人员设定的次数。Optionally, the second preset number of times is the number set by the relevant person.
可选地,第二预设次数还可以为自动生成的随机次数。可选地,所述方法还包括S604-S606:Optionally, the second preset number of times may also be an automatically generated random number of times. Optionally, the method also includes S604-S606:
S604、获取第一预设占比;S604. Obtain the first preset proportion;
可选地,第一预设占比为相关人员设定的比值。Optionally, the first preset ratio is a ratio set by the relevant person.
可选地,第一预设占比还可以为自动生成的随机比值。Optionally, the first preset ratio may also be an automatically generated random ratio.
S605、获取目标存储空间中被占用的存储空间的空间大小相对于目标存储空间的空间大小的占比;S605. Obtain the proportion of the occupied storage space in the target storage space relative to the target storage space;
S606、当确定出所述目标存储空间中被占用的存储空间的空间大小相对于目标存储空间的空间大小的占比不大于第一预设占比时,不处理;当确定出所述目标存储空间中被占用的存储空间的空间大小相对于目标存储空间的空间大小的占比大于第一预设占比时,获取第二预设占比,将所述第二预设占比作为新的第一预设占比,对所述目标存储空间进行垃圾回收。其中,所述第二预设占比大于所述第一预设占比,且所述第一预设占比和所述第二预设占比均大于0且小于1。S606. When it is determined that the proportion of the occupied storage space in the target storage space relative to the space size of the target storage space is not greater than the first preset proportion, no processing is performed; when it is determined that the target storage space is not larger than the first preset proportion. When the proportion of the space size of the occupied storage space relative to the space size of the target storage space is greater than the first preset proportion, the second preset proportion is obtained, and the second preset proportion is used as the new The first preset proportion is to perform garbage collection on the target storage space. Wherein, the second preset proportion is greater than the first preset proportion, and both the first preset proportion and the second preset proportion are greater than 0 and less than 1.
通过前述方案可以及时清理目标存储空间中的数据,打乱原始的数据存储位置的逻辑,可以避免黑客基于原始数据存储位置的逻辑攻击数据。Through the above solution, the data in the target storage space can be cleaned in time, disrupting the logic of the original data storage location, and preventing hackers from attacking the data based on the logic of the original data storage location.
可选地,前述S604-S606,还可以在所述累积次数不大于所述第一预设次数时执行,具体过程可参见图5。Optionally, the aforementioned S604-S606 can also be executed when the accumulated number of times is not greater than the first preset number of times. The specific process can be seen in Figure 5.
在本申请提供的一些可选的实施例中,对所述目标存储空间进行垃圾回收,包括:In some optional embodiments provided by this application, garbage collection is performed on the target storage space, including:
针对所述第一数据中的多个地址信息,当所述多个地址信息的地址不为连续的地址时,对所述多个地址信息进行拼接处理,使所述多个地址信息的地址为连续的地址。For the plurality of address information in the first data, when the addresses of the plurality of address information are not consecutive addresses, the plurality of address information is spliced so that the addresses of the plurality of address information are consecutive addresses.
在本申请提供的另一些可选的实施例中,对所述目标存储空间进行垃圾回收,包括:In some other optional embodiments provided by this application, garbage collection is performed on the target storage space, including:
针对所述第一数据中的多个地址信息中的各地址信息,当所述地址信息的地址未被访问的时长超过预设时长时,清除所述地址信息的地址中的数据。For each address information in the plurality of address information in the first data, when the address of the address information has not been accessed for a period exceeding a preset period of time, the data in the address of the address information is cleared.
由于存储空间中的内存分配是顺序切割分配,针对未进行垃圾回收的存储空间,攻击者可能预测到存储空间的内存分配,进而通过堆喷射等攻击手法将攻击对象布局到漏洞可以影响到的范围内,以进行攻击。而在上述过程中,通过垃圾回收可以针对目标存储空间中的内存进行拼接、回收,以打破目标存储空间中的内存布局,攻击者所依赖的内存布局被打破,从而无法构造所需布局,或者在垃圾回收中提前出现错误导致攻击路径被阻断,使得攻击者无法更改目标存储空间中的内存布局,进而无法扩大漏洞影响范围,有效提高组件数据的安全性。并且,本申请的方案,还能够通用地解决各个应用程序中碎片化地引入不安全的组件导致的安全隐患,并对0日漏洞防御也有一定的抵御作用。Since the memory allocation in the storage space is sequential cutting and allocation, for the storage space that has not been garbage collected, the attacker may predict the memory allocation of the storage space, and then use attack techniques such as heap spraying to layout the attack object to the range that the vulnerability can affect. within to attack. In the above process, the memory in the target storage space can be spliced and recycled through garbage collection to break the memory layout in the target storage space. The memory layout that the attacker relies on is broken, making it impossible to construct the required layout, or Early errors in garbage collection block the attack path, making it impossible for the attacker to change the memory layout in the target storage space, thereby preventing the vulnerability from expanding the scope of impact and effectively improving the security of component data. Moreover, the solution of this application can also universally solve the security risks caused by the fragmented introduction of unsafe components in various applications, and also has a certain defensive effect on zero-day vulnerability defense.
在本申请提供的一些可选的实施例中,所述方法还包括S701-S703:In some optional embodiments provided in this application, the method also includes S701-S703:
S701、当接收到针对所述目标存储空间的数据写入请求时,将所述目标存储空间的权限设置为可读可写权限;S701. When receiving a data write request for the target storage space, set the permissions of the target storage space to readable and writable permissions;
可选地,所述数据写入请求中可以包括对应的数据。所述数据写入请求可以为所述用户利用上述终端或服务器触发的。Optionally, the data writing request may include corresponding data. The data writing request may be triggered by the user using the above terminal or server.
S702、根据所述数据写入请求写入对应的数据;S702. Write corresponding data according to the data writing request;
S703、将所述目标存储空间的权限设置为可读可执行权限。S703. Set the permissions of the target storage space to readable and executable permissions.
当攻击者获得了目标应用程序全局内存读写权限时,通常会对目标应用程序自身申请的具有可读可写可执行权限的内存进行篡改,因此,上述方案可以阻断可读可写可执行权限的生成,以提高目标应用程序中组件数据的安全性。When an attacker obtains the global memory read and write permissions of the target application, he usually tamper with the memory that the target application itself applies for with read, write, and executable permissions. Therefore, the above solution can block the read, write, and executable permissions. Generation of permissions to improve the security of component data in the target application.
在本申请提供的一些可选的实施例中,所述方法还包括S801-S803:In some optional embodiments provided by this application, the method also includes S801-S803:
S801、获取用户输入的防御指令;S801. Obtain the defense instructions input by the user;
可选地,用户可通过点击相应的按钮触发前述防御指令,可选地,不同的按钮可对应有不同的目标算法。Optionally, the user can trigger the aforementioned defense instructions by clicking the corresponding button. Optionally, different buttons can correspond to different target algorithms.
S802、获取所述防御指令对应的目标算法;S802. Obtain the target algorithm corresponding to the defense instruction;
S803、根据所述目标算法对所述第一组件对应的第二数据进行更新。S803. Update the second data corresponding to the first component according to the target algorithm.
可选地,所述防御指令对应的目标算法可以包括:llvm编译工具链的控制流完整性(Control-Flow Integrity)算法和Windows编译工具链的CFG(ControlFlowGuard,控制流保护)算法。Optionally, the target algorithm corresponding to the defense instruction may include: the control-flow integrity (Control-Flow Integrity) algorithm of the llvm compilation tool chain and the CFG (ControlFlowGuard, control flow protection) algorithm of the Windows compilation tool chain.
可选地,当所述应用程序的应用程序系统为安卓系统或者Linux系统时,所述防御指令对应的目标算法为llvm编译工具链的控制流完整性算法;当所述应用程序系统为Windows系统时,所述防御指令对应的目标算法为Windows编译工具链的CFG。Optionally, when the application system of the application is an Android system or a Linux system, the target algorithm corresponding to the defense instruction is the control flow integrity algorithm of the llvm compilation tool chain; when the application system is a Windows system At this time, the target algorithm corresponding to the defense instruction is CFG of the Windows compilation tool chain.
在一些可选的实施例中,前述第一关联关系中,还包括:用于访问第一地址的访问对象的对象信息,所述方法还包括:在获取到第一访问请求时,若确定所述第一访问请求中携带的第一对象的对象信息与所述访问对象的对象信息相同,则确定根据所述第一预设标识与所述第一关联关系确定出所述第一地址。In some optional embodiments, the aforementioned first association relationship also includes: object information of the access object used to access the first address, and the method further includes: when obtaining the first access request, if it is determined that the If the object information of the first object carried in the first access request is the same as the object information of the access object, it is determined that the first address is determined based on the first preset identifier and the first association relationship.
进一步地,以下结合具体场景针对本申请进行说明。参见图6,图6为本申请实施例提供的基于地址处理的攻击防御方法的第四流程示意图。本方案分为两个阶段,分别为编译阶段和运行阶段。Further, this application will be described below in conjunction with specific scenarios. Referring to Figure 6, Figure 6 is a fourth schematic flowchart of an attack defense method based on address processing provided by an embodiment of the present application. This program is divided into two stages, namely the compilation stage and the running stage.
可选地,在编译阶段确定易受攻击的第一组件,即确定防御位置。在产品厂商开发新的应用程序或者发布原始应用程序的新版本之前,相关人员可以获取原始应用程序的多个组件,对多个组件中的各组件进行安全性评估,并确定是否存在第一组件,具体的安全性评估方式可以参见上述内容。当不存在第一组件时,不进行处理,当存在第一组件时,对第一组件进行编译,即仅针对易受攻击的组件进行防御,将编译后的第一组件链接到原始应用程序中,得到目标应用程序并发布。Optionally, the first vulnerable component is determined during the compilation phase, i.e. the defense position is determined. Before a product manufacturer develops a new application or releases a new version of the original application, relevant personnel can obtain multiple components of the original application, conduct a security assessment on each of the multiple components, and determine whether the first component exists , please refer to the above content for specific security assessment methods. When the first component does not exist, no processing is performed. When the first component exists, the first component is compiled, that is, only the vulnerable components are defended, and the compiled first component is linked to the original application. , get the target application and publish it.
可选地,在运行阶段,启动目标应用程序,目标应用程序中的第一组件是基于前述四个子机制编译好的组件,该四个子机制分别是内存布局阻断机制、全局内存读写阻断机制、Shellcode执行条件阻断机制和ROP攻击阻断机制。其中,内存布局阻断机制用于执行上述S601-S605;全局内存读写阻断机制用于执行上述S101-S104、S201-S203、S301-S303以及S501-S502;Shellcode执行条件阻断机制用于执行上述S701-S703;ROP攻击阻断机制用于执行上述S801-S803,具体过程可参见上述描述,此处不再赘述。Optionally, during the running phase, the target application is started. The first component in the target application is a component compiled based on the aforementioned four sub-mechanisms. The four sub-mechanisms are the memory layout blocking mechanism and global memory read and write blocking. mechanism, Shellcode execution condition blocking mechanism and ROP attack blocking mechanism. Among them, the memory layout blocking mechanism is used to execute the above S601-S605; the global memory read and write blocking mechanism is used to execute the above S101-S104, S201-S203, S301-S303 and S501-S502; the Shellcode execution condition blocking mechanism is used Execute the above S701-S703; the ROP attack blocking mechanism is used to execute the above S801-S803. For the specific process, please refer to the above description and will not be repeated here.
上述所有的技术方案,可以采用任意结合形成本申请的可选实施例,在此不再一一赘述。All the above technical solutions can be combined in any way to form optional embodiments of the present application, and will not be described again one by one.
为便于更好的实施本申请实施例的基于地址处理的攻击防御方法,本申请实施例还提供一种基于地址处理的攻击防御装置,请参阅图7,图7为本申请实施例提供的基于地址处理的攻击防御装置的结构示意图。其中,该基于地址处理的攻击防御装置70可以包括:In order to facilitate better implementation of the attack defense method based on address processing in the embodiment of the present application, the embodiment of the present application also provides an attack defense device based on address processing. Please refer to Figure 7. Figure 7 shows the attack defense method based on address processing provided in the embodiment of the present application. Structural diagram of the attack defense device for address processing. Wherein, the address processing-based attack defense device 70 may include:
获取单元71,用于获取第一组件对应的第一数据中的第一地址信息;The obtaining unit 71 is used to obtain the first address information in the first data corresponding to the first component;
所述获取单元71,还用于在所述第一地址信息指向的第一地址为第二组件对应的存储空间中的地址时,获取所述第一地址对应的第一预设标识,所述第二组件与所述第一组件不同;The obtaining unit 71 is also configured to obtain the first preset identification corresponding to the first address when the first address pointed by the first address information is an address in the storage space corresponding to the second component. a second component that is different from said first component;
存储单元72,用于将所述第一地址与所述第一预设标识的第一关联关系存储至第一存储空间,所述第一存储空间为所述第一组件对应的目标存储空间外的存储空间;The storage unit 72 is configured to store the first association relationship between the first address and the first preset identification in a first storage space, where the first storage space is outside the target storage space corresponding to the first component. storage space;
更新单元73,用于根据所述第一预设标识与所述第一关联关系更新所述第一地址信息与用于访问所述第一地址的第一对象的第一访问信息,使得所述第一对象在访问所述第一地址时,根据所述更新后的第一地址信息、更新后的第一访问信息,以及所述第一关联关系查找到所述第一地址。Update unit 73, configured to update the first address information and the first access information for accessing the first object of the first address according to the first preset identification and the first association relationship, so that the When the first object accesses the first address, it searches for the first address based on the updated first address information, the updated first access information, and the first association relationship.
在本申请提供的一些可选的实施例中,前述装置在用于根据所述第一预设标识与所述第一关联关系更新所述第一地址信息与用于访问所述第一地址的第一对象的第一访问信息时,具体用于:In some optional embodiments provided by this application, the aforementioned device is used for updating the first address information according to the first preset identification and the first association relationship and for accessing the first address. When the first access information of the first object is used, it is specifically used for:
使用所述第一预设标识替换所述第一地址,以及根据所述第一预设标识与所述第一关联关系更新用于访问所述第一地址的第一对象的第一访问信息。The first address is replaced with the first preset identifier, and the first access information for accessing the first object of the first address is updated according to the first preset identifier and the first association relationship.
可选地,所述装置用于:Optionally, the device is used for:
在接收到更新后的所述第一访问信息对应的第一访问请求时,根据所述第一预设标识与所述第一关联关系确定出所述第一地址;When receiving the first access request corresponding to the updated first access information, determine the first address according to the first preset identification and the first association relationship;
将所述第一地址中的数据确定为所述第一访问请求对应的访问结果。The data in the first address is determined as the access result corresponding to the first access request.
可选地,所述装置还用于:Optionally, the device is also used for:
获取所述第一组件对应的第一数据;Obtain the first data corresponding to the first component;
获取预设偏移量;Get the default offset;
根据所述预设偏移量将所述第一组件对应的第一数据自第一组件对应的原始存储空间转移至所述目标存储空间,所述目标存储空间为所述原始存储空间外的存储空间。Transfer the first data corresponding to the first component from the original storage space corresponding to the first component to the target storage space according to the preset offset, and the target storage space is storage outside the original storage space. space.
可选地,所述装置还用于:Optionally, the device is also used for:
在所述第一地址信息指向的第一地址为所述目标存储空间内的地址时,获取所述第一地址相对于第一地址信息的地址的偏移量;When the first address pointed by the first address information is an address in the target storage space, obtain the offset of the first address relative to the address of the first address information;
根据所述偏移量更新所述第一地址信息,得到更新后的第一地址信息;Update the first address information according to the offset to obtain updated first address information;
根据所述更新后的第一地址信息与所述第一地址信息的地址更新用于访问所述第一地址的第二对象的第二访问信息,使得所述第二对象在访问所述第一地址时,根据所述更新后的第一地址信息、所述更新后的第二访问信息查找到所述第一地址。The second access information used to access the second object at the first address is updated according to the updated first address information and the address of the first address information, so that the second object accesses the first address. When searching for an address, the first address is found based on the updated first address information and the updated second access information.
可选地,所述装置还用于:Optionally, the device is also used for:
当确定出针对所述目标存储空间的内存分配请求的次数大于第一预设次数时,和/或当确定出目标存储空间中被占用的存储空间的空间大小相对于目标存储空间的空间大小的占比大于第一预设占比时,对所述目标存储空间进行垃圾回收。When it is determined that the number of memory allocation requests for the target storage space is greater than the first preset number of times, and/or when it is determined that the space size of the occupied storage space in the target storage space is relative to the space size of the target storage space. When the proportion is greater than the first preset proportion, garbage collection is performed on the target storage space.
可选地,所述装置还用于:Optionally, the device is also used for:
当接收到针对所述目标存储空间的数据写入请求时,将所述目标存储空间的权限设置为可读可写权限;When receiving a data write request for the target storage space, set the permissions of the target storage space to read and write permissions;
根据所述数据写入请求写入对应的数据;Write corresponding data according to the data writing request;
将所述目标存储空间的权限设置为可读可执行权限。Set the permissions of the target storage space to readable and executable permissions.
可选地,所述装置还用于:Optionally, the device is also used for:
获取用户输入的防御指令;Get the defense instructions input by the user;
获取所述防御指令对应的目标算法;Obtain the target algorithm corresponding to the defense instruction;
根据所述目标算法对所述第一组件对应的第二数据进行更新。The second data corresponding to the first component is updated according to the target algorithm.
可选地,所述装置还用于:Optionally, the device is also used for:
获取目标应用程序的多个组件;Get multiple components of the target application;
确定所述多个组件中,包含地址信息的至少部分组件;Determine at least some of the components that contain address information among the plurality of components;
根据所述至少部分组件确定所述第一组件。The first component is determined based on the at least part of the component.
可选地,所述装置还用于:Optionally, the device is also used for:
获取用户针对从目标应用程序的多个组件中选择出第一组件的选择指令;Obtaining a user's selection instruction for selecting a first component from multiple components of the target application;
根据所述选择指令确定所述第一组件。The first component is determined based on the selection instruction.
上述基于地址处理的攻击防御装置的各个单元可全部或部分通过软件、硬件及其组合来实现。上述各个单元可以以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行上述各个单元对应的操作。Each unit of the above-mentioned address processing-based attack defense device may be implemented in whole or in part by software, hardware, or combinations thereof. Each of the above units may be embedded in or independent of the processor of the computer device in the form of hardware, or may be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above units.
基于地址处理的攻击防御装置70,可以集成在具备储存器并安装有处理器而具有运算能力的终端或服务器中,或者该基于地址处理的攻击防御装置70为该终端或服务器。The address processing-based attack defense device 70 may be integrated into a terminal or server that has a memory and is equipped with a processor and has computing capabilities, or the address processing-based attack defense device 70 may be the terminal or server.
可选的,本申请还提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现上述各方法实施例中的步骤。Optionally, this application also provides a computer device, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, it implements the steps in the above method embodiments.
图8为本申请实施例提供的计算机设备的结构示意图,该计算机设备可以是终端或服务器。如图8所示,该计算机设备800可以包括:通信接口801,存储器802,处理器803和通信总线804。通信接口801,存储器802,处理器803通过通信总线804实现相互间的通信。通信接口801用于计算机设备800与外部设备进行数据通信。存储器802可用于存储软件程序以及模块,处理器803通过运行存储在存储器802的软件程序以及模块,例如前述方法实施例中的相应操作的软件程序。Figure 8 is a schematic structural diagram of a computer device provided by an embodiment of the present application. The computer device may be a terminal or a server. As shown in Figure 8, the computer device 800 may include: a communication interface 801, a memory 802, a processor 803 and a communication bus 804. The communication interface 801, the memory 802, and the processor 803 realize communication with each other through the communication bus 804. The communication interface 801 is used for data communication between the computer device 800 and external devices. The memory 802 can be used to store software programs and modules, and the processor 803 runs the software programs and modules stored in the memory 802, such as the software programs for corresponding operations in the foregoing method embodiments.
可选的,该处理器803可以调用存储在存储器802的软件程序以及模块执行如下操作:Optionally, the processor 803 can call software programs and modules stored in the memory 802 to perform the following operations:
获取第一组件对应的第一数据中的第一地址信息;Obtain the first address information in the first data corresponding to the first component;
在所述第一地址信息指向的第一地址为第二组件对应的存储空间中的地址时,获取所述第一地址对应的第一预设标识,所述第二组件与所述第一组件不同;When the first address pointed by the first address information is an address in the storage space corresponding to the second component, the first preset identifier corresponding to the first address is obtained, and the second component and the first component different;
将所述第一地址与所述第一预设标识的第一关联关系存储至第一存储空间,所述第一存储空间为第二组件对应的存储空间外的存储空间;Store the first association relationship between the first address and the first preset identification in a first storage space, where the first storage space is a storage space outside the storage space corresponding to the second component;
根据所述第一预设标识与所述第一关联关系更新所述第一地址信息与用于访问所述第一地址的对象的访问信息,使得所述对象在访问所述第一地址时,根据所述更新后的第一地址信息、更新后的访问信息,以及所述第一关联关系查找到所述第一地址。The first address information and the access information of the object used to access the first address are updated according to the first preset identification and the first association relationship, so that when the object accesses the first address, The first address is found according to the updated first address information, the updated access information, and the first association relationship.
本申请还提供了一种计算机可读存储介质,用于存储计算机程序。该计算机可读存储介质可应用于计算机设备,并且该计算机程序使得计算机设备执行本申请实施例中的各方法中的相应流程,为了简洁,在此不再赘述。This application also provides a computer-readable storage medium for storing computer programs. The computer-readable storage medium can be applied to computer equipment, and the computer program causes the computer equipment to execute corresponding processes in the methods in the embodiments of the present application. For the sake of brevity, details will not be described again here.
本申请还提供了一种计算机程序产品,该计算机程序产品包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得计算机设备执行本申请实施例中的各方法中的相应流程,为了简洁,在此不再赘述。The application also provides a computer program product, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to execute the corresponding processes in the methods in the embodiments of the present application. For the sake of brevity, details will not be repeated here.
本申请还提供了一种计算机程序,该计算机程序包括计算机指令,计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得计算机设备执行本申请实施例中的各方法中的相应流程,为了简洁,在此不再赘述。The application also provides a computer program, the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to execute the corresponding processes in the methods in the embodiments of the present application. For the sake of brevity, details will not be repeated here.
应理解,本申请实施例的处理器可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法实施例的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器可以是通用处理器、数字信号处理器(Digital SignalProcessor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。It should be understood that the processor in the embodiment of the present application may be an integrated circuit chip and has signal processing capabilities. During the implementation process, each step of the above method embodiment can be completed through an integrated logic circuit of hardware in the processor or instructions in the form of software. The above-mentioned processor can be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), an off-the-shelf programmable gate array (Field Programmable Gate Array, FPGA) or other programmable processors. Logic devices, discrete gate or transistor logic devices, discrete hardware components. Each method, step and logical block diagram disclosed in the embodiment of this application can be implemented or executed. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly implemented by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other mature storage media in this field. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
可以理解,本申请实施例中的存储器可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data RateSDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(DirectRambus RAM,DR RAM)。应注意,本文描述的系统和方法的存储器旨在包括但不限于这些和任意其它适合类型的存储器。It can be understood that the memory in the embodiment of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory can be read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory (Erasable PROM, EPROM), electrically removable memory. Erase programmable read-only memory (Electrically EPROM, EEPROM) or flash memory. The volatile memory may be random access memory (RAM), which is used as an external cache. By way of illustration, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (Dynamic RAM, DRAM), synchronous dynamic random access memory (Synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (Double Data Rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (Synchlink DRAM, SLDRAM) and direct memory bus random access memory (DirectRambus RAM, DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, without limitation, these and any other suitable types of memory.
应理解,上述存储器为示例性但不是限制性说明,例如,本申请实施例中的存储器还可以是静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synch link DRAM,SLDRAM)以及直接内存总线随机存取存储器(Direct Rambus RAM,DR RAM)等等。也就是说,本申请实施例中的存储器旨在包括但不限于这些和任意其它适合类型的存储器。It should be understood that the above memory is illustrative but not restrictive. For example, the memory in the embodiment of the present application can also be static random access memory (static RAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), Synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous connection Dynamic random access memory (synch link DRAM, SLDRAM) and direct memory bus random access memory (Direct Rambus RAM, DR RAM) and so on. That is, memories in embodiments of the present application are intended to include, but are not limited to, these and any other suitable types of memories.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用程序和设计约束条件。专业技术人员可以对每个特定的应用程序来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technology solution. Skilled artisans may implement the described functionality using different methods for each specific application, but such implementations should not be considered beyond the scope of this application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be described again here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in the embodiment of the present application can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer or a server) to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage media include: U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk and other media that can store program codes.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应所述以权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application. should be covered by the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.
Claims (14)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211609733.6A CN116975869A (en) | 2022-12-14 | 2022-12-14 | Attack defense method and device based on address processing, electronic equipment and medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211609733.6A CN116975869A (en) | 2022-12-14 | 2022-12-14 | Attack defense method and device based on address processing, electronic equipment and medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN116975869A true CN116975869A (en) | 2023-10-31 |
Family
ID=88483807
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202211609733.6A Pending CN116975869A (en) | 2022-12-14 | 2022-12-14 | Attack defense method and device based on address processing, electronic equipment and medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116975869A (en) |
-
2022
- 2022-12-14 CN CN202211609733.6A patent/CN116975869A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP3123311B1 (en) | Malicious code protection for computer systems based on process modification | |
| US9747172B2 (en) | Selective access to executable memory | |
| US9229881B2 (en) | Security in virtualized computer programs | |
| JP6984710B2 (en) | Computer equipment and memory management method | |
| TW201805806A (en) | Kernel-based detection of target application functionality using virtual address mapping | |
| CN105393255A (en) | Process evaluation for malware detection in virtual machines | |
| KR20200052957A (en) | Security control method and computer system | |
| US8843926B2 (en) | Guest operating system using virtualized network communication | |
| JP2015531948A (en) | Secure disk access control | |
| US9900324B1 (en) | System to discover and analyze evasive malware | |
| US9805197B2 (en) | Secure host operating system running a virtual guest operating system | |
| RU2580016C1 (en) | Method for transfer of control between memory areas | |
| CN105512550A (en) | Systems and methods for active operating system kernel protection | |
| US20170068587A1 (en) | Data dump for a memory in a data processing system | |
| US20190102279A1 (en) | Generating an instrumented software package and executing an instance thereof | |
| CN111177726A (en) | A system vulnerability detection method, device, equipment and medium | |
| US10929148B2 (en) | Executing services in containers | |
| US10628188B2 (en) | Disabling just-in-time translation for application functions | |
| Huber et al. | A flexible framework for mobile device forensics based on cold boot attacks | |
| CN116975869A (en) | Attack defense method and device based on address processing, electronic equipment and medium | |
| RU2623883C1 (en) | Method of implementating instructions in systemic memory | |
| Kozma | Effectiveness of Control-Flow Integrity in the Linux Kernel: an Empirical Study | |
| Zou et al. | Memshepherd: comprehensive memory bug fault‐tolerance system | |
| WONG | Rust and the importance of memory safe systems programming languages | |
| Verma | Multimedia Attacks on Android devices using StageFright exploit |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination |