Large model security protection method, computer program product and server

By deploying the RASP module and scrambling and descrambling technology in the server, the problem of difficulty in tracing the source of prompt injection attacks in large language models is solved, effective security protection and attack identification of large models are achieved, and security traceability analysis capabilities are improved.

CN118797630APending Publication Date: 2024-10-18CHINA MOBILE COMM LTD RES INST +1
View PDF -1 Cites 5 Cited by

Patent Information

Application Number
CN202410592521.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-13
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

When existing technologies protect large language models, it is difficult to identify and trace the source of injection attacks, and the root cause of the attack cannot be effectively eliminated, resulting in difficulty in identifying and tracing the source.

Method used

By deploying the RASP module in the server, the user ID and session ID are obtained and verified, the scrambling sequence generated by the linear feedback shift register is used for data scrambling and descrambling, the compliance of the access request is confirmed, and traceability analysis is performed through the response message , to achieve attack interception and traceability.

Benefits of technology

It improves the security protection capabilities of large models, reduces the difficulty of attack source tracing, enhances the ability to identify and intercept illegal requests, and ensures the security of large models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118797630A_ABST
    Figure CN118797630A_ABST
Patent Text Reader

Abstract

The invention discloses a large model security protection method, a computer program product and a server. The large model security protection method is applied to a first server, and the method comprises the following steps: obtaining an access request for a large model; the access request comprises a user identifier and / or a session identifier; determining whether the access request is compliant; if the access request is compliant, storing the user identifier and / or the session identifier, and sending the access request to a large model; obtaining a response message of the large model; the response message comprises a user identifier and / or a session identifier; and determining whether the access request is a legal request based on the user identifier and / or the session identifier in the response message.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a large model security protection method, a computer program product and a server. Background Art

[0002] At present, the types of risks faced by large language models include prompt injection attacks, adversarial attacks, backdoor attacks, data pollution, software vulnerabilities, privacy abuse and other risks. Among these security threats, prompt injection attacks are extremely harmful because they use harmful prompts to overwrite the original instructions of the large language model. Related technologies mainly implement prompt injection attack protection by filtering and cleaning prompt data. When accessing or prompting training of large models, if the access or prompt data is missed during the cleaning, filtering and protection process or the input information cannot identify the attack, it will be impossible to trace the source, and the root cause of the attack cannot be effectively eliminated. There are problems such as high difficulty in attack identification and tracing. Summary of the invention

[0003] In view of this, an embodiment of the present invention provides a large model security protection method, a computer program product and a server, which can realize large model attack tracing.

[0004] The technical solution of the embodiment of the present invention is achieved as follows:

[0005] On the one hand, an embodiment of the present invention provides a large model security protection method, which is applied to a first server, and the method includes:

[0006] Obtaining an access request to the large model; the access request includes a user identifier and / or a session identifier;

[0007] Determining whether the access request is compliant;

[0008] If the access request complies with the regulations, saving the user identifier and / or the session identifier, and sending the access request to the large model;

[0009] Obtaining a response message of the large model; the response message includes a user identifier and / or a session identifier;

[0010] Based on the user identifier and / or session identifier in the response message, it is confirmed whether the access request is a legitimate request.

[0011] In the above solution, confirming whether the access request is a legitimate request based on the user identifier and / or session identifier in the response message includes:

[0012] Determining whether the user identifier and / or session identifier in the response message is consistent with the user identifier and / or session identifier in the access request stored in advance;

[0013] If they are consistent, it is determined that the access request is a legitimate request;

[0014] If they are inconsistent, it is determined that the access request is an illegal request.

[0015] In the above solution, obtaining the access request to the large model includes:

[0016] Acquire the access request sent by the second server, where the access request also includes a certificate, and the certificate is issued by the second server;

[0017] Correspondingly, determining whether the access request is compliant includes:

[0018] verifying the certificate;

[0019] If the certificate passes the verification, the attack identification capability of the large model is called to analyze whether the access request is compliant.

[0020] In the above solution, if it is determined that the access request is a legitimate request, the method further includes:

[0021] The response message is sent to the second server, wherein the response message includes a certificate.

[0022] In the above solution, the user identifier and / or the session identifier in the access request is scrambled by the second server, and the storing of the user identifier and / or the session identifier includes:

[0023] Descramble the user ID and / or session ID in the access request;

[0024] The descrambled user identifier and / or the session identifier is saved.

[0025] In the above solution, the user identifier and / or session identifier in the response message is scrambled by the large model, and the method further includes:

[0026] The user identifier and / or session identifier in the response message is descrambled.

[0027] In the above solution, the access message includes scrambled data scrambled by an m-sequence, and the m-sequence is generated by a linear feedback shift register in the second server; and the descrambling of the user identifier and / or session identifier in the access request includes:

[0028] Calculate the cyclic shift autocorrelation of the scrambled data by using different m sequences to obtain the scrambled m sequence;

[0029] Descrambling is performed based on the scrambled m-sequence to obtain a user identifier and / or a session identifier.

[0030] In the above scheme, the response message includes scrambled data scrambled by an m-sequence, and the m-sequence is generated by a linear feedback shift register in a large model; the method further includes:

[0031] Calculate the cyclic shift autocorrelation of the scrambled data by using different m sequences to obtain the scrambled m sequence;

[0032] Descrambling is performed based on the scrambled m-sequence to obtain a user identifier and / or a session identifier.

[0033] In the above solution, after confirming whether the access request is a legitimate request, the method further includes:

[0034] If it is determined that the access request is an illegal request, the response message is refused to be sent.

[0035] In the above scheme, the large model security protection method is applied to the application runtime protection RASP module in the first server.

[0036] On the other hand, an embodiment of the present invention provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned large model security protection method.

[0037] On the other hand, an embodiment of the present invention provides a server, including a processor and a memory, which are interconnected, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the steps of the large model security protection method provided by the embodiment of the present invention.

[0038] On the other hand, an embodiment of the present invention provides a computer-readable storage medium, including: the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps of the large model security protection method provided in the embodiment of the present invention are implemented.

[0039] The first server of the embodiment of the present application obtains an access request to the large model, the access request includes a user identifier and / or a session identifier, determines whether the access request is compliant, and if the access request is compliant, saves the user identifier and / or the session identifier, and sends the access request to the large model. A response message from the large model is obtained, the response message includes a user identifier and / or a session identifier, and based on the user identifier and / or the session identifier in the response message, confirms whether the access request is a legitimate request. The embodiment of the present application implements large model attack source tracing analysis by establishing a large model runtime self-protection process, and can perform source tracing analysis on access requests through response messages, implement attack interception and reduce the difficulty of tracing, thereby enhancing the security protection capabilities of the large model. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a schematic diagram of the implementation process of a large model security protection method provided by an embodiment of the present invention;

[0041] Figure 2 is a schematic diagram of a large model safety protection system provided by an embodiment of the present invention;

[0042] Figure 3 It is a schematic diagram of a self-protection process of an application program during a large model runtime provided by an embodiment of the present invention;

[0043] Figure 4 It is a schematic diagram of a server provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0044] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0045] In order to illustrate the technical solution of the present invention, a specific embodiment is provided below for illustration.

[0046] Figure 1 It is a schematic diagram of the implementation process of a large model security protection method provided by an embodiment of the present invention. The execution subject of the large model security protection method is the first server, which can be specifically executed by the application runtime protection (RuntimeApplicationSelfProtect, RASP) module pre-deployed in the first server. The basic idea of ​​RASP is to inject protection code into the key functions of the application running to realize intrusion detection and protection in the running state of the application. Since RASP is embedded in the application, the attack process is inferred from the attack results, so its attack detection has a high degree of accuracy. It can prevent security threat behaviors, including network sniffing, code tampering, reverse engineering, and unauthenticated data leakage. Unlike Web application firewalls, RASP has higher accuracy because it can gain insight into application logic and configuration, events and data flows, executed instructions and data processing. It is also easy to deploy in pre-production and can successfully prevent attacks.

[0047] The first server can be the server where the large model is located. In order to detect the large model prompt attack or malicious questioning, the RASP protection code can be injected into the large model access basic function through the hook method. Taking Java as an example, it can be the constructor of HttpURLConnection, HttpClient, Okhttp (a lightweight network request library developed by Square), and RestTemplate (a class used to access RESTAPI in the Spring library). By injecting the detection code into the constructor, the data passed in the input and output interfaces of the large model can be obtained. If the interface access is passed by external request parameters, it can be judged that there is illegal access. Commonly used web access hook mechanisms are shown in Table 1 below.

[0048]

[0049] refer to Figure 1 , large model security protection methods include:

[0050] S101, obtaining an access request to a large model; the access request includes a user identifier and / or a session identifier.

[0051] For example, the access request to the large model needs to pass through the first server, and a RASP hook point is established in the first server, so that the access request message of the large model can be copied.

[0052] For example, the hook used to copy request data in Tomcat is implemented as follows:

[0053]

[0054]

[0055] In one embodiment, the access request message includes a user ID and a session ID, and may also include a certificate.

[0056] S102, determining whether the access request is compliant.

[0057] For example, the large model has attack recognition capabilities, and the attack recognition capabilities of the large model can be called to analyze whether the access request content is compliant. Alternatively, the first server presets detection rules to detect whether the access request is compliant.

[0058] In one embodiment, if the access request carries a certificate, the certificate may be verified, and if the certificate verification is correct, the access request may be considered compliant.

[0059] The above detection can be implemented through the RASP module in the first server.

[0060] S103: If the access request is compliant, save the user identifier and / or the session identifier, and send the access request to the large model.

[0061] For example, the user identifier and session identifier in the access request are saved through the hook mechanism, and the large model access request message is sent to the large model service through the first server.

[0062] If the content is non-compliant, access will be denied. If illegal content requests continue to occur within the time window, an alarm notification will be sent and the user's access rights will be disabled by the operation and maintenance personnel.

[0063] S104, obtaining a response message of the large model; the response message includes a user identifier and / or a session identifier.

[0064] The large model responds after receiving the access request. When the response message is returned by the large model service to the first server, for example, the response message can be intercepted by RASP, and the response message also includes a user identifier and / or a session identifier.

[0065] S105: confirm whether the access request is a legitimate request based on the user identifier and / or session identifier in the response message.

[0066] Here, we can also use the large model attack identification capability to analyze whether the response message contains non-compliant information. For example, we can query the user ID and / or session ID in the cached access request to determine whether it is consistent with the user ID and / or session ID in the response message. If they are consistent, the access request is determined to be a legitimate request. If they are inconsistent, it may be an illegal request to bypass the attack.

[0067] If it is a legitimate request, a response message is returned; if it is an illegal request, the response message is intercepted and an alarm notification is sent.

[0068] Compared with only performing attack analysis on access requests, the embodiment of the present application performs source tracing analysis on access requests through response messages, thereby achieving large-model attack source tracing analysis and having stronger security protection capabilities.

[0069] The embodiments of the present application can implement large model security protection based on RASP, combining conventional security threats (network sniffing, code tampering, reverse engineering, and unauthenticated data leakage) with large model security protection, thereby enhancing the large model security protection capability and improving the security tracing analysis capability.

[0070] The first server of the embodiment of the present application obtains an access request to the large model, the access request includes a user identifier and / or a session identifier, determines whether the access request is compliant, and if the access request is compliant, saves the user identifier and / or the session identifier, and sends the access request to the large model. A response message from the large model is obtained, the response message includes a user identifier and / or a session identifier, and based on the user identifier and / or the session identifier in the response message, confirms whether the access request is a legitimate request. The embodiment of the present application implements large model attack source tracing analysis by establishing a large model runtime self-protection process, and can perform source tracing analysis on access requests through response messages, implement attack interception and reduce the difficulty of tracing, thereby enhancing the security protection capabilities of the large model.

[0071] In one embodiment, the confirming whether the access request is a legitimate request based on the user identifier and / or session identifier in the response message includes:

[0072] Determining whether the user identifier and / or session identifier in the response message is consistent with the user identifier and / or session identifier in the access request stored in advance;

[0073] If they are consistent, it is determined that the access request is a legitimate request;

[0074] If they are inconsistent, it is determined that the access request is an illegal request.

[0075] Here, the user ID and / or session ID in the response message is compared with the user ID and / or session ID in the pre-saved access request. If they are consistent, it is considered a legitimate request. This is equivalent to testing the access request twice. Only when the response message is also tested and compliant, the access request is determined to be legitimate, and the security protection level is higher.

[0076] In one embodiment, obtaining an access request to the large model includes:

[0077] Acquire the access request sent by the second server, where the access request also includes a certificate, and the certificate is issued by the second server;

[0078] Correspondingly, determining whether the access request is compliant includes:

[0079] verifying the certificate;

[0080] If the certificate passes the verification, the attack identification capability of the large model is called to analyze whether the access request is compliant.

[0081] Here, the second server can be a 4A server, where 4A refers to: Authentication, Account, Authorization, and Audit. The 4A server can be used for identity authentication. The 4A server issues a certificate to each user. The user's access request to the large model needs to be sent to the 4A server for security verification. The access request needs to carry the certificate. The second server verifies it and sends the access request to the large model if the verification passes.

[0082] By obtaining the access request sent by the second server to the large model, the certificate therein is verified, and if the verification passes, the attack identification capability of the large model is called to analyze whether the access request is compliant. This step can be implemented through RASP.

[0083] In one embodiment, if it is determined that the access request is a legitimate request, the method further includes:

[0084] The response message is sent to the second server, wherein the response message includes a certificate.

[0085] The response message also includes a certificate. The second server verifies the certificate in the response message, and returns the response message to the user if the verification is correct.

[0086] In one embodiment, the user identifier and / or the session identifier in the access request is scrambled by the second server, and the storing of the user identifier and / or the session identifier includes:

[0087] Descramble the user ID and / or session ID in the access request;

[0088] The descrambled user identifier and / or the session identifier is saved.

[0089] In one embodiment, the access message includes scrambled data scrambled by an m-sequence, where the m-sequence is generated by a linear feedback shift register in the second server; and descrambling the user identifier and / or session identifier in the access request includes:

[0090] Calculate the cyclic shift autocorrelation of the scrambled data by using different m sequences to obtain the scrambled m sequence;

[0091] Descrambling is performed based on the scrambled m-sequence to obtain a user identifier and / or a session identifier.

[0092] Here, in order to further improve security, the second server will scramble the user identifier and session identifier, and the scrambling method includes but is not limited to using an m-sequence. The m-sequence is the abbreviation of the longest linear feedback shift register sequence, which is the longest period sequence generated by a shift register with linear feedback. The m-sequence is a typical pseudo-random sequence that can be used for scrambling. The scrambling method uses a total of n (the value of n will be determined according to the usage scenario) different linear feedback shift registers, and the second server, the first server and the large model all save the same n linear feedback shift registers. Random linear feedback shift registers are used to generate m-sequences of different lengths for different users. Scrambling is performed by randomly shifting m-sequences for different sessions of each user. The specific scrambling method includes but is not limited to: the m-sequence is a leading sequence, followed by an XOR operation of the m-sequence with the binary values ​​of the user identifier and the session identifier.

[0093] After obtaining the access request, if the compliance check is passed, the scrambled userID and sessionID are descrambled and saved. During the descrambling process, the scrambled data is scrambled by calculating the cyclic shift autocorrelation through different m sequences to obtain the scrambled m sequence, and then the userID and sessionID are descrambled. This step can be achieved through RASP.

[0094] In one embodiment, the user identifier and / or session identifier in the response message is scrambled by the large model, and the method further includes:

[0095] The user identifier and / or session identifier in the response message is descrambled.

[0096] In the above scheme, the response message includes scrambled data scrambled by an m-sequence, and the m-sequence is generated by a linear feedback shift register in a large model; the method further includes:

[0097] Calculate the cyclic shift autocorrelation of the scrambled data by using different m sequences to obtain the scrambled m sequence;

[0098] Descrambling is performed based on the scrambled m-sequence to obtain a user identifier and / or a session identifier.

[0099] Here, the large model scrambles the user identifier and / or session identifier in the response message, and the scrambling algorithm used by the large model also randomly selects an m sequence to scramble the user identifier and / or session identifier. After obtaining the response message, the corresponding descrambling algorithm is used to descramble the user identifier and / or session identifier in the response message. This step can be implemented by RASP.

[0100] In one embodiment, after confirming whether the access request is a legitimate request, the method further includes:

[0101] If it is determined that the access request is an illegal request, the response message is refused to be sent.

[0102] refer to Figure 2 , Figure 2 This is a schematic diagram of a large model security protection system provided by an embodiment of the present invention. User access messages and response messages are sent through 4A and a web server. A RASP hook point is established in the web server. RASP copies the large model access / response message, verifies whether the certificate used is legal, and calls the large model service capability to perform attack identification to verify whether the access or response content is compliant. If it is not in compliance with the rules, it is intercepted. The large model attack identification capability includes data poisoning and prompt attack identification, and the main contents include keyword identification, legal provisions violation identification, logical judgment identification, etc.

[0103] refer to Figure 3 , Figure 3 This is a schematic diagram of a self-protection process of a large model runtime application provided by an embodiment of the present invention. The main workflow includes:

[0104] 1. The user sends a large model access request to the 4A server. If the user is a legitimate user, the access request message contains userID, sessionID, Certificate (certificate issued by 4A) and other messages; if the user is an illegal user, 4A returns access denial. To further improve security, 4A will scramble the userID and sessionID, including but not limited to using m-sequence.

[0105] 2. The large model access request message is sent from the 4A server to RASP. RASP first identifies whether it is a legal request based on the certificate. If it is an illegal request, access is denied. If it is a legal request, each message content, including userID, sessionID and other content, is saved through the hook mechanism. If it is encrypted, the encrypted userID and sessionID are descrambled and saved. Then, the large model attack recognition capability is called through certificate encryption to analyze whether the content of the large model access request is compliant. If it is non-compliant content, access is denied. If illegal content requests continue to occur within the time window, an alarm notification is sent, and the operation and maintenance or operation personnel disable user access rights.

[0106] 3. The large model access request message is sent from RASP to the large model service through the webserver.

[0107] 4. When the large model access response message is returned to the webserver by the large model service, the response message is intercepted by RASP. RASP also uses the large model attack identification capability to analyze whether the message body contains non-compliant information. If it is compliant information, a successful response is returned. If there is non-compliant information, the access response message is saved and a rejection response message is returned.

[0108] Among them, the large model can also scramble the userID and sessionID in the response message. After RASP obtains the response message, it uses the corresponding descrambling algorithm to descramble the userID and sessionID.

[0109] RASP specific inspection process: According to the userID and sessionID in the response message, after descrambling, query the userID and sessionID list of the large model access request message cache. If there is a corresponding query request (that is, the same userID and sessionID), it is considered a legitimate request; if there is no corresponding query request (that is, there is no same userID and sessionID), it is considered to be an illegal request to steal user information by bypassing 4A authentication, intercept the request and send an alarm notification, and immediately replace the encryption certificate and scrambling algorithm. If the response message contains illegal information, if the request message corresponding to this userID and sessionID is further analyzed:

[0110] (1) If expert analysis finds illegal messages that are not detected by large model attacks, the large model attack recognition capability is optimized;

[0111] (2) If the request message is found to contain no illegal messages after expert analysis, then search for promt prompt data and search for content that is the same or similar to the search keyword to further verify whether there is the ability to prompt data attack. If there is a prompt data tool, optimize the large model prompt data attack recognition capability; if there is no prompt data attack, check whether there are hidden risks in the basic training data.

[0112] 5. The successful response message is returned by RASP to 4A. The 4A server verifies whether the certificate used in this message is legal. If it is an illegal certificate, a rejection response is returned to the user.

[0113] 6. The successful response message is returned to the user by 4A.

[0114] With the widespread application of big models in all walks of life, big model attack methods are also evolving rapidly. In addition to conventional keyword recognition data poisoning or malicious access, there are also new attack methods such as direct and indirect prompt attacks, and multi-round prompt attacks, that is, each round of prompts and instructions inject special information separately, and combine them together to form an attack. The use of RASP-based big model security protection methods can not only effectively identify the attack content, but also query the input request information through the response message containing non-compliant content, so as to conduct traceability analysis.

[0115] The embodiment of the present application realizes large model security protection based on RASP and large model attack identification capabilities, combines conventional security threats (network sniffing, code tampering, reverse engineering, and unauthenticated data leakage) with large model security protection, enhances large model security protection capabilities, and improves security traceability analysis capabilities. The embodiment of the present application can be used for large model security protection, improve the traceability analysis of unknown attack types of large models, has strong portability, and has good commercial value.

[0116] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0117] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0118] It should be noted that the technical solutions described in the embodiments of the present invention can be arbitrarily combined without conflict.

[0119] In addition, in the embodiments of the present invention, "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0120] An embodiment of the present invention provides a large model safety protection device, the device comprising:

[0121] A first acquisition module is used to acquire an access request to the large model; the access request includes a user identifier and / or a session identifier;

[0122] A first determination module, used to determine whether the access request is compliant;

[0123] A saving module, configured to save the user identifier and / or the session identifier if the access request is compliant, and send the access request to the large model;

[0124] A second acquisition module is used to acquire a response message of the large model; the response message includes a user identifier and / or a session identifier;

[0125] The second determination module is used to confirm whether the access request is a legal request based on the user identifier and / or session identifier in the response message.

[0126] In one embodiment, the second determining module is specifically configured to:

[0127] Determining whether the user identifier and / or session identifier in the response message is consistent with the user identifier and / or session identifier in the access request stored in advance;

[0128] If they are consistent, it is determined that the access request is a legitimate request;

[0129] If they are inconsistent, it is determined that the access request is an illegal request.

[0130] In one embodiment, the first acquisition module is specifically used for:

[0131] Acquire the access request sent by the second server, where the access request also includes a certificate, and the certificate is issued by the second server;

[0132] Correspondingly, determining whether the access request is compliant includes:

[0133] verifying the certificate;

[0134] If the certificate passes the verification, the attack identification capability of the large model is called to analyze whether the access request is compliant.

[0135] In one embodiment, the device further comprises:

[0136] A sending module is used to send the response message to the second server, where the response message includes a certificate.

[0137] In one embodiment, the user identifier and / or session identifier in the access request is scrambled by the second server, and the storage module is specifically used to:

[0138] Descramble the user ID and / or session ID in the access request;

[0139] The descrambled user identifier and / or the session identifier is saved.

[0140] In one embodiment, the access message includes scrambled data scrambled by an m-sequence, where the m-sequence is generated by a linear feedback shift register in the second server; and the storage module is specifically configured to:

[0141] Calculate the cyclic shift autocorrelation of the scrambled data by using different m sequences to obtain the scrambled m sequence;

[0142] Descrambling is performed based on the scrambled m-sequence to obtain a user identifier and / or a session identifier.

[0143] In one embodiment, the response message includes scrambled data scrambled by an m-sequence, where the m-sequence is generated by a linear feedback shift register in a large model; the apparatus further includes: a descrambling module, configured to:

[0144] Calculate the cyclic shift autocorrelation of the scrambled data by using different m sequences to obtain the scrambled m sequence;

[0145] Descrambling is performed based on the scrambled m-sequence to obtain a user identifier and / or a session identifier.

[0146] In one embodiment, the device further comprises:

[0147] The rejection module is used to reject sending the response message if it is determined that the access request is an illegal request.

[0148] In actual application, the first acquisition module, the first determination module, the second acquisition module, the storage module and the second determination module can be implemented by a processor in the server, such as a central processing unit (CPU), a digital signal processor (DSP), a microcontroller unit (MCU) or a programmable gate array (FPGA).

[0149] It should be noted that: the large model safety protection device provided in the above embodiment only uses the division of the above modules as an example when performing large model safety protection. In actual applications, the above processing can be assigned to different modules as needed, that is, the internal structure of the device is divided into different modules to complete all or part of the processing described above. In addition, the large model safety protection device provided in the above embodiment and the large model safety protection method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0150] The above-mentioned large model security protection device can be in the form of an image file. After the image file is executed, it can be run in the form of a container or a virtual machine to implement the large model security protection method described in this application. Of course, it is not limited to the image file form. As long as some software forms that can implement the large model security protection method described in this application are within the protection scope of this application.

[0151] Based on the hardware implementation of the above program module, and in order to implement the method of the embodiment of the present application, the embodiment of the present application further provides a server, and the above large model security protection method is implemented by a processor of the server. For example, it can be a first server, and the large model and RASP are both deployed in the first server.

[0152] Figure 4 Schematic diagram of the hardware structure of the server in the embodiment of the present application. Figure 4 As shown, the server includes:

[0153] Communication interface 401, capable of exchanging information with other devices such as network devices;

[0154] The processor 402 is connected to the communication interface 401 to implement information exchange with other devices and is used to execute the method provided by one or more technical solutions on the server side when running the computer program. The computer program is stored in the memory 403.

[0155] Of course, in actual application, the various components in the server are coupled together through the bus system 404. It can be understood that the bus system 404 is used to realize the connection and communication between these components. In addition to the data bus, the bus system also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 4 Various buses are labeled as bus system 404 .

[0156] The memory 403 in the embodiment of the present application is used to store various types of data to support the operation of the server. Examples of such data include: any computer program used to operate on the server.

[0157] In this application, a server can be a single hardware device or a cluster of multiple hardware devices, such as a cloud computing platform. The so-called cloud computing platform is a cluster device that organizes multiple independent server physical hardware resources into pooled resources, which provides the required virtual resources and services to the outside world.

[0158] The memory 403 in the embodiment of the present application is used to store various types of data to support the operation of the server. Examples of such data include: any computer program used to operate on the server.

[0159] It can be understood that the memory 403 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM, Static Random Access Memory), synchronous static random access memory (SSRAM, Synchronous Static Random Access Memory), dynamic random access memory (DRAM, Dynamic Random Access Memory), synchronous dynamic random access memory (SDRAM, Synchronous Dynamic Random Access Memory), double data rate synchronous dynamic random access memory (DDR SDRAM, Double Data Rate Synchronous Dynamic Random Access Memory), enhanced synchronous dynamic random access memory (ESDRAM, Enhanced Synchronous Dynamic Random Access Memory), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), direct memory bus random access memory (DRRAM, Direct Rambus Random Access Memory). The memory described in the embodiments of the present application is intended to include but is not limited to these and any other suitable types of memory.

[0160] The method disclosed in the above embodiment of the present application can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor may be a general-purpose processor, a DSP, or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in a memory, and the processor reads the program in the memory and completes the steps of the above method in combination with its hardware.

[0161] In an exemplary embodiment, the embodiment of the present application also provides a computer program product, including a computer program, which can be executed by the processor 402 of the server to complete the steps described in the large model security protection method of the embodiment of the present application.

[0162] Optionally, when the processor executes the program, it implements the corresponding processes implemented by the server in each method of the embodiments of the present application, which will not be described here for the sake of brevity.

[0163] In an exemplary embodiment, the present application also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, for example, including a first memory storing a computer program, and the computer program can be executed by a processor of a server to complete the steps of the aforementioned method. The computer-readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, FlashMemory, magnetic surface storage, optical disk, or CD-ROM.

[0164] In the several embodiments provided in the present application, it should be understood that the disclosed devices, servers and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0165] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0166] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0167] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium, which, when executed, executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, disks or optical disks.

[0168] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the relevant technology. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.

[0169] It should be noted that the technical solutions described in the embodiments of the present application can be combined arbitrarily without conflict.

[0170] In addition, in the examples of the present application, "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0171] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A large model security protection method, applied to a first server, characterized in that: The method comprises: Obtaining an access request to the large model; the access request includes a user identifier and / or a session identifier; Determining whether the access request is compliant; If the access request complies with the regulations, saving the user identifier and / or the session identifier, and sending the access request to the large model; Obtaining a response message of the large model; the response message includes a user identifier and / or a session identifier; Based on the user identifier and / or session identifier in the response message, it is confirmed whether the access request is a legitimate request.

2. The method according to claim 1, characterized in that The confirming whether the access request is a legitimate request based on the user identifier and / or session identifier in the response message includes: Determining whether the user identifier and / or session identifier in the response message is consistent with the user identifier and / or session identifier in the access request stored in advance; If they are consistent, it is determined that the access request is a legitimate request; If they are inconsistent, it is determined that the access request is an illegal request.

3. The method according to claim 1, characterized in that The obtaining of the access request to the large model includes: Acquire the access request sent by the second server, where the access request also includes a certificate, and the certificate is issued by the second server; Correspondingly, determining whether the access request is compliant includes: verifying the certificate; If the certificate passes the verification, the attack identification capability of the large model is called to analyze whether the access request is compliant.

4. The method according to claim 3, characterized in that If it is determined that the access request is a legitimate request, the method further includes: The response message is sent to the second server, wherein the response message includes a certificate.

5. The method according to claim 3, characterized in that: The user identifier and / or the session identifier in the access request is scrambled by the second server, and the storing of the user identifier and / or the session identifier includes: Descramble the user ID and / or session ID in the access request; The descrambled user identifier and / or the session identifier is saved.

6. The method according to claim 5, characterized in that The access message includes scrambled data scrambled by an m-sequence, where the m-sequence is generated by a linear feedback shift register in the second server; and the descrambling of the user identifier and / or session identifier in the access request includes: Calculate the cyclic shift autocorrelation of the scrambled data by using different m sequences to obtain the scrambled m sequence; Descrambling is performed based on the scrambled m-sequence to obtain a user identifier and / or a session identifier.

7. The method according to claim 1, characterized in that The response message includes scrambled data scrambled by an m-sequence, wherein the m-sequence is generated by a linear feedback shift register in a large model; and the method further includes: Calculate the cyclic shift autocorrelation of the scrambled data by using different m sequences to obtain the scrambled m sequence; Descrambling is performed based on the scrambled m-sequence to obtain a user identifier and / or a session identifier.

8. The method according to claim 1, characterized in that After confirming whether the access request is a legitimate request, the method further includes: If it is determined that the access request is an illegal request, the response message is refused to be sent.

9. The method according to claim 1, characterized in that: The large model security protection method is applied to the application runtime protection RASP module in the first server.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the large model security protection method described in any one of claims 1 to 9 are implemented.

11. A server comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the large model security protection method as described in claims 1 to 9 are implemented.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which includes program instructions. When the program instructions are executed by a processor, the processor executes the steps of the large model safety protection method according to claims 1 to 9.

Citation Information

Cited By

  • Security authentication method and device, electronic equipment, medium and program product

    CN119720172A

  • Network security access method and device for large model task, equipment and medium

    CN120342698A

  • A network security access method and device for a large model task, an apparatus, and a medium

    CN120342698B

  • Large language model content security filtering system and method thereof

    CN122594601A

  • Large model security protection method and system

    CN122615836A