Advanced Malware Detection in Code Repositories Using Graph Neural Networks
摘要
The proliferation of online code repositories, such as GitHub and GitLab, has increased security risks related to the spread of malware through source code, including compromised libraries and obfuscated code. Traditional detection methods, such as static and dynamic analysis, have shown limitations when faced with advanced threats. To address this issue, we propose an approach based on Graph Neural Networks (GNN) to enhance malware detection in code repositories. Graphs provide an effective way to model the complex relationships within a program, such as interactions between functions, classes, modules, and external dependencies. This is particularly useful for identifying specific patterns of complex malicious behavior. Our model detects anomalies by analyzing the program internal interactions in addition to the exact code content. Our method extracts call graphs and metadata (such as descriptions and README files) from code repositories. The metadata is converted into vectors using a natural language embedding model, then merged with the embeddings of call graphs generated by GNNs. This combined representation is used by a supervised classifier to detect malicious repositories. The results show strong performance in precision, recall, and F1-score, validating the effectiveness of our approach.