A software supply chain malicious open source project monitoring and early warning method and device
By constructing a knowledge graph of software developers and combining string matching, semantic clustering, and developer behavior analysis, this method identifies and warns of potential malicious open-source projects, solving the problem of monitoring malicious open-source projects in existing technologies. It achieves rapid and accurate identification and warning of malicious open-source projects, thus ensuring the security of the software supply chain.
Patent Information
- Application Number
- CN202410446371.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-15
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2044-04-15
AI Technical Summary
Existing software supply chain security detection methods are insufficient to quickly and effectively identify and monitor potential malicious open-source projects, resulting in serious "pollution" and "registration squatting" attacks in the open-source ecosystem, and a lack of batch and large-scale monitoring and early warning capabilities.
This paper constructs a knowledge graph of software developers, combines string matching and semantic clustering methods, analyzes developers' historical behavior to identify potential malicious open source projects, uses string edit distance and longest substring matching to filter similar projects, uses unsupervised deep neural networks for semantic clustering, and combines developer contribution and reliability assessment to achieve the identification and early warning of malicious open source projects.
It improves the effectiveness and comprehensiveness of malicious open-source project monitoring, reduces the false positive rate, and can quickly screen out potential malicious projects, ensuring the security of the software supply chain.
Smart Images

Figure CN118606520B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software supply chain security detection, and more specifically, to a method and apparatus for monitoring and early warning of malicious open-source projects in the software supply chain. Background Technology
[0002] The rapid popularization of the internet has directly led to the booming development of the open-source community, and third-party open-source libraries are now widely used in various software development applications. Modern large-scale software typically consists of multiple components, which can be code written by developers or third-party libraries, frameworks, or other tools. These components are interdependent, and the correctness and security of one component has a significant impact on the functionality and security of the entire software. As the scale of software code expands, the software supply chain becomes increasingly complex and diverse, introducing a series of security issues. Attackers may inject malicious code into software components, manipulate development tools, tamper with software distribution channels, and use other methods to compromise the integrity, usability, and security of the software. They may also infect a stage or component to spread malicious code to downstream users, posing a serious threat to software systems and user data.
[0003] Currently, most open-source software repositories prioritize convenience and speed in their design, neglecting the detection of malicious open-source projects in the software supply chain. This has led to increasingly serious problems such as "pollution" and "registration squatting" attacks within the open-source ecosystem. Existing software supply chain security detection methods involve creating a software dependency graph for a specific software component in use, extracting information on the corresponding affected components, and detecting known vulnerabilities by scanning and analyzing the components contained in the software under test. However, these methods lack rapid tracking methods for malicious open-source projects, making it difficult to achieve batch and large-scale monitoring and early warning of malicious open-source projects. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and device for monitoring and early warning of malicious open source projects in the software supply chain. It utilizes open source code information existing on the Internet to construct a knowledge graph of software developers, and uses a combination of string matching and semantic clustering to achieve rapid screening of potential malicious open source projects. By analyzing and characterizing the historical behavior of developers, it achieves accurate identification of malicious open source projects.
[0005] The objective of this invention is achieved through the following solution:
[0006] A method for monitoring and early warning of malicious open-source projects in the software supply chain includes the following steps:
[0007] S1, Software Developer Knowledge Graph Construction: Collect software information and software developer information, and preprocess the collected information and extract key fields;
[0008] S2, Open Source Project Name Similarity Matching: Utilizes string edit distance and longest substring matching to filter and analyze objects;
[0009] S3, Semantic Clustering Analysis of Open Source Projects: Using an unsupervised deep neural network text clustering model, identify potential malicious open source projects from open source projects;
[0010] S4, Developer Historical Behavior Analysis: This involves a comprehensive analysis of the historical behavior of candidate malicious open-source projects and projects in which the developers have participated, in order to assess the developers' contributions and reliability.
[0011] S5, Malicious Open Source Project Identification: Based on step S4, malicious open source projects are identified to help developers and users identify potential malicious risks and take corresponding preventive and protective measures.
[0012] Further, in step S1, the collection of software information and software developer information, and the preprocessing and extraction of key fields of the collected information, specifically includes the following sub-steps:
[0013] S11 collects and extracts information about open-source projects from internet open-source code release platforms, and classifies open-source projects into relatively active projects, moderately active projects, and inactive projects based on their star rating and the date of their last modification.
[0014] S12 collects and extracts developer information from the homepage or introduction page of the open source project, and then extracts the pull / request history of each developer of the open source project.
[0015] S13 establishes a mapping relationship between the collected structured information of developer behavior records and open source projects, and stores them in a structured database and a big data storage platform respectively;
[0016] S14, integrate the extracted entities and relationships between entities with the tuple knowledge in the constructed knowledge graph;
[0017] S15 uses the Neo4j graph database as the storage for the software developer knowledge graph. The organized tuple knowledge is stored in the database according to the Neo4j conceptual model, and the hash value of the downloaded open source software is used as a unique constraint index to facilitate retrieval and comparison.
[0018] Furthermore, the step of using string edit distance and longest substring matching to filter and analyze objects specifically includes the following sub-steps:
[0019] S21, Calculate edit distance: Select a benchmark open source project, then calculate the edit distance between other projects and the benchmark project, and include projects with an edit distance less than the set value into the initial matching candidate project set;
[0020] S22, Longest Substring Matching: Filter the initial matching candidate items, extract keywords from the baseline item name as substrings, and then search whether these substrings exist in other candidate item names; if they exist, it means that the two item names are semantically similar and belong to the same type of item, so they are kept in the candidate set.
[0021] S23, Output candidate open source projects: Merge and deduplicate the string matching results in step S22, and filter out illegal strings.
[0022] Furthermore, the text clustering model using unsupervised deep neural networks to identify potential malicious open-source projects from open-source projects specifically includes the following sub-steps:
[0023] S31: Load the introductory text of the open-source project and perform data preprocessing to remove distracting elements;
[0024] S32, Creating sentence vector representations: Using Sentence-Transformer as the text encoder, the pre-trained model is Paraphrase-multilingual-MiniLM-L12-v2;
[0025] S33, document clustering analysis based on the HDBSCAN algorithm: by finding a first density region to isolate a second density region, the second density region is regarded as a cluster, realizing the hierarchical and density-based semantic clustering of documents in the open source project; where the density of the second density region is higher than that of the first density region;
[0026] S34. Use the class-based TF-IDF method to extract the topic words of each cluster, concatenate all documents in a class into a new document, and then extract the tag words of the class based on TF-IDF as preliminary functional tags;
[0027] S35: Select open-source projects whose cluster center distance is less than a threshold as semantically similar projects, and the selected projects are considered as candidate malicious open-source projects.
[0028] Furthermore, the comprehensive analysis of candidate malicious open-source projects and the historical behavior of other projects in which the developer has participated, used to evaluate the developer's contributions and reliability, specifically includes the following sub-steps:
[0029] S41, Calculate the developer's contribution to the candidate malicious open-source project. Use the API or command-line tools provided by the version control system to obtain the project's pull / request list and count the number of pulls / requests submitted by developers in the current project; calculate the contribution by comparing the number of pulls / requests submitted by developers with the total number of pulls / requests in the current project.
[0030] S42, Calculate the developer's contribution to other projects ρ: Obtain a list of other projects the software developer has participated in from the software developer knowledge graph, and use the contribution ρ to assess the developer's diversity and breadth of participation. ρ = ∑s i c i , where s i c represents the popularity of the project. i It represents the developer's contribution to the open-source project;
[0031] S43, Calculate the developer's information completeness score γ: This score tracks the completeness of the developer's name, email, social media accounts, bio, and profile. Each item scores 2 for completeness, 1 for incompleteness, and 0 for not providing any information at all. Where α i This represents the score for each item;
[0032] S44, Calculate the developer's reliability P: The developer's reliability is assessed by calculating the following formula to determine if the developer has any potential malicious intent. The larger the value of P, the more reliable the developer.
[0033] Furthermore, the identification of malicious open-source projects based on step S4, which helps developers and users identify potential malicious risks and take corresponding preventive and protective measures, specifically includes the following sub-steps:
[0034] S51: After a user makes a request through the malicious open source project security detection interface, the system obtains the address of the open source project and retrieves relevant knowledge from the software developer knowledge graph.
[0035] S52 uses open source project name similarity matching to initially filter out suspicious open source projects. If no suspicious open source projects are found in this step, no warning is issued.
[0036] S53 further filters out candidate malicious open source projects through semantic clustering and classification of open source projects. If no suspicious open source projects are filtered out in this step, no warning is issued.
[0037] S54 analyzes the developer's historical behavior and calculates the developer's reliability P. If the reliability P is greater than the threshold d, no warning is issued; if the reliability P is less than the threshold d, the analysis results are output and a warning is issued, as well as risk warnings are issued for other open source projects of the software developer in the associated software developer knowledge graph.
[0038] Furthermore, in step S21, the calculation of the edit distance between other items and the benchmark item specifically utilizes the Levenshtein Distance algorithm to calculate the edit distance between other items and the benchmark item.
[0039] Furthermore, in step S22, the filtering of preliminary matching candidate items specifically utilizes the Boyer-Moore algorithm to filter the preliminary matching candidate items.
[0040] Furthermore, in step S35, the threshold is set between [0.5, 1].
[0041] A software supply chain malicious open source project monitoring and early warning device includes a program instruction execution unit and a program instruction storage unit. When the program instruction is loaded and executed by the program instruction execution unit, the software supply chain malicious open source project monitoring and early warning method described in any of the preceding claims is executed.
[0042] The beneficial effects of this invention include:
[0043] (1) By combining string matching and semantic clustering, the workload of semantic calculation is greatly reduced while ensuring a low false alarm rate, thereby improving the speed of screening potential malicious open source projects and enhancing the effectiveness of monitoring and early warning of malicious open source projects.
[0044] (2) By characterizing the historical behavior of developers and setting reasonable weight factors for the project contributions of different developers, malicious behavior of developers can be effectively screened. At the same time, by utilizing the interconnected advantages of the knowledge graph of software developers, the comprehensiveness of malicious open source monitoring and early warning information can be improved. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 This is a schematic diagram illustrating the operation of an embodiment of the present invention;
[0047] Figure 2This is a schematic diagram of the software developer knowledge graph construction process according to an embodiment of the present invention;
[0048] Figure 3 This is a schematic diagram of the semantic clustering analysis process of an open-source project according to an embodiment of the present invention;
[0049] Figure 4 This is a schematic diagram of the malicious open-source project identification process according to an embodiment of the present invention. Detailed Implementation
[0050] All features disclosed in all embodiments of this specification, or steps in all methods or processes implied in the disclosure, may be combined and / or extended or replaced in any way, except for mutually exclusive features and / or steps.
[0051] In view of the technical problems mentioned in the background, this invention proposes a method and device for monitoring and warning of malicious open source projects in the software supply chain. It automatically extracts software development-related knowledge from massive amounts of software information, discovers open source software that has been "squatting" through multi-dimensional feature comparison of open source projects, and then identifies the malicious behavior of software developers. This achieves automated monitoring of malicious open source projects and provides alerts for them, effectively blocking the widespread dissemination of malicious open source projects and ensuring the security of the software supply chain.
[0052] This invention aims to provide solutions to the problems of "pollution" and "registration squatting" threat detection in software supply chain security. Specifically, it proposes solutions to the following issues: 1) How to utilize the massive data of the open-source community to construct a knowledge graph centered on software developers, solving the problem of symbolic connection between software developers and open-source projects; 2) How to quickly filter out suspicious open-source projects while ensuring matching accuracy, solving the problem of filtering potential malicious open-source projects from a massive number of open-source projects; 3) How to characterize the behavioral features of software developers, solving problems such as reliability assessment and malice assessment of developers.
[0053] The goal of the software supply chain malicious open source project monitoring and early warning system is to quickly track the real-time status of open source projects across the entire network when facing open source components frequently used in the internal software development process of an enterprise, and to filter out open source projects with malicious behavior, including "pollution" of well-known open source software and "registration" attacks that forge and imitate well-known open source software.
[0054] The software supply chain malicious open source project monitoring and early warning scheme proposed in this invention mainly consists of five steps: 1. Constructing a knowledge graph of software developers; 2. Open source project name similarity matching; 3. Open source project semantic clustering analysis; 4. Developer historical behavior analysis; 5. Malicious open source project identification.
[0055] The proposed solution mainly includes a firewall, a big data cluster, a domain knowledge extraction server, a software developer knowledge graph, an open-source project name similarity matching server, an open-source project semantic clustering analysis server, a developer historical behavior analysis server, and a malicious open-source project identification server. These components are networked together to form a complete software supply chain malicious open-source project monitoring and early warning system. The working principle of this invention is independent of the specific deployment method; therefore, it only employs… Figure 1 The diagram illustrates the working principle of a malicious open-source project monitoring and early warning system in the software supply chain. Specifically, it includes the process of building a software developer knowledge graph, the process of matching similar open-source project names, the process of semantic clustering analysis of open-source projects, the process of analyzing developers' historical behavior, and the process of identifying malicious open-source projects.
[0056] like Figure 2 As shown, the process of constructing a software developer knowledge graph includes the following steps:
[0057] Information collection is mainly divided into two parts: software information collection and software developer information collection. The collected information undergoes preprocessing and key field extraction. Data is regularly collected from internet open-source project distribution platforms such as GitHub, PyPI, Maven, and NPM through a collection service. While adhering to various existing code licenses (such as BSD, GPL, LGPL, and MIT), data from various open-source projects can be obtained from these platforms. The specific steps are as follows:
[0058] 1) Collect and extract information such as the name, popularity, star rating, and backlinks of open source projects from internet open source code publishing platforms, and classify open source projects into relatively active projects, moderately active projects, and inactive projects based on the star rating and the last modification date of the open source projects.
[0059] 2) Collect and extract developer information from the homepage or introduction page of the open source project, including username, email, social media accounts, etc., and then use the git tool to extract the pull / request history of each developer of the open source project.
[0060] 3) Establish a mapping relationship between the collected developer behavior records and structured information and open source projects, and store them in structured databases and big data storage platforms, such as MySQL and HDFS.
[0061] 4) The extracted entities and relationships between entities are integrated with the tuple knowledge in the constructed knowledge graph. The main integrated knowledge includes: (software name, software version) and (software name, hash value), (software name, software version) and (software name, software developer), (software developer, software developer), etc.
[0062] 5) The solution uses the Neo4j graph database as the storage for the software developer knowledge graph, storing the organized tuple knowledge according to the Neo4j conceptual model. Using the Neo4j graph database facilitates flexible storage of software component knowledge, efficient knowledge retrieval operations, and establishes a unique constraint index (UNIQUEindex) using the hash values of downloaded open-source software to facilitate retrieval and comparison.
[0063] The process of matching similar names for open-source projects includes the following steps:
[0064] Open source project name similarity matching is crucial for rapid malicious open source project monitoring and early warning. This approach leverages the ability to quickly match massive amounts of strings to filter out valuable analysis targets, reducing the computational burden of subsequent analysis. This solution uses two string matching methods: string edit distance and longest substring matching. The specific steps are as follows:
[0065] 1) Calculate edit distance. First, select popular open-source projects as benchmarks. These projects are usually of high quality, highly active, and represent the mainstream technologies in the field. Then, use the Levenshtein Distance algorithm to calculate the edit distance between other projects and these benchmark projects. Projects with an edit distance less than 2 are more likely to belong to the same field, and therefore can be included in the initial matching candidate project set.
[0066] 2) Longest Substring Matching. The Boyer-Moore algorithm is further used to filter the initial candidate items. This algorithm is a highly efficient string matching algorithm, particularly suitable for finding the occurrence of a given pattern in longer texts. Frequently occurring keywords are extracted from these benchmark high-popularity item names as substrings, and then these substrings are searched for their existence in other candidate item names. If more matching substrings exist, it indicates that the two item names are semantically similar and belong to the same category, and can be retained in the candidate set.
[0067] 3) Output candidate open-source projects. The results of the string matching methods described above are merged, duplicates are removed, and invalid strings are filtered out. A combined string matching method using edit distance and substring matching can quickly and efficiently complete project name similarity matching and provide a reliable list of candidate projects.
[0068] like Figure 3 As shown, the semantic clustering analysis process in open-source projects includes the following steps:
[0069] The previous step of open-source project name similarity matching has quickly identified similar open-source projects based on "string" data. However, a high false positive rate still exists, necessitating accurate identification of potential malicious open-source projects based on their "semantic" meaning. Since semantic analysis is computationally expensive and therefore slow, it needs to be combined with rapid "string" data screening to monitor a massive number of open-source projects. Figure 3 As shown, the data for semantic clustering analysis in open-source projects is text extracted from the homepage or introduction page of the open-source project. This solution uses an unsupervised deep neural network text clustering model, which uses a Transformer pre-trained model as a word embedding tool to represent text as numerical vectors. The specific steps are as follows:
[0070] 1) Load the introductory text of the open source project and perform necessary data preprocessing to remove some interfering elements, including special symbols, non-Chinese and non-English characters, and filter out shorter texts. In this solution, sentences with less than 10 words are filtered out.
[0071] 2) Create high-quality sentence vector representations. Sentence-Transformer is used as the text encoder, and the pre-trained model is Paraphrase-multilingual-MiniLM-L12-v2, which supports multiple languages and has high processing efficiency, minimizing the loss of semantic information during the vectorization process.
[0072] 3) Document clustering analysis based on the HDBSCAN algorithm. By identifying low-density regions to isolate high-density regions, and treating the high-density regions as a cluster, this achieves hierarchical and density-based semantic clustering of documents, as described in the open-source project.
[0073] 4) Use a class-based TF-IDF method to extract the topic words for each cluster. That is, concatenate all documents in a class into a new document, and then extract the tag words for that class based on TF-IDF as preliminary functional tags.
[0074] 5) Filter open source projects whose cluster center distance is less than a threshold as semantically similar projects. The threshold can usually be set between [0.5, 1]. The filtered projects are then considered as candidate malicious open source projects.
[0075] The process of analyzing developer history includes the following steps:
[0076] Analyzing the historical behavior of developers of candidate malicious open-source projects is an effective method for monitoring such projects. It helps assess a developer's contributions and reliability, requiring a comprehensive analysis of both the candidate malicious open-source project and the developer's historical behavior in other projects. A lower reliability score indicates lower trustworthiness and reliability from the developer, thus implying a higher probability that the open-source project is malicious. The specific steps are as follows:
[0077] 1) Calculate the developer's contribution to the candidate malicious open-source project. Use the API or command-line tools provided by a version control system (such as Git) to retrieve the project's pull / request list and count the number of pulls / requests submitted by developers in the current project. A pull / request is a modification request submitted by a developer to the project repository, representing their contribution to the project. The contribution level is calculated by dividing the number of pulls / requests submitted by developers by the total number of pulls / requests in the current project. High contribution This usually indicates that the developer actively participates in the project and makes continuous contributions.
[0078] 2) Calculate the developer's contribution to other projects, ρ. Obtain a list of other projects the software developer has participated in from the software developer knowledge graph. Developers who engage in "malicious registration" or "pollution" of open-source projects rarely participate in other open-source projects. Therefore, the contribution ρ assesses the developer's diversity and breadth of participation. ρ = ∑s i c i Among them, s i The star rating of a project indicates its popularity. i The method for calculating the contribution of developers to open source projects is the same as the previous step.
[0079] 3) Calculate the developer's information completeness score γ. Malicious developers often have many inconsistencies in their developer information and contribution records. The following six items are considered for completeness: developer's name, email, social media accounts, bio, and profile. Each item scores 2 for completeness, 1 for incompleteness, and 0 for not providing any information at all. Where α i This represents the score for each item.
[0080] 4) Calculate the developer's reliability (P). Active, high-quality, and responsible developers are the norm in mainstream, healthy open-source projects. Therefore, calculating the developer's reliability can help assess whether the developer has any potential malicious intent. The larger the value of P, the more reliable the developer.
[0081] like Figure 4 As shown, the process of identifying malicious open-source projects includes the following steps:
[0082] Malicious open-source project identification is the core of open-source project monitoring and early warning. It helps developers and users identify potential malicious risks and take corresponding preventative and protective measures. The specific steps are as follows:
[0083] 1) When a user makes a request through the malicious open-source project security detection interface, the system obtains the address of the open-source project and retrieves relevant knowledge from the software developer knowledge graph.
[0084] 2) Suspicious open source projects are initially screened out by matching the similarity of open source project names. If no suspicious open source projects are screened out in this step, no warning will be issued.
[0085] 3) By using semantic clustering and classification of open source projects, further filter out candidate malicious open source projects. If no suspicious open source projects are found in this step, no warning will be issued.
[0086] 4) Analyze the developer's historical behavior to calculate the developer's reliability P. If the reliability P is greater than the threshold d, no warning is issued; if the reliability P is less than the threshold d, the analysis results are output and a warning is issued, along with risk warnings for other open-source projects related to the same software developer in the software developer's knowledge graph. In this solution, the threshold d can be derived from historical malicious open-source projects.
[0087] It should be noted that, within the scope of protection defined in the claims of this invention, the following embodiments can be combined and / or extended or replaced in any logical manner from the above specific embodiments, such as the disclosed technical principles, disclosed technical features or implicitly disclosed technical features.
[0088] Example 1
[0089] A method for monitoring and early warning of malicious open-source projects in the software supply chain includes the following steps:
[0090] S1, Software Developer Knowledge Graph Construction: Collect software information and software developer information, and preprocess the collected information and extract key fields;
[0091] S2, Open Source Project Name Similarity Matching: Utilizes string edit distance and longest substring matching to filter and analyze objects;
[0092] S3, Semantic Clustering Analysis of Open Source Projects: Using an unsupervised deep neural network text clustering model, identify potential malicious open source projects from open source projects;
[0093] S4, Developer Historical Behavior Analysis: This involves a comprehensive analysis of the historical behavior of candidate malicious open-source projects and projects in which the developers have participated, in order to assess the developers' contributions and reliability.
[0094] S5, Malicious Open Source Project Identification: Based on step S4, malicious open source projects are identified to help developers and users identify potential malicious risks and take corresponding preventive and protective measures.
[0095] Example 2
[0096] Based on Example 1, in step S1, the collection of software information and software developer information, and the preprocessing and extraction of key fields of the collected information, specifically includes the following sub-steps:
[0097] S11 collects and extracts information about open-source projects from internet open-source code release platforms, and classifies open-source projects into relatively active projects, moderately active projects, and inactive projects based on their star rating and the date of their last modification.
[0098] S12 collects and extracts developer information from the homepage or introduction page of the open source project, and then extracts the pull / request history of each developer of the open source project.
[0099] S13 establishes a mapping relationship between the collected structured information of developer behavior records and open source projects, and stores them in a structured database and a big data storage platform respectively;
[0100] S14, integrate the extracted entities and relationships between entities with the tuple knowledge in the constructed knowledge graph;
[0101] S15 uses the Neo4j graph database as the storage for the software developer knowledge graph. The organized tuple knowledge is stored in the database according to the Neo4j conceptual model, and the hash value of the downloaded open source software is used as a unique constraint index to facilitate retrieval and comparison.
[0102] Example 3
[0103] Based on Example 1, the step of using string edit distance and longest substring matching to filter and analyze objects specifically includes the following sub-steps:
[0104] S21, Calculate edit distance: Select a benchmark open source project, then calculate the edit distance between other projects and the benchmark project, and include projects with an edit distance less than the set value into the initial matching candidate project set;
[0105] S22, Longest Substring Matching: Filter the initial matching candidate items, extract keywords from the baseline item name as substrings, and then search whether these substrings exist in other candidate item names; if they exist, it means that the two item names are semantically similar and belong to the same type of item, so they are kept in the candidate set.
[0106] S23, Output candidate open source projects: Merge and deduplicate the string matching results in step S22, and filter out illegal strings.
[0107] Example 4
[0108] Based on Example 1, the text clustering model using an unsupervised deep neural network to identify potential malicious open-source projects from open-source projects specifically includes the following sub-steps:
[0109] S31: Load the introductory text of the open-source project and perform data preprocessing to remove distracting elements;
[0110] S32, Creating sentence vector representations: Using Sentence-Transformer as the text encoder, the pre-trained model is Paraphrase-multilingual-MiniLM-L12-v2;
[0111] S33, document clustering analysis based on the HDBSCAN algorithm: by finding a first density region to isolate a second density region, the second density region is regarded as a cluster, realizing the hierarchical and density-based semantic clustering of documents in the open source project; where the density of the second density region is higher than that of the first density region;
[0112] S34. Use the class-based TF-IDF method to extract the topic words of each cluster, concatenate all documents in a class into a new document, and then extract the tag words of the class based on TF-IDF as preliminary functional tags;
[0113] S35: Select open-source projects whose cluster center distance is less than a threshold as semantically similar projects, and the selected projects are considered as candidate malicious open-source projects.
[0114] Example 5
[0115] Based on Example 1, the comprehensive analysis of candidate malicious open-source projects and the historical behavior of other projects in which the developer has participated, used to evaluate the developer's contribution and reliability, specifically includes the following sub-steps:
[0116] S41, Calculate the developer's contribution to the candidate malicious open-source project. Use the API or command-line tools provided by the version control system to obtain the project's pull / request list and count the number of pulls / requests submitted by developers in the current project; calculate the contribution by comparing the number of pulls / requests submitted by developers with the total number of pulls / requests in the current project.
[0117] S42, Calculate the developer's contribution to other projects ρ: Obtain a list of other projects the software developer has participated in from the software developer knowledge graph, and use the contribution ρ to assess the developer's diversity and breadth of participation. ρ = ∑s i c i , where s i c represents the popularity of the project. i It represents the developer's contribution to the open-source project;
[0118] S43, Calculate the developer's information completeness score γ: This score tracks the completeness of the developer's name, email, social media accounts, bio, and profile. Each item scores 2 for completeness, 1 for incompleteness, and 0 for not providing any information at all. Where α i This represents the score for each item;
[0119] S44, Calculate the developer's reliability P: The developer's reliability is assessed by calculating the following formula to determine if the developer has any potential malicious intent. The larger the value of P, the more reliable the developer.
[0120] Example 6
[0121] Based on Example 1, the step S4 for identifying malicious open-source projects helps developers and users identify potential malicious risks and take corresponding preventative and protective measures. This step specifically includes the following sub-steps:
[0122] S51: After a user makes a request through the malicious open source project security detection interface, the system obtains the address of the open source project and retrieves relevant knowledge from the software developer knowledge graph.
[0123] S52 uses open source project name similarity matching to initially filter out suspicious open source projects. If no suspicious open source projects are found in this step, no warning is issued.
[0124] S53 further filters out candidate malicious open source projects through semantic clustering and classification of open source projects. If no suspicious open source projects are filtered out in this step, no warning is issued.
[0125] S54 analyzes the developer's historical behavior and calculates the developer's reliability P. If the reliability P is greater than the threshold d, no warning is issued; if the reliability P is less than the threshold d, the analysis results are output and a warning is issued, as well as risk warnings are issued for other open source projects of the software developer in the associated software developer knowledge graph.
[0126] Example 7
[0127] Based on Example 2, in step S21, the calculation of the edit distance between other items and the benchmark item specifically utilizes the Levenshtein Distance algorithm to calculate the edit distance between other items and the benchmark item.
[0128] Example 8
[0129] Based on Example 2, in step S22, the filtering of preliminary matching candidate items specifically utilizes the Boyer-Moore algorithm to filter the preliminary matching candidate items.
[0130] Example 9
[0131] Based on Example 4, in step S35, the threshold is set between [0.5, 1].
[0132] Example 10
[0133] A software supply chain malicious open source project monitoring and early warning device includes a program instruction execution unit and a program instruction storage unit. When the program instruction is loaded and executed by the program instruction execution unit, the software supply chain malicious open source project monitoring and early warning method described above is executed.
[0134] The units described in the embodiments of the present invention can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0135] According to one aspect of the present invention, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations described above.
[0136] In another aspect, embodiments of the present invention also provide a computer-readable medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the methods described in the above embodiments.
[0137] In addition to the examples above, other embodiments may be obtained by those skilled in the art based on the above disclosure or by making modifications using knowledge or technology in related fields. The features of each embodiment may be interchanged or replaced. Modifications and changes made by those skilled in the art that do not depart from the spirit and scope of the present invention should be within the protection scope of the appended claims.
Claims
1. A method for monitoring and early warning of malicious open-source projects in the software supply chain, characterized in that, include: S1, Software Developer Knowledge Graph Construction: Collect software information and software developer information, and preprocess the collected information and extract key fields; S2, Open Source Project Name Similarity Matching: Utilizes string edit distance and longest substring matching to filter and analyze objects; S3, Semantic Clustering Analysis of Open Source Projects: Using an unsupervised deep neural network text clustering model, identify potential malicious open source projects from open source projects; S4, Developer Historical Behavior Analysis: This involves a comprehensive analysis of the historical behavior of candidate malicious open-source projects and projects in which the developers have participated, in order to assess the developers' contributions and reliability. S5, Malicious Open Source Project Identification: Based on step S4, malicious open source projects are identified to help developers and users identify potential malicious risks and take corresponding preventive and protective measures. The text clustering model using unsupervised deep neural networks to identify potential malicious open-source projects from open-source projects specifically includes the following sub-steps: S31: Load the introductory text of the open-source project and perform data preprocessing to remove distracting elements; S32, Creating sentence vector representations: Using Sentence-Transformer as the text encoder, the pre-trained model is Paraphrase-multilingual-MiniLM-L12-v2; S33, document clustering analysis based on the HDBSCAN algorithm: by finding a first density region to isolate a second density region, the second density region is regarded as a cluster, realizing the hierarchical and density-based semantic clustering of documents in the open source project; where the density of the second density region is higher than that of the first density region; S34. Use the class-based TF-IDF method to extract the topic words of each cluster, concatenate all documents in a class into a new document, and then extract the tag words of the class based on TF-IDF as preliminary functional tags; S35: Select open source projects whose cluster center distance is less than a threshold as semantically similar projects, and the selected projects are regarded as candidate malicious open source projects. The identification of malicious open-source projects based on step S4 helps developers and users identify potential malicious risks and take corresponding preventive and protective measures. This includes the following sub-steps: S51: After a user makes a request through the malicious open source project security detection interface, the system obtains the address of the open source project and retrieves relevant knowledge from the software developer knowledge graph. S52 uses open source project name similarity matching to initially filter out suspicious open source projects. If no suspicious open source projects are found in this step, no warning is issued. S53 further filters out candidate malicious open source projects through semantic clustering and classification of open source projects. If no suspicious open source projects are filtered out in this step, no warning is issued. S54 analyzes the developer's historical behavior and calculates the developer's reliability P. If the reliability P is greater than the threshold d, no warning is issued; if the reliability P is less than the threshold d, the analysis results are output and a warning is issued, as well as risk warnings are issued for other open source projects of the software developer in the associated software developer knowledge graph.
2. The method for monitoring and early warning of malicious open-source projects in the software supply chain according to claim 1, characterized in that, In step S1, the process of collecting software information and software developer information, and preprocessing and extracting key fields from the collected information, specifically includes the following sub-steps: S11 collects and extracts information about open-source projects from internet open-source code release platforms, and classifies open-source projects into relatively active projects, moderately active projects, and inactive projects based on their star rating and the date of their last modification. S12 collects and extracts developer information from the homepage or introduction page of the open source project, and then extracts the pull / request history of each developer of the open source project. S13 establishes a mapping relationship between the collected structured information of developer behavior records and open source projects, and stores them in a structured database and a big data storage platform respectively; S14, integrate the extracted entities and relationships between entities with the tuple knowledge in the constructed knowledge graph; S15 uses the Neo4j graph database as the storage for the software developer knowledge graph. The organized tuple knowledge is stored in the database according to the Neo4j conceptual model, and the hash value of the downloaded open source software is used as a unique constraint index to facilitate retrieval and comparison.
3. The method for monitoring and early warning of malicious open-source projects in the software supply chain according to claim 1, characterized in that, The process of filtering and analyzing objects using string edit distance and longest substring matching specifically includes the following sub-steps: S21, Calculate edit distance: Select a benchmark open source project, then calculate the edit distance between other projects and the benchmark project, and include projects with an edit distance less than the set value into the initial matching candidate project set; S22, Longest Substring Matching: Filter the initial matching candidate items, extract keywords from the baseline item name as substrings, and then search whether these substrings exist in other candidate item names; If they exist, it means that the two project names are semantically similar and belong to the same type of project, so they are kept in the candidate set; S23, Output candidate open source projects: Merge and deduplicate the string matching results in step S22, and filter out illegal strings.
4. The method for monitoring and early warning of malicious open-source projects in the software supply chain according to claim 2, characterized in that, In step S21, the calculation of the edit distance between other items and the benchmark item specifically utilizes the Levenshtein Distance algorithm.
5. The method for monitoring and early warning of malicious open-source projects in the software supply chain according to claim 2, characterized in that, In step S22, the filtering of preliminary matching candidate items specifically utilizes the Boyer-Moore algorithm to filter the preliminary matching candidate items.
6. The method for monitoring and early warning of malicious open-source projects in the software supply chain according to claim 1, characterized in that, In step S35, the threshold is set between [0.5, 1].
7. A monitoring and early warning device for malicious open-source projects in the software supply chain, characterized in that, It includes a program instruction execution unit and a program instruction storage unit. When the program instructions are loaded and run by the program instruction execution unit, the software supply chain malicious open source project monitoring and early warning method described in any one of claims 1 to 6 is executed.
Citation Information
Patent Citations
Malicious code package detection method and device, computer equipment and storage medium
CN114637993A
Software supply chain detection method and device
CN115659344A
Malware Clustering Approaches Based on Cognitive Computing Techniques
US20190044964A1
