Method and device for extracting sensitive information in application package, electronic equipment and medium
By identifying and parsing sensitive information in application packages, the problem of inefficient identification and extraction in the prior art is solved, and efficient and accurate extraction of sensitive information is achieved, simplifying the process and improving the ability to combat crime.
Patent Information
- Application Number
- CN202410915441.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-09
- Publication Date
- 2024-11-01
AI Technical Summary
The prior art is difficult to effectively identify and extract sensitive information in application packages, resulting in inefficient cybercrime investigation, difficult for non-professional personnel to deal with quickly, and there are misjudgment and misjudgment.
By identifying multiple types of files in the target application package, reading the package name and label in the manifest file, determining the range of strings to be analyzed, and parsing the analyzed strings to determine whether they are sensitive information, including format verification and encryption and decryption processing to extract sensitive information.
Improve the recognition speed and accuracy of sensitive information in application packages, simplify the extraction process, reduce technical and experience requirements, and enable non-professional personnel to quickly and effectively perform sensitive information extraction tasks, and improve the efficiency and accuracy of combating crime. sex.
Smart Images

Figure CN118886008A_ABST
Abstract
Description
Technical Field
[0001] The present invention discloses the technical field of information network security, and in particular, relates to a method, device, electronic device and medium for extracting sensitive information from an application package. Background Art
[0002] In today's society, the widespread popularity of mobile devices and the booming development of applications have greatly facilitated people's daily lives, but have also brought about the breeding of new types of criminal activities. These criminal activities are no longer limited to traditional offline models, but take advantage of loopholes in applications and the leakage of user information to carry out a series of high-tech illegal activities, including but not limited to online fraud, information theft, phishing, etc. Due to the particularity of this type of crime, they often involve complex technical means and encryption methods, which greatly increases the difficulty of solving the case.
[0003] At present, the investigation of such crimes faces major challenges. On the one hand, criminal activities are highly concealed, and criminals usually have a certain technical background. They use anonymous networks, encrypted communications and other means to hide their identities and locations, making tracking and evidence collection extremely difficult. On the other hand, criminal programs are often designed with self-destruction mechanisms or become inaccessible after a short period of time, resulting in the rapid loss of key evidence. For grassroots police officers, they usually lack the necessary professional technical training and experience accumulation. Faced with complex and changeable forms of cybercrime, it is difficult to effectively identify, analyze and process relevant sensitive information in a short period of time. As a result, a large number of cases have been backlogged and concentrated in the hands of a few professionals, which has increased their workload and reduced the overall efficiency of case handling. Summary of the invention
[0004] In view of the shortcomings of the prior art mentioned above, the purpose of the present disclosure is to provide a method, device, electronic device and medium for extracting sensitive information from an application package, aiming to improve the recognition speed and accuracy of sensitive information in the application package and help analysts save time and energy.
[0005] A first aspect of the present disclosure provides a method for extracting sensitive information from an application package, comprising: identifying multiple types of files in a target application package, including an application code file and a manifest file; reading an application package name and an application tag from the manifest file; determining a range of a string to be analyzed in the application code file based on the application package name and the application tag; and parsing the determined string to be analyzed to identify and extract sensitive information therein.
[0006] In an embodiment of the first aspect, the sensitive information includes one or more combinations of API keys, IP addresses, URL links, email addresses, user credentials, encrypted data, system commands, and hash values.
[0007] In an embodiment of the first aspect, the parsing of the determined string to be analyzed to identify and extract sensitive information therein includes: reading the class name of the string to be analyzed; judging whether the string to be analyzed is a suspicious string based on the class name; if so, parsing the specific instructions defining the suspicious string in the application code file to determine the purpose of the suspicious string; judging whether the suspicious string is a sensitive string based on the purpose of the suspicious string; and if so, extracting sensitive information from the sensitive string.
[0008] In an embodiment of the first aspect, judging whether the suspicious string is a sensitive string according to the purpose of the suspicious string includes: performing a format check on the suspicious string and a predefined sensitive information type; and determining whether the suspicious string is a sensitive string based on the check result.
[0009] In an embodiment of the first aspect, determining whether the suspicious string is a sensitive string based on the verification result includes: if the format verification passes, determining that the suspicious string is a sensitive string; and recording the content of the sensitive string and the corresponding sensitive information type.
[0010] In an embodiment of the first aspect, determining whether the suspicious string is a sensitive string based on the verification result includes: if the format check fails, determining whether the suspicious string is encrypted; if so, decrypting the suspicious string and performing a format check again; if the decrypted format check passes, determining that the suspicious string is a sensitive string, and recording the content of the sensitive string, the encryption algorithm used, and the type of sensitive information.
[0011] In an embodiment of the first aspect, the extracting the sensitive information from the sensitive string includes: determining a variable name to which the sensitive string is assigned; and extracting the sensitive information from the sensitive string based on the variable name.
[0012] In an embodiment of the first aspect, the extracting the sensitive information in the sensitive string based on the variable name includes: performing word segmentation processing on the variable name; and extracting the sensitive information in the sensitive string based on the variable name after the word segmentation processing.
[0013] The second aspect of the present disclosure discloses a device for extracting sensitive information from an application package, comprising: an identification module for identifying multiple types of files in a target application package, including application code files and manifest files; a reading module for reading the package name and application label of the application from the manifest file; a range determination module for determining the range of a string to be analyzed in the application code file based on the application package name and the application label; and an extraction module for parsing the determined string to be analyzed to identify and extract the sensitive information therein.
[0014] The third aspect of the present disclosure discloses an electronic device, comprising: a processor and a memory; wherein the memory is used to store a computer program; the processor is used to execute the computer program stored in the memory, so that the electronic device executes the method for extracting sensitive information in an application package as described in any one of the first aspects.
[0015] A fourth aspect of the present disclosure discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by an electronic device, implements the method for extracting sensitive information from an application package as described in any one of the first aspects.
[0016] As described above, the present disclosure provides a method, device, electronic device, and medium for extracting sensitive information from an application package, which at least include the following technical effects:
[0017] (1) It can efficiently extract key sensitive information from application packages, such as API keys, IP addresses, URL links, etc., greatly improving the efficiency and response speed of analysis.
[0018] (2) By comprehensively analyzing the various file types and features in the application package, it can provide accurate sensitive information extraction results and reduce misjudgments and missed judgments.
[0019] (3) It simplifies the process of sensitive information extraction and reduces the technical and experience requirements of staff, allowing non-professionals to quickly get started and effectively perform sensitive information extraction tasks.
[0020] (4) It can quickly identify applications containing sensitive information, helping analysts to quickly identify and combat criminal activities using mobile applications, thereby improving the efficiency and accuracy of combating crime. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A flowchart of a method for extracting sensitive information from an application package in an embodiment of the present disclosure is shown.
[0022] Figure 2A schematic diagram showing the process of parsing a string and extracting sensitive information in an embodiment of the present disclosure.
[0023] Figure 3 A schematic diagram of a process for determining a sensitive string in an embodiment of the present disclosure is shown.
[0024] Figure 4 A schematic diagram of a process for determining a sensitive string in another embodiment of the present disclosure is shown.
[0025] Figure 5 A flowchart showing a method for extracting sensitive information from an application package in another embodiment of the present disclosure is shown.
[0026] Figure 6 A schematic diagram showing a specific example of the present disclosure.
[0027] Figure 7 A schematic diagram of a device module for extracting sensitive information from an application package in an embodiment of the present disclosure is shown.
[0028] Figure 8 A schematic diagram of the circuit structure of an electronic device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0029] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0030] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0031] With the booming development of mobile Internet, mobile applications have become an important part of our daily life, but they also bring new security challenges. Criminals are increasingly using these applications to carry out illegal activities, such as online fraud, data theft, etc., which seriously threaten user privacy and property safety. In the existing technical system, security defense measures mainly focus on using data in smart terminals for post-analysis. When suspicious behavior occurs, security personnel collect and analyze data in smart terminals to identify and track suspects. However, this reactive strategy has significant defects: it can only take action after the crime occurs, resulting in delayed response and criminal consequences. In addition, the collection and fixation of criminal evidence becomes more difficult, consumes a lot of resources, and is less efficient. More importantly, existing methods may infringe on user privacy and are difficult to deal with criminals using high-tech means.
[0032] The purpose of this disclosure is to nip crime in the bud, that is, to proactively identify and combat applications used for crime by real-time monitoring and analysis of sensitive information in mobile applications. This method can reduce the occurrence of criminal cases and improve the overall safety of society. Compared with the existing technology, the preventive measures of this disclosure can achieve early detection and rapid intervention, effectively making up for the shortcomings of post-processing.
[0033] The technical solutions in the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0034] like Figure 1 As shown, a flow chart of a method for extracting sensitive information from an application package in an embodiment of the first aspect of the present disclosure is shown, including steps S10-S40, wherein:
[0035] Step S10: Identify multiple types of files in the target application package, including application code files and manifest files.
[0036] Specifically, before extracting sensitive information from an application package (APK file), you first need to decompress the APK file in order to access the files therein. The decompression process can be accomplished through Java's ZipInputStream class, which is capable of reading an APK file and decompressing its contents into a temporary directory. In the decompressed directory, you can traverse all files and check their extensions or file headers to determine whether they are files of a specific type. For example, you can identify different types of files by checking file extensions (such as .dex, .html, .js, .json, etc.) or file headers (such as a specific magic number).
[0037] For application code files, i.e. files containing executable code, such as DEX files (bytecode for Android applications), a code recovery operation is required. Code recovery is the process of converting compiled code back to source code. This usually involves the use of decompilation tools, such as dex2jar and jd-gui, which can convert DEX files into JAR files, which are then converted into Java source code using a decompiler. By restoring the source code, you can get a clearer understanding of the logic and functionality of the application, making it easier to identify and extract sensitive information.
[0038] For files containing scripts, such as HTML, JavaScript, and JSON files, you can directly view their contents to determine their structure and functionality. These files may contain information such as the application's user interface elements, interaction logic, and data exchange formats. By analyzing these files, you can understand the application's interaction methods and data processing flow, thereby identifying and extracting sensitive information related to user data.
[0039] In addition to code and script files, APK files may also contain other types of resource files, such as images, audio, video, etc. These resource files are usually located in the res directory, and their location and purpose can be determined by analyzing the manifest file (AndroidManifest.xml). The manifest file is one of the most important files in the APK file, which contains the basic information and permission declaration of the application. By parsing the manifest file, you can get information such as the name, version number, and required permissions of the application. In addition, you can also extract the main components of the application (such as activities, services, broadcast receivers, etc.) and their configuration information. This information helps to understand the overall structure and functionality of the application, so as to better identify and extract sensitive information.
[0040] In some embodiments, the sensitive information includes one or more combinations of API keys, IP addresses, URL links, email addresses, user credentials, encrypted data, system commands, and hash values.
[0041] Specifically, in an application package, sensitive information refers to information that may be used by malicious attackers to obtain improper benefits or undermine system security. The following are some common types of sensitive information and their detailed descriptions:
[0042] API keys: API keys are credentials used to access specific services, usually provided by the service provider. They can be used to access cloud services, third-party libraries, databases, etc. Disclosure of API keys may lead to unauthorized data access, misuse of service resources, or malicious operations. In the application package, API keys may be stored in plain text or encrypted form, which requires careful analysis to determine their security and potential risks.
[0043] IP address: An IP address is an identifier assigned to a network device for communication on the network. If the application package contains an IP address, it may expose the location of the server and the network topology, thereby increasing the risk of being attacked. The disclosure of IP addresses may lead to network attacks, data leaks or other security issues.
[0044] URL links: URL links point to resources on the Internet, such as web pages, files, or API endpoints. If the application package contains URL links, attackers can use these links to access sensitive data or perform malicious operations. The leakage of URL links may lead to data leakage, malware distribution, or other security issues.
[0045] Email address: Email address is one of the user's personal contact information, usually used to receive notifications, verify identity, etc. Disclosure of email address may lead to spam, phishing attacks or other forms of fraud. Disclosure of email address may lead to privacy leakage, account hijacking or other security issues.
[0046] User credentials: User credentials include usernames, passwords, tokens, session IDs, etc., which are used to authenticate users and authorize access to specific resources. Disclosure of user credentials may lead to unauthorized access, account hijacking, or other security issues. In the application package, user credentials may be stored in plain text or encrypted form, which requires careful analysis to determine their security and potential risks.
[0047] Encrypted data: Encrypted data refers to data protected using an encryption algorithm. If the application package contains the key or decryption logic for the encrypted data, an attacker may be able to decrypt the data and access the information in it. The leakage of encrypted data may lead to data leakage, information leakage, or other security issues.
[0048] System commands: System commands are a set of functions provided by the operating system to perform specific tasks. If the application package contains system commands, attackers may be able to use these commands to perform malicious operations, such as deleting files, modifying system settings, etc. The leakage of system commands may lead to system damage, data loss or other security issues.
[0049] Hash value: Hash value is a process of converting data of arbitrary length into a fixed-length unique identifier through a specific algorithm. This process is irreversible, that is, the original data cannot be directly restored from the hash value. However, if the application package contains hash values, and these hash values are generated based on sensitive information (such as passwords, keys, etc.), attackers may try to crack these hash values through various means to restore the original data. Hash values are commonly used in applications to store user passwords, API keys, sensitive configuration information, etc. to prevent direct exposure of these sensitive data. However, if the hash value is obtained by an attacker, they may use methods such as hash collision attacks, rainbow table attacks, or brute force attacks to try to crack the hash value and obtain the original sensitive information.
[0050] Step S20: Read the package name and application tag of the application from the manifest file.
[0051] Specifically, the manifest file (AndroidManifest.xml) is the core configuration file of the Android application, which contains the metadata, permission declaration, component definition, and behavior rules of the application. When parsing the manifest file, you can use Java's XML parser to read the nodes and attributes in the XML file and convert them into an operable data structure.
[0052] To parse XML files, you can use the XML parsers provided by Java, such as SAX (Simple API for XML), DOM (Document Object Model), or StAX (Streaming API for XML). These parsers can read the nodes and attributes in XML files and convert them into Java objects or data structures for further operation and analysis.
[0053] When parsing the manifest file, you need to look for specific nodes and attributes to extract the application's package name and application label. The application package name is a unique identifier for the application and is usually specified by the developer when creating the application. For example, a typical Android application package name might be "com.example.myapp". The application package name is usually located in the package attribute of the node. For example, in the node, the package name is defined as "package="com.example.myapp"". The application label is usually used to describe the function or purpose of the application and is located in the android:label attribute of the node. For example, an email application might have a label such as "Email", while a social media application might have a label such as "Social Networking".
[0054] Use an XML parser to parse the manifest file and locate the node and node, extract the application's package name from the package attribute of the node, and extract the application's label from the android:label attribute of the node.
[0055] Based on the extracted application package name and application tags, you can determine the scope of the strings to be analyzed. For example, if the application tag indicates that it is a social application, you can focus more on the code parts related to social functions.
[0056] Combined with other analysis techniques, such as code restoration, script parsing, etc., to fully analyze sensitive information in the application. For example, you can use a decompilation tool to convert the DEX file into a JAR file, and then use a decompiler to convert it into Java source code to more clearly understand the logic and functions of the application.
[0057] Step S30: Determine the range of the character string to be analyzed in the application code file according to the application package name and the application tag.
[0058] Specifically, when extracting sensitive information from an application package, using the file system search function is a key step. The purpose of this step is to find all files related to a given application package name, which may include source code files, resource files, etc. This step can be implemented using command line tools (such as the find command) or file operation functions in programming languages.
[0059] Using the file system search function, you can find all files related to a given application package name. These files may include application source code, configuration files, resource files, etc. The file system search function can be implemented through command line tools (such as the find command) or file operation functions in programming languages.
[0060] After finding relevant files, you can further filter out the files that need to be analyzed based on the application tag. For example, if the application tag is "Email", you can select files containing the "email" keyword for further analysis. The filtering process can be implemented through text search algorithms or regular expressions to improve the accuracy and efficiency of the search.
[0061] In the filtered files, find specific string ranges, which may include variable names, method names, comments, etc. Determine the specific string types that need to be focused on based on the application label. For example, if the application label is "Email", you may need to focus on strings related to emails, such as email addresses, subjects, etc.
[0062] Perform in-depth analysis on the found string ranges to identify and extract sensitive information. For example, you can check whether the variable name contains sensitive keywords, such as "password", "apiKey", etc. You can also check whether the method name and comments contain sensitive information, such as "getEmail", "sendEmail", etc.
[0063] In the above implementation, by reading the application manifest file, classes and resources that may be related to sensitive information are quickly identified. This step utilizes the structural information of the application, avoids checking the entire application package one by one, and greatly improves the speed of initial screening.
[0064] Step S40: Parse the determined character string to be analyzed to identify and extract sensitive information therein.
[0065] Specifically, after determining the string range, the system will conduct an in-depth analysis of the strings within these ranges. The system will parse the strings in the application code files, including their assignments and usage. By analyzing the assignments and usage of the strings, it can be determined whether they contain sensitive information, such as API keys, user credentials, etc. For example, if a string is assigned to a variable named "apiKey" and the variable is used during the login process of the application, then the string is likely to be an API key.
[0066] By deeply analyzing the assignment and usage of strings, the system can more accurately identify and extract sensitive information. For example, if a string is used in a URL for a network request or as a file name, these usages can further confirm its sensitivity. By deeply analyzing the assignment and usage of strings, the system can improve the accuracy of identifying and extracting sensitive information. For example, by analyzing the assignment and usage of strings, the system can more accurately identify and extract sensitive information such as API keys and user credentials.
[0067] In some embodiments, Figure 2 As shown, the step S40 includes steps S41-S45, wherein:
[0068] Step S41: Read the class name of the character string to be analyzed.
[0069] Specifically, in the application code file, each string is usually associated with a specific class. Therefore, it is first necessary to read the class name to which the string to be analyzed belongs. This can be achieved by parsing the structure of the code file, such as using the reflection mechanism or parser library in the programming language to obtain the class name to which the string belongs.
[0070] In order to determine the class name to which the string belongs, the system needs to parse the structure of the code file. Code files are usually generated by a compiler or interpreter of a programming language and contain elements such as classes, methods, and variables. The system can use the reflection mechanism or parser library provided by the programming language to parse the structure of the code file.
[0071] Reflection is a mechanism provided by a programming language that allows a program to inspect and modify its own structure at runtime. A parser library is a set of functions or classes used to parse a specific type of file or data format. By using the reflection mechanism or parser library, the system can obtain the class name of the string.
[0072] After parsing the structure of the code file, the system can read the class name of the string to be analyzed. For example, if the string to be analyzed appears in a method of a class named "MyClass", the system can read the class name "MyClass" to which the string belongs.
[0073] Step S42: determining whether the character string to be analyzed is a suspicious character string based on the class name.
[0074] Specifically, a series of predefined patterns or rules can be used to check the class name to determine whether it contains potentially sensitive information. These patterns or rules can include specific keywords, regular expressions, or other matching logic. For example, a list containing sensitive words, such as "password", "secret", etc. can be created. Then, the class name to be analyzed is compared with each keyword in this list. If any sensitive words are contained in the class name, it can be marked as a suspicious string.
[0075] Another approach is to use regular expressions to define more complex patterns. For example, you can write a regular expression to find strings that contain a combination of numbers and letters, which may indicate the presence of a password or key. By applying these patterns, you can more accurately identify suspicious strings.
[0076] In addition, other factors can be considered to determine whether a class name is suspicious. For example, the length, character distribution, or other characteristics of the class name can be checked to further confirm whether it contains potentially sensitive information.
[0077] Once it is determined that the class name is suspicious, step S43 may be performed.
[0078] Step S43: parsing the specific instructions defining the suspicious string in the application code file to determine the purpose of the suspicious string.
[0079] Specifically, you can use the parser library of the programming language to analyze the code file and extract relevant information. By analyzing these instructions, you can understand the purpose and context of the suspicious string in the application.
[0080] First, you need to choose a parser library that is suitable for the target programming language. These libraries usually provide the functions of syntax analysis and lexical analysis of source code, so that different elements in the code can be accurately identified and processed. For example, for the Java language, you can use libraries such as ANTLR or JavaParser; for the Python language, you can use Python's own ast module.
[0081] Once the appropriate parser library is selected, it can be applied to the code file in order to parse it. The parsing process will generate an abstract syntax tree (AST) that contains all the elements in the code file and their relationships. By traversing the AST, each node can be visited and information about the suspicious string can be extracted.
[0082] When traversing the AST, you need to focus on instructions related to suspicious strings. This may include variable declarations, assignment statements, function calls, etc. You can check whether these instructions directly reference the suspicious string or whether the suspicious string is used in context. In addition, other factors need to be considered, such as whether the suspicious string is passed to the function as a parameter, whether it is associated with other sensitive information, etc.
[0083] By analyzing these instructions, we can understand the purpose and context of the suspicious string in the application. For example, if the suspicious string appears in a password verification function, we can infer that it may be a variable used to store or verify the user's password. If the suspicious string is used as part of an API key, we can infer that it may be a credential used to access an external service.
[0084] It should be noted that parsing code files may involve complex grammatical structures and nested structures, so certain programming knowledge and experience may be required to correctly parse and understand the code. In addition, different programming languages may have different grammatical rules and characteristics, so in practical applications, it is necessary to select a suitable parser library according to the specific programming language.
[0085] Step S44: Determine whether the suspicious string is a sensitive string based on the purpose of the suspicious string. If yes, proceed to step S45.
[0086] Specifically, whether the suspicious string is a sensitive string is determined based on the purpose of the suspicious string. Specifically, the purpose of the suspicious string can be compared with known sensitive information patterns or rules.
[0087] First, you need to define a set of patterns or rules for sensitive information. These patterns can include specific keywords, regular expressions, or other matching logic to identify strings that may contain sensitive information. For example, you can create a list that contains sensitive words such as "password", "secret", "api_key", etc. Then, compare the purpose of suspicious strings to these patterns.
[0088] If the purpose of the suspicious string matches any sensitive information pattern, it can be marked as a sensitive string. This can be achieved by setting a Boolean variable or using other identifiers. Once it is determined that the suspicious string is sensitive, step S45 can be performed, that is, taking appropriate measures to handle the string.
[0089] It is important to note that the definition of sensitive information may vary depending on the application and context. Therefore, in actual implementation, these patterns and methods may need to be further optimized and adjusted to ensure optimal detection and security.
[0090] For example, Figure 3 As shown, the step S44 includes steps S441-S442, wherein:
[0091] Step S441: Perform format verification on the suspicious character string and predefined sensitive information types.
[0092] Specifically, we need to define a set of format rules for sensitive information types. These rules can include format patterns for common sensitive information such as email addresses, phone numbers, and credit card numbers. For example, for email addresses, we can use regular expressions to match common email formats; for phone numbers, we can use regular expressions to match the formats of international or local phone numbers.
[0093] The suspicious string is then compared to these formatting rules. If the suspicious string matches the format of any of the sensitive information types, it can be marked as a sensitive string. This can be done by setting a Boolean variable or using other identifiers.
[0094] Step S442: Determine whether the suspicious character string is a sensitive character string based on the verification result.
[0095] Specifically, if the suspicious string passes the format verification, that is, meets the format requirements of the predefined sensitive information type, then it can be marked as a sensitive string. Otherwise, it can be regarded as a non-sensitive string.
[0096] For example, if a regular expression is used in step S441 to match the format of an email address, and the suspicious string passes this check, then the string can be marked as a sensitive string. Similarly, if other text matching techniques are used to check the format of telephone numbers or credit card numbers, etc., and the suspicious strings meet these format requirements, they can also be marked as sensitive strings.
[0097] It should be noted that even if a suspicious string passes the format check, further analysis is still required to determine whether it actually contains sensitive information. For example, although a string may conform to the format of an email address, it may just be a common public email address, not an actual user email address. Therefore, after format verification, the content and context of the suspicious string need to be further analyzed to determine whether it actually contains sensitive information.
[0098] Further, such as Figure 4 As shown, step S442 includes steps a)-d), wherein:
[0099] Step a): determine whether the format check passes, if yes, proceed to step b); if no, proceed to step c).
[0100] Specifically, when performing format verification, it is based on the matching result between the structural features of the character string and the predetermined pattern, wherein the predetermined pattern includes but is not limited to regular expressions, length requirements, character combination rules, etc.
[0101] Step b): Determine that the suspicious character string is a sensitive character string, and record the content of the sensitive character string and the corresponding sensitive information type.
[0102] Specifically, if the suspicious string meets the format requirements of predefined sensitive information types (such as credit card numbers, social security numbers, etc.), the string is explicitly determined to be a sensitive string. Once a string is determined to be a sensitive string, its content and the sensitive information type it corresponds to should be recorded. This step can be achieved by storing sensitive strings and their types in a secure data management system. The recorded information should include the value of the sensitive string, the type of sensitive information detected (such as "credit card number", "social security number", etc.), the detection time, the name and location of the relevant code file, etc. This information will be used for subsequent security audits, reports or remedial measures to ensure that the use, storage and transmission of all sensitive information comply with relevant privacy regulations and security standards.
[0103] In the above implementation, the potential sensitive information is analyzed in a targeted manner according to predefined rules and patterns, such as specific keywords or formats. This method reduces the interference of irrelevant data and improves the targeting and efficiency of the analysis.
[0104] Step c): Determine whether the suspicious character string is encrypted.
[0105] Specifically, for suspicious strings that fail format verification, it is necessary to further determine whether they are encrypted. This can be determined by checking whether the string conforms to a known encryption format (such as specific character distribution, encryption identifier, etc.) or by analyzing the code context (such as whether there is an encryption / decryption function call). If so, execute step d).
[0106] Step d): decrypt the suspicious character string and return to step a) for format verification.
[0107] Specifically, if it is determined that the suspicious string is encrypted, it needs to be decrypted to obtain the original data. This usually involves using the same decryption algorithm used in the application, which can be a symmetric encryption algorithm, an asymmetric encryption algorithm, or any other appropriate encryption method. The decryption process should be performed in a secure environment to ensure that sensitive data is not leaked. After decryption, the format should be checked again to determine whether it is a sensitive string.
[0108] If the decrypted format verification passes, return to step b).
[0109] Specifically, if the decrypted string passes the format check, it should be judged as a sensitive string. At the same time, its content, the encryption algorithm used, and the corresponding sensitive information type should be recorded.
[0110] In the above implementation, for the encrypted sensitive information, the present application provides the steps of decryption and re-verification, thereby ensuring that even the encrypted sensitive information can be accurately extracted and identified.
[0111] Step S45: extracting sensitive information from the sensitive character string.
[0112] Specifically, after determining that a string is a sensitive string, the next step is to extract the sensitive information from it. This may involve parsing specific sensitive data from the string, such as credit card numbers, passwords, etc. The extraction process should ensure compliance with appropriate data protection and privacy standards.
[0113] In some implementations, the step S45 includes: determining a variable name to which the sensitive string is assigned; and extracting sensitive information from the sensitive string based on the variable name.
[0114] Specifically, during the code review process, you first need to determine which variable the sensitive string is assigned to. This usually involves analyzing the code to identify which variables accept the value of the sensitive string. The names of these variables may provide direct clues about the purpose of sensitive data, helping to more accurately identify and classify sensitive information. Using the determined variable names, you can more accurately extract the sensitive information associated with the variable from the code. For example, if a variable is named userPassword, it is obvious that it stores user password information, so any string assigned to this variable should be considered sensitive information.
[0115] To further refine the sensitive information extraction process, you can perform tokenization on the variable names. This means breaking down the variable names into smaller semantic units, which helps to better understand the purpose of the variable. For example, the variable name userCredentials can be tokenized into user and Credentials, which more clearly indicates that the variable is used to store the user's credential information.
[0116] Using the variable names after word segmentation can further improve the accuracy of extracting sensitive information from the code. By analyzing the semantic units after word segmentation, the purpose of the variable can be more accurately determined, and relevant sensitive information can be extracted accordingly. This helps reduce false positives and false negatives, and ensures the efficiency and accuracy of the sensitive information management system.
[0117] Based on the contents of all the above embodiments, Figure 5 As shown, a complete flowchart of a method for extracting sensitive information from an application package in an embodiment of the present disclosure is presented.
[0118] In order to better illustrate the method for extracting sensitive information from an application package introduced in the present disclosure, a specific example is given below. Figure 6 The schematic diagram of this example is shown in Figure 1.
[0119] In this example, suppose a grassroots police officer receives a case involving suspected criminal activities using mobile applications. The criminal created an application called "EasyCredentials" that can steal users' passwords, bank card numbers, API keys, and other information. In order to quickly identify the criminal, the police officer uses this technical solution to extract sensitive information from the "EasyCredentials" application.
[0120] The police first used this technical solution to identify and analyze various types of files in the "EasyCredentials" application package, including application code files and manifest files. From the manifest file, the police extracted the application package name and application label, namely "EasyCredentials". Based on the application package name and application label, the police determined the range of strings to be analyzed.
[0121] Parse the determined string to be analyzed to identify and extract sensitive information. For example, the police found a string "password123", which may be the user's password.
[0122] The police read the class name of the string to be analyzed and determined whether the string was a suspicious string based on the class name. For example, if the string appeared in a class related to network communication, it might be a suspicious string. If so, the specific instructions that defined the string in the application code file were parsed to determine its purpose. For example, the police found that the string was assigned to a variable called "userPassword".
[0123] Based on the purpose of the suspicious string, the police determine whether the string is a sensitive string and extract the sensitive information from it. For example, if the string is used for login operations, it is likely to be sensitive information.
[0124] The police checked the format of the suspicious string against the predefined sensitive information types to determine whether it was a sensitive string. For example, the police checked whether the string conformed to the common password format.
[0125] If the format check fails, it is determined whether the string is encrypted. For example, the police found that the string was encrypted. If so, the string is decrypted and the format check is performed again. For example, the police decrypted the string and found that its content is "password123".
[0126] If the format check after decryption passes, the string is determined to be a sensitive string, and its content, encryption algorithm used, and sensitive information type are recorded. For example, the police recorded that the string is the user's password and the AES encryption algorithm was used.
[0127] The police determined the variable name to which the sensitive string was assigned, and extracted the sensitive information in the sensitive string based on the variable name. For example, the police found that the "userPassword" variable stored the user's password.
[0128] Perform word segmentation on variable names to improve the accuracy of sensitive word recognition. For example, the police segmented "userPassword" into "user" and "Password". Extract sensitive information from sensitive strings based on the variable names after word segmentation. For example, the police confirmed that "Password" is the user's password.
[0129] Through the above steps, the police successfully extracted sensitive information from the "EasyCredentials" application using this technical solution, including user passwords, bank card numbers, API keys, etc.
[0130] It should be particularly noted that the process or method represented by the flowchart of the above embodiment of the present disclosure can be understood as representing a module, fragment or part of a code including one or more sets of executable instructions configured to implement the steps of a specific logical function or process. And the scope of the preferred embodiment of the present disclosure includes other implementations, in which the functions may not be performed in the order shown or discussed, including performing the functions in a substantially simultaneous manner or in a reverse order according to the functions involved.
[0131] like Figure 7 As shown, the apparatus 70 for extracting sensitive information from an application package disclosed in the present invention is shown. It should be noted that the principle and technical implementation of the apparatus for extracting sensitive information from an application package can refer to the method embodiment for extracting sensitive information from an application package in the previous embodiment (e.g. Figure 1 ), so it will not be repeated in this embodiment.
[0132] Specifically, the device 70 for extracting sensitive information from an application package includes: an identification module 71, a reading module 72, a range determination module 73, and an extraction module 74, wherein:
[0133] The identification module 71 is used to identify multiple types of files in the target application package, including application code files and manifest files.
[0134] The reading module 72 is used to read the package name and application tag of the application from the manifest file.
[0135] The range determination module 73 is used to determine the range of the character string to be analyzed in the application code file according to the application package name and the application tag.
[0136] The extraction module 74 is used to parse the determined character string to be analyzed to identify and extract sensitive information therein.
[0137] It should be noted that Figure 7Each functional module in the embodiment can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a program instruction product. The program instruction product includes one or a group of program instructions. When the program instruction is loaded and executed on a computer, the process or function according to the present disclosure is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable devices. The program instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
[0138] and, Figure 7 The device disclosed in the embodiment can be implemented by other module division methods. The device embodiments shown above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as a group of modules or modules can be combined or dynamically added to another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or modules can be electrical or other forms.
[0139] in addition, Figure 7 Each functional module and submodule in the embodiment can be dynamically in a processing component, or each module can exist physically separately, or two or more modules can be dynamically in one component. The above-mentioned dynamic components can be implemented in the form of hardware or in the form of software functional modules. If the above-mentioned dynamic components are implemented in the form of software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. The storage medium can be a read-only memory, a disk or an optical disk, etc.
[0140] like Figure 8 As shown, a schematic diagram of the structure of an electronic device in an embodiment of the present disclosure is shown.
[0141] The electronic device can execute the following steps by running the computer program instructions: Figure 1 The method in any one of the items. Exemplarily, the electronic device may be a server group / server, a desktop computer, a laptop computer, etc., or a server / server group in the cloud that communicates remotely with a local terminal, a distributed computing node system, etc.
[0142] The electronic device 80 includes a bus 81, a processor 82, and a memory 83. The processor 82 and the memory 83 can communicate with each other through the bus 81. The memory 83 can store program instructions. The processor 72 implements the method steps in the previous embodiment by running the program instructions in the memory 83, such as Figure 1 Any method.
[0143] The bus 81 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, although only one thick line is used in the figure, it does not mean that there is only one bus or one type of bus.
[0144] In some embodiments, the processor 82 may be implemented as a central processing unit (CPU), a microprocessing unit (MCU), a system on chip (System On Chip), or a field programmable logic array (FPGA). The memory 83 may include a volatile memory (Volatile Memory) for temporary storage of data when running a program, such as a random access memory (Random Access Memory, RAM).
[0145] The memory 83 may also include a non-volatile memory (non-volatile memory) for data storage, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state disk (SSD).
[0146] In some embodiments, the electronic device 80 may further include a communicator 84. The communicator 84 is used to communicate with the outside. In a specific example, the communicator 84 may include one or a group of wired and / or wireless communication circuit modules. For example, the communicator 84 may include one or more of a wired network card, a USB module, a serial interface module, etc. The wireless communication protocols followed by the wireless communication module include: for example, near field wireless communication (NFC) technology, infrared (IR) technology, global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time division code division multiple access (TD-SCDMA), long term evolution (LTE), Bluetooth (BT), global navigation satellite system (GNSS), etc. One or more of the above.
[0147] In an embodiment of the present disclosure, a computer-readable storage medium may be provided, wherein program instructions are stored, and the program instructions are executed by running, for example Figure 1 A method for extracting sensitive information from an application package in an embodiment.
[0148] That is, the method steps in the above embodiments are implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk or magneto-optical disk), or are implemented as computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded via a network and to be stored in a local recording medium, so that the method represented herein can be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an ASIC or FPGA).
[0149] In summary, the disclosed method, device, electronic device and medium for extracting multilingual text recognition of sensitive information from application packages can quickly identify classes and resources that may be related to sensitive information by reading the application manifest file, utilizing the structural information of the application, avoiding the one-by-one inspection of the entire application package, and greatly improving the speed of initial screening. In addition, targeted analysis of potential sensitive information is performed according to predefined rules and patterns, such as specific keywords or formats, reducing interference from irrelevant data and improving the pertinence and efficiency of the analysis. And for encrypted sensitive information, decryption and re-verification steps are provided to ensure that even encrypted sensitive information can be accurately extracted and identified.
[0150] The above embodiments are merely illustrative of the principles and effects of the present disclosure, and are not intended to limit the present disclosure. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present disclosure. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present disclosure shall still be covered by the claims of the present disclosure.
Claims
1. A method for extracting sensitive information from an application package, characterized in that: include: Identify multiple types of files in the target application package, including application code files and manifest files; Read the package name and application tag of the application from the manifest file; Determine, according to the application package name and the application tag, a range of character strings to be analyzed in the application code file; Parse the determined string to be analyzed to identify and extract sensitive information therein.
2. The method for extracting sensitive information from an application package according to claim 1, characterized in that: The sensitive information includes one or more combinations of API keys, IP addresses, URL links, email addresses, user credentials, encrypted data, system commands, and hash values.
3. The method for extracting sensitive information from an application package according to claim 1, characterized in that: The step of parsing the determined character string to be analyzed to identify and extract sensitive information therein includes: Read the class name of the string to be analyzed; Determining whether the character string to be analyzed is a suspicious character string based on the class name; If yes, parsing the specific instructions defining the suspicious string in the application code file to determine the purpose of the suspicious string; Determining whether the suspicious string is a sensitive string according to the purpose of the suspicious string; If so, the sensitive information in the sensitive string is extracted.
4. The method for extracting sensitive information from an application package according to claim 3, characterized in that: The determining, based on the purpose of the suspicious string, whether the suspicious string is a sensitive string includes: Performing format verification on the suspicious character string and predefined sensitive information types; Based on the verification result, it is determined whether the suspicious character string is a sensitive character string.
5. The method for extracting sensitive information from an application package according to claim 4, characterized in that: The determining whether the suspicious character string is a sensitive character string based on the verification result includes: If the format check passes, the suspicious character string is determined to be a sensitive character string; The content of the sensitive string and the corresponding sensitive information type are recorded.
6. The method for extracting sensitive information from an application package according to claim 4, characterized in that: The determining whether the suspicious character string is a sensitive character string based on the verification result includes: If the format check fails, determining whether the suspicious character string is encrypted; If yes, the suspicious character string is decrypted and format checked again; If the format check after decryption passes, the suspicious character string is determined to be a sensitive character string, and the content of the sensitive character string, the encryption algorithm used, and the sensitive information type are recorded.
7. The method for extracting sensitive information from an application package according to claim 3, characterized in that: The extracting the sensitive information from the sensitive string includes: Determine the variable name to which the sensitive string is assigned; Sensitive information in the sensitive string is extracted based on the variable name.
8. The method for extracting sensitive information from an application package according to claim 7, characterized in that: The extracting the sensitive information in the sensitive string based on the variable name includes: Perform word segmentation processing on the variable name; Sensitive information in the sensitive string is extracted based on the variable name after word segmentation processing.
9. A device for extracting sensitive information from an application package, characterized in that: include: An identification module, used to identify multiple types of files in a target application package, including application code files and manifest files; A reading module, used for reading the package name and application tag of the application from the manifest file; A range determination module, used to determine the range of the string to be analyzed in the application code file according to the application package name and the application tag; The extraction module is used to parse the determined string to be analyzed to identify and extract sensitive information therein.
10. An electronic device, characterized in that: The electronic device comprises: Processor and memory; Wherein, the memory is used to store computer programs; The processor is used to execute the computer program stored in the memory so that the electronic device executes the method for extracting sensitive information in an application package as described in any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by an electronic device, the method for extracting sensitive information in an application package described in any one of claims 1 to 8 is implemented.
