MultiGLICE: Combining Graph Neural Networks and Program Slicing for Multiclass Software Vulnerability Detection †
Abstract
:1. Introduction
- We introduce MultiGLICE, an extended version of the GLICE model, which combines inter-procedural program slicing and a GNN model for the detection of a broad range of software vulnerabilities (38 CWE types). MultiGLICE does not only detect the presence of a vulnerability, but also identifies its specific CWE type, enhancing the usability of the model for developers and security researchers. The source code of MultiGLICE is available as open-source software at https://github.com/wesleydekraker/glice (accessed on 27 February 2025).
- In our experiments with MultiGLICE, we explore the effect of the function depth in our inter-procedural program slicing algorithm. To train and evaluate MultiGLICE, we utilize a dataset of both vulnerable and non-vulnerable samples, sourced from the Software Assurance Reference Dataset (SARD).
- We perform experiments to compare MultiGLICE with the state-of-the-art FUNDED model and demonstrate that MultiGLICE achieves significantly higher detection performance at a lower cost.
2. Prior Work on Vulnerability Detection
3. Methodology
3.1. Program Slicing
3.2. FUNDED
3.3. Improved FUNDED and GLICE
- The FUNDED model represents source code using multiple relational graphs. For C/C++ code, it employs two external libraries to construct these graphs: CDT (https://projects.eclipse.org/projects/tools.cdt accessed on 27 February 2025) and Joern (https://github.com/joernio/joern accessed on 27 February 2025). However, FUNDED exhibits incorrect graph aggregation. Due to a flaw in the data shuffling routine, graphs from different samples are inadvertently mixed, rendering the Joern graph ineffective. Additionally, edges in the CDT graph are incorrectly connected, as CDT utilizes one-based node numbering, whereas FUNDED adopts a zero-based numbering scheme. We have identified and resolved these issues.
- FUNDED incorrectly utilizes samples from both the training and validation sets for training. The validation set should only be used to evaluate the model and optimize the hyperparameters, such as the number of epochs, to prevent overfitting. We addressed this issue by removing the code that mistakenly adds samples from the validation set to the training set.
- As the entire dataset is loaded into the memory, exceeding the available memory limit (32 GB in our case), which results in an out-of-memory exception. To mitigate this issue, we implemented a streaming approach where data batches are loaded from the disk incrementally. While one batch is being processed during training, the subsequent batch is preloaded from the disk. To further optimize data handling, we introduced caching using the Python pickle module for the efficient serialization and deserialization of object structures. This ensures that conversions to NumPy arrays are performed only once, reducing the computational overhead.
- We modified the FUNDED implementation to ensure that evaluation metrics, including the precision, recall, F1-score, and accuracy, are computed over the entire test set, rather than being limited to the samples in the final batch.
- The FUNDED model does not perform variable renaming. However, we observed that certain variable names in our dataset, such as dataGoodBuffer and dataBadBuffer, explicitly indicate whether a buffer is sufficiently large to prevent a buffer overflow. To eliminate potential biases and prevent the model from learning patterns based on variable names rather than program semantics, we implemented a variable renaming mechanism.
- Word2vec was originally developed for natural language processing, where it maps words with similar meanings to nearby vectors in a continuous vector space. The model learns these representations by analyzing the contextual relationships between words, considering the surrounding words within a sentence. In the FUNDED model, we observed that many sentences consisted of only a single token, which hinders effective learning. To address this limitation, we modified the embedding strategy so that a sentence represents an entire function rather than a single line of code.
- Additionally, we identified issues in the tokenization process used in FUNDED. Specifically, token splitting is often performed incorrectly. For example, the statement printWLine(data); is treated as a single token, whereas it should be split into two distinct tokens: the function name printWLine and the argument data. This error arises because tokenization considers only space characters as delimiters. Furthermore, a bug in the parser causes tokens following a closing parenthesis ) to be removed. We addressed these issues by adopting the tokenization logic from Joern, ensuring accurate token segmentation.
3.4. MultiGLICE
3.5. Dataset
3.6. Evaluation Metrics
4. Experiments
4.1. Experimental Setup
- We ran experiments to compare the original FUNDED model and our improved FUNDED model including the bug fixes, as described in Section 3.3.
- We evaluated the impact of the target depth in our program slicing algorithm.
- We ran experiments to compare the MultiGLICE model with the original FUNDED model adapted to multiclass classification.
4.2. Improved FUNDED
4.3. Target Depth
4.4. MultiGLICE
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
Appendix A
CWE Type | Description |
---|---|
CWE-015 | External Control of System or Configuration Setting |
CWE-023 | Relative Path Traversal |
CWE-036 | Absolute Path Traversal |
CWE-078 | Improper Neutralization of Special Elements Used in an OS Command |
(’OS Command Injection’) | |
CWE-079 | Improper Neutralization of Input During Web Page Generation |
(’Cross-Site Scripting’) | |
CWE-080 | Improper Neutralization of Script-Related HTML Tags in a Web Page |
(Basic XSS) | |
CWE-089 | Improper Neutralization of Special Elements Used in an SQL Command |
(’SQL Injection’) | |
CWE-090 | Improper Neutralization of Special Elements Used in an LDAP Query |
(’LDAP Injection’) | |
CWE-091 | XML Injection (or Blind XPath Injection) |
CWE-098 | Improper Control of Filename for Include/Require Statement in PHP Program |
(’PHP Remote File Inclusion’) | |
CWE-113 | Improper Neutralization of CRLF Sequences in HTTP Headers |
(’HTTP Request/Response Splitting’) | |
CWE-121 | Stack-Based Buffer Overflow |
CWE-122 | Heap-Based Buffer Overflow |
CWE-124 | Buffer Underwrite (’Buffer Underflow’) |
CWE-126 | Buffer Over-Read |
CWE-127 | Buffer Under-Read |
CWE-129 | Improper Validation of Array Index |
CWE-134 | Use of Externally Controlled Format String |
CWE-190 | Integer Overflow or Wraparound |
CWE-191 | Integer Underflow (Wrap or Wraparound) |
CWE-194 | Unexpected Sign Extension |
CWE-195 | Signed to Unsigned Conversion Error |
CWE-197 | Numeric Truncation Error |
CWE-319 | Cleartext Transmission of Sensitive Information |
CWE-369 | Divide By Zero |
CWE-400 | Uncontrolled Resource Consumption |
CWE-401 | Missing Release of Memory after Effective Lifetime |
CWE-415 | Double Free |
CWE-457 | Use of Uninitialized Variable |
CWE-476 | NULL Pointer Dereference |
CWE-563 | Assignment to Variable without Use |
CWE-590 | Free of Memory Not on the Heap |
CWE-601 | URL Redirection to Untrusted Site (’Open Redirect’) |
CWE-606 | Unchecked Input for Loop Condition |
CWE-643 | Improper Neutralization of Data within XPath Expressions (’XPath Injection’) |
CWE-690 | Unchecked Return Value to NULL Pointer Dereference |
CWE-762 | Mismatched Memory Management Routines |
CWE-789 | Memory Allocation with Excessive Size Value |
C/C++ | C# | Java | PHP |
---|---|---|---|
alloca function | Arithmetic operator | Arithmetic operator | db2_exec function |
arithmetic operator | Array.Length property | BufferedWriter.write method | db2_prepare function |
calloc function | Cast operator | Cast operator | echo statement |
cast operator | DbConnection.ConnectionString property | Connection.setCatalog method | eval function |
CreateFileA function | Declaration statement | Declaration statement | exit function |
CreateFileW function | DirectorySearcher.FindOne method | DriverManager.getConnection method | header function |
delete keyword | For statement | File constructor | http_redirect function |
_execl function | HttpResponse.AddHeader method | FileOutputStream.write method | ldap_search function |
_execlp function | HttpResponse.AppendCookie method | For statement | mysqli_multi_query function |
_execv function | HttpResponse.Redirect method | HttpServletResponse.addCookie method | mysqli_real_query function |
_execvp function | HttpResponse.Write method | HttpServletResponse.addHeader method | mysqli_stmt_execute function |
fopen function | Logical AND operator | HttpServletResponse.getWriter method | mysql_query function |
for statement | Math.Sqrt method | HttpServletResponse.sendRedirect method | PDO.prepare method |
fprintf function | New operator | HttpServletResponse.setHeader method | PDO.query method |
free function | Object.Equals method | InitialDirContext.search method | pg_query function |
ifstream.open method | Object.ToString method | KerberosKey constructor | pg_send_query function |
ldap_search_ext_sA function | Process.Start method | Math.sqrt method | printf function |
ldap_search_ext_sW function | SecureString.AppendChar method | Method parameter | print function |
LogonUserA function | SqlCommand.ExecuteNonQuery method | New operator | require statement |
LogonUserW function | SqlCommand.ExecuteScalar method | Object.equals method | SimpleXMLElement.xpath method |
loop statement | SqlConnection constructor | PasswordAuthentication constructor | SQLite3.query method |
malloc function | SslStream.Write method | PrintWriter.println method | sqlsrv_execute function |
memcpy function | StreamReader constructor | Runtime.exec method | sqlsrv_query function |
memmove function | StreamWriter.WriteLine method | Statement.executeBatch method | system function |
new keyword | String.Format method | Statement.execute method | trigger_error function |
ofstream.open method | String.Length property | Statement.executeQuery method | user_error function |
open function | String.Trim method | Statement.executeUpdate method | vprintf function |
popen function | Subscript operator | String.trim method | |
SetComputerNameA function | Thread.Sleep method | Subscript operator | |
sizeof function | XPathNavigator.Evaluate method | System.out.format method | |
sleep function | System.out.printf method | ||
snprintf function | Thread.sleep method | ||
_spawnl function | XPath.evaluate method | ||
_spawnlp function | |||
_spawnv function | |||
_spawnvp function | |||
strcat function | |||
strcpy function | |||
strncat function | |||
strncpy function | |||
subscript operator | |||
swprintf function | |||
system function | |||
variable declaration statement | |||
vfprintf function | |||
vsnprintf function | |||
wcscat function | |||
wcscpy function | |||
wcsncat function | |||
wcsncpy function | |||
_wexecl function | |||
_wexeclp function | |||
_wexecv function | |||
_wexecvp function | |||
_wspawnl function | |||
_wspawnlp function | |||
_wspawnv function | |||
_wspawnvp function |
Samples | Non-Vulnerable | Vulnerable | C | C# | C++ | Java | PHP | |
---|---|---|---|---|---|---|---|---|
CWE-015 | 2065 | 1205 | 860 | 91 | 890 | 16 | 1068 | 0 |
CWE-023 | 7308 | 4194 | 3114 | 0 | 890 | 5350 | 1068 | 0 |
CWE-036 | 7308 | 4194 | 3114 | 0 | 890 | 5350 | 1068 | 0 |
CWE-078 | 15,154 | 9116 | 6038 | 9100 | 890 | 1600 | 1068 | 2496 |
CWE-079 | 163,674 | 135,823 | 27,851 | 0 | 0 | 0 | 0 | 163,674 |
CWE-080 | 3204 | 1872 | 1332 | 0 | 1602 | 0 | 1602 | 0 |
CWE-089 | 114,403 | 91,391 | 23,012 | 0 | 3753 | 0 | 8340 | 102,310 |
CWE-090 | 6868 | 3482 | 3386 | 910 | 890 | 160 | 1068 | 3840 |
CWE-091 | 6012 | 4748 | 1264 | 0 | 0 | 0 | 0 | 6012 |
CWE-098 | 3264 | 2592 | 672 | 0 | 0 | 0 | 0 | 3264 |
CWE-113 | 8757 | 6426 | 2331 | 0 | 3753 | 0 | 5004 | 0 |
CWE-121 | 11,863 | 6997 | 4866 | 10,015 | 0 | 1848 | 0 | 0 |
CWE-122 | 14,064 | 8384 | 5680 | 6377 | 0 | 7687 | 0 | 0 |
CWE-124 | 4996 | 3000 | 1996 | 3382 | 0 | 1614 | 0 | 0 |
CWE-126 | 3690 | 2274 | 1416 | 2664 | 0 | 1026 | 0 | 0 |
CWE-127 | 4996 | 3000 | 1996 | 3382 | 0 | 1614 | 0 | 0 |
CWE-129 | 18,626 | 13,668 | 4958 | 0 | 8618 | 0 | 10,008 | 0 |
CWE-134 | 14,318 | 10,404 | 3914 | 8430 | 1946 | 1440 | 2502 | 0 |
CWE-190 | 43,822 | 32,052 | 11,770 | 12,780 | 13,761 | 1296 | 15,985 | 0 |
CWE-191 | 32,552 | 23,820 | 8732 | 9798 | 9174 | 792 | 12,788 | 0 |
CWE-194 | 2568 | 1464 | 1104 | 2184 | 0 | 384 | 0 | 0 |
CWE-195 | 2568 | 1464 | 1104 | 2184 | 0 | 384 | 0 | 0 |
CWE-197 | 16,878 | 9834 | 7044 | 1638 | 12,015 | 288 | 2937 | 0 |
CWE-319 | 2610 | 1908 | 702 | 568 | 556 | 96 | 1390 | 0 |
CWE-369 | 15,776 | 11,544 | 4232 | 2556 | 5838 | 432 | 6950 | 0 |
CWE-400 | 12,545 | 9174 | 3371 | 2130 | 4587 | 360 | 5468 | 0 |
CWE-401 | 5770 | 4154 | 1616 | 3134 | 0 | 2636 | 0 | 0 |
CWE-415 | 3320 | 2400 | 920 | 852 | 0 | 2468 | 0 | 0 |
CWE-457 | 3956 | 3010 | 946 | 2408 | 0 | 1548 | 0 | 0 |
CWE-476 | 2613 | 1869 | 744 | 963 | 694 | 262 | 694 | 0 |
CWE-563 | 2859 | 1961 | 898 | 1158 | 699 | 294 | 708 | 0 |
CWE-590 | 6231 | 3551 | 2680 | 1458 | 0 | 4773 | 0 | 0 |
CWE-601 | 6402 | 3144 | 3258 | 0 | 801 | 0 | 801 | 4800 |
CWE-606 | 4718 | 3444 | 1274 | 1420 | 1390 | 240 | 1668 | 0 |
CWE-643 | 3058 | 2244 | 814 | 0 | 1390 | 0 | 1668 | 0 |
CWE-690 | 3808 | 2444 | 1364 | 1820 | 556 | 320 | 1112 | 0 |
CWE-762 | 12,284 | 8880 | 3404 | 0 | 0 | 12,284 | 0 | 0 |
CWE-789 | 10,356 | 6516 | 3840 | 1420 | 3251 | 1900 | 3785 | 0 |
Hyperparameter | Value |
---|---|
Max. graphs per batch | 128 |
Add self loop edges | True |
Tie forward/backward edges | True |
GNN aggregation function | sum |
GNN message activation function | ReLU |
GNN hidden dim | 256 |
GNN number of edge MLP hidden layers | 1 |
GNN initial node representation activation | tanh |
GNN dense intermediate layer activation | tanh |
GNN number of layers | 5 |
GNN dense every num layers MLP hidden layers | 10,000 |
GNN residual every number of layers | 2 |
GNN layer input dropout rate | 0.2 |
GNN global exchange mode | gru |
GNN global exchange every num layers | 10,000 |
GNN global exchange number of heads | 4 |
GNN global exchange dropout rate | 0.2 |
Optimizer | Adam |
Learning rate | 0.001 |
Graph aggregation number of heads | 16 |
Graph aggregation hidden layers | 128 |
Graph aggregation dropout rate | 0.2 |
Hyperparameter | Value |
---|---|
Max. graphs per batch | 256 |
Add self loop edges | False |
Tie forward/backward edges | False |
GNN aggregation function | sum |
GNN message activation function | ReLU |
GNN hidden dim | 64 |
GNN number of edge MLP hidden layers | 0 |
GNN initial node representation activation | tanh |
GNN dense intermediate layer activation | tanh |
GNN number of layers | 7 |
GNN dense every num layers MLP hidden layers | 5 |
GNN residual every number of layers | 2 |
GNN layer input dropout rate | 0.0 |
GNN global exchange mode | gru |
GNN global exchange every num layers | 10,000 |
GNN global exchange number of heads | 4 |
GNN global exchange dropout rate | 0.2 |
Optimizer | Adam |
Learning rate | 0.0001 |
Graph aggregation number of heads | 8 |
Graph aggregation hidden layers | [32, 32] |
Graph aggregation dropout rate | 0.1 |
CWE-015 | CWE-023 | CWE-036 | CWE-078 | CWE-079 | CWE-080 | CWE-089 | CWE-090 | CWE-091 | CWE-098 | CWE-113 | CWE-121 | CWE-122 | CWE-124 | CWE-126 | CWE-127 | CWE-129 | CWE-134 | CWE-190 | CWE-191 | CWE-194 | CWE-195 | CWE-197 | CWE-319 | CWE-369 | CWE-400 | CWE-401 | CWE-415 | CWE-457 | CWE-476 | CWE-563 | CWE-590 | CWE-601 | CWE-606 | CWE-643 | CWE-690 | CWE-762 | CWE-789 | Non-Vuln. | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CWE-015 | 86.0 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-023 | - | 311.4 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-036 | - | - | 311.4 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-078 | - | - | - | 603.8 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-079 | - | - | - | - | 2784.9 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 0.2 |
CWE-080 | - | - | - | - | - | 133.2 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-089 | - | - | - | - | - | - | 2301.2 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-090 | - | - | - | - | - | - | - | 338.6 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-091 | - | - | - | - | - | - | - | - | 126.4 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-098 | - | - | - | - | - | - | - | - | - | 67.2 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-113 | - | - | - | - | - | - | - | - | - | - | 233.1 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-121 | - | - | - | - | - | - | - | - | - | - | - | 486.5 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 0.1 |
CWE-122 | - | - | - | - | - | - | - | - | - | - | - | - | 567.8 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 0.2 |
CWE-124 | - | - | - | - | - | - | - | - | - | - | - | - | - | 199.6 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-126 | 0.1 | - | - | - | - | - | - | - | - | - | - | - | - | - | 141.5 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-127 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 199.6 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-129 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 495.7 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 0.1 |
CWE-134 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 391.4 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-190 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 1071.0 | 106.0 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-191 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 32.6 | 840.6 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-194 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 110.4 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-195 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 110.4 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-197 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 704.4 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-319 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 70.0 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 0.2 |
CWE-369 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 423.2 | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-400 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 337.1 | - | - | - | - | - | - | - | - | - | - | - | - | - |
CWE-401 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 161.4 | - | 0.1 | - | - | - | - | - | - | - | - | - | 0.1 |
CWE-415 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 92.0 | - | - | - | - | - | - | - | - | - | - | - |
CWE-457 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 94.6 | - | - | - | - | - | - | - | - | - | - |
CWE-476 | 0.2 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 73.9 | - | - | - | - | - | - | - | - | 0.3 |
CWE-563 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 89.3 | - | - | - | - | 0.1 | - | - | 0.4 |
CWE-590 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 268.0 | - | - | - | - | - | - | - |
CWE-601 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 325.8 | - | - | - | - | - | - |
CWE-606 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 127.4 | - | - | - | - | - |
CWE-643 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 81.4 | - | - | - | - |
CWE-690 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 135.7 | - | - | 0.7 |
CWE-762 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 276.7 | - | 63.7 |
CWE-789 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 383.9 | 0.1 |
Non-vuln. | 0.1 | - | - | - | - | - | 3.3 | - | - | - | 2.7 | 0.2 | 161.5 | - | - | - | 6.2 | 1.4 | 9.9 | 6.6 | - | - | - | 0.4 | 4.2 | 3.3 | 0.1 | - | 0.2 | 0.8 | 0.1 | - | 0.1 | 1 | 1 | 7.8 | - | 0.1 | 44,553.7 |
References
- Building Security in Maturity Model (BSIMM) Report 14. 2023. Available online: https://www.blackduck.com/resources/analyst-reports/bsimm.html (accessed on 15 December 2024).
- Avgustinov, P.; De Moor, O.; Jones, M.P.; Schäfer, M. QL: Object-oriented queries on relational data. In Proceedings of the 30th European Conference on Object-Oriented Programming (ECOOP 2016), Rome, Italy, 17–22 July 2016; pp. 2:1–2:26. [Google Scholar]
- Li, Z.; Liu, Z.; Wong, W.K.; Ma, P.; Wang, S. Evaluating C/C++ Vulnerability Detectability of Query-Based Static Application Security Testing Tools. IEEE Trans. Dependable Secur. Comput. 2024, 21, 4600–4618. [Google Scholar] [CrossRef]
- Chess, B.; West, J. Secure Programming with Static Analysis; Pearson Education: London, UK, 2007. [Google Scholar]
- Rajapakse, R.N.; Zahedi, M.; Babar, M.A.; Shen, H. Challenges and solutions when adopting DevSecOps: A systematic review. Inf. Softw. Technol. 2022, 141, 106700. [Google Scholar] [CrossRef]
- Russell, R.; Kim, L.; Hamilton, L.; Lazovich, T.; Harer, J.; Ozdemir, O.; Ellingwood, P.; McConley, M. Automated Vulnerability Detection in Source Code using Deep Representation Learning. In Proceedings of the 2018 17th IEEE International Conference on Machine Learning and Applications (ICMLA), Orlando, FL, USA, 17–20 December 2018; IEEE: Piscataway, NJ, USA, 2018; pp. 757–762. [Google Scholar]
- Li, Z.; Zou, D.; Xux, S.; Ou, X.; Jin, H.; Wang, S.; Deng, Z.; Zhong, Y. VulDeepecker: A Deep Learning-Based System for Vulnerability Detection. In Proceedings of the Network and Distributed Systems Security (NDSS) Symposium, San Diego, CA, USA, 18–21 February 2018. [Google Scholar]
- Zhou, Y.; Liu, S.; Siow, J.; Du, X.; Liu, Y. Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networks. In Proceedings of the 33rd International Conference on Neural Information Processing Systems, Vancouver, BC, Canada, 8–14 December 2019; pp. 10197–10207. [Google Scholar]
- Zou, D.; Wang, S.; Xu, S.; Li, Z.; Jin, H. μVulDeePecker: A Deep Learning-Based System for Multiclass Vulnerability Detection. IEEE Trans. Dependable Secur. Comput. 2021, 18, 2224–2236. [Google Scholar] [CrossRef]
- Li, Z.; Zou, D.; Xu, S.; Jin, H.; Zhu, Y.; Chen, Z. SySeVR: A Framework for Using Deep Learning to Detect Software Vulnerabilities. IEEE Trans. Dependable Secur. Comput. 2021, 19, 2244–2258. [Google Scholar] [CrossRef]
- Wang, H.; Ye, G.; Tang, Z.; Tan, S.H.; Huang, S.; Fang, D.; Feng, Y.; Bian, L.; Wang, Z. Combining Graph-based Learning with Automated Data Collection for Code Vulnerability Detection. IEEE Trans. Inf. Forensics Secur. 2021, 16, 1943–1958. [Google Scholar] [CrossRef]
- Wu, Z.; Pan, S.; Chen, F.; Long, G.; Zhang, C.; Yu, P.S. A Comprehensive Survey on Graph Neural Networks. IEEE Trans. Neural Netw. Learn. Syst. 2021, 32, 4–24. [Google Scholar] [CrossRef] [PubMed]
- de Kraker, W.; Vranken, H.; Hommersom, A. GLICE: Combining Graph Neural Networks and Program Slicing to Improve Software Vulnerability Detection. In Proceedings of the 2023 IEEE European Symposium on Security and Privacy Workshops (EuroS&PW), Delft, The Netherlands, 3–7 July 2023; pp. 34–41. [Google Scholar]
- Shiri Harzevili, N.; Boaye Belle, A.; Wang, J.; Wang, S.; Jiang, Z.M.; Nagappan, N. A Systematic Literature Review on Automated Software Vulnerability Detection Using Machine Learning. ACM Comput. Surv. 2024, 57, 1–36. [Google Scholar] [CrossRef]
- Liang, C.; Wei, Q.; Du, J.; Wang, Y.; Jiang, Z. Survey of source code vulnerability analysis based on deep learning. Comput. Secur. 2025, 148, 104098. [Google Scholar] [CrossRef]
- Sharma, T.; Kechagia, M.; Georgiou, S.; Tiwari, R.; Vats, I.; Moazen, H.; Sarro, F. A survey on machine learning techniques applied to source code. J. Syst. Softw. 2024, 209, 111934. [Google Scholar] [CrossRef]
- Fang, C.; Miao, N.; Srivastav, S.; Liu, J.; Zhang, R.; Fang, R.; Tsang, R.; Nazari, N.; Wang, H.; Homayoun, H.; et al. Large Language Models for Code Analysis: Do {LLMs} Really Do Their Job? In Proceedings of the 33rd USENIX Security Symposium (USENIX Security 24), Philadelphia, PA, USA, 14–16 August 2024; pp. 829–846. [Google Scholar]
- Ullah, S.; Han, M.; Pujar, S.; Pearce, H.; Coskun, A.; Stringhini, G. LLMs Cannot Reliably Identify and Reason About Security Vulnerabilities (Yet?): A Comprehensive Evaluation, Framework, and Benchmarks. In Proceedings of the IEEE Symposium on Security and Privacy, San Francisco, CA, USA, 19–23 May 2024. [Google Scholar]
- Zhang, C.; Liu, H.; Zeng, J.; Yang, K.; Li, Y.; Li, H. Prompt-enhanced software vulnerability detection using ChatGPT. In Proceedings of the 2024 IEEE/ACM 46th International Conference on Software Engineering: Companion Proceedings, Lisbon, Portugal, 14–20 April 2024; pp. 276–277. [Google Scholar]
- Zhou, X.; Zhang, T.; Lo, D. Large Language Model for Vulnerability Detection: Emerging Results and Future Directions. In Proceedings of the IEEE/ACM International Conference on Software Engineering: New Ideas and Emerging Results (ICSENIER), Lisbon, Portugal, 14–20 April 2024; pp. 47–51. [Google Scholar]
- Weiser, M. Program Slicing. IEEE Trans. Softw. Eng. 1984, SE-10, 352–357. [Google Scholar] [CrossRef]
- Ottenstein, K.J.; Ottenstein, L.M. The program dependence graph in a software development environment. ACM Sigplan Not. 1984, 19, 177–184. [Google Scholar] [CrossRef]
- Horwitz, S.; Reps, T.; Binkley, D. Interprocedural Slicing using Dependence Graphs. ACM Trans. Program. Lang. Syst. (TOPLAS) 1990, 12, 26–60. [Google Scholar] [CrossRef]
- Ye, G.; Tang, Z.; Wang, H.; Fang, D.; Fang, J.; Huang, S.; Wang, Z. Deep Program Structure Modeling Through Multi-Relational Graph-based Learning. In Proceedings of the ACM International Conference on Parallel Architectures and Compilation Techniques (PACT ’20), Atlanta, GA, USA, 3–7 October 2020; Association for Computing Machinery: New York, NY, USA, 2020; pp. 111–123. [Google Scholar]
- Li, Y.; Tarlow, D.; Brockschmidt, M.; Zemel, R. Gated graph sequence neural networks. In Proceedings of the International Conference on Learning Representations, San Juan, Puerto Rico, 2–4 May 2016. [Google Scholar]
- Cho, K.; van Merrienboer, B.; Gulcehre, C.; Bahdanau, D.; Bougares, F.; Schwenk, H.; Bengio, Y. Learning Phrase Representations using RNN Encoder–Decoder for Statistical Machine Translation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), Doha, Qatar, 25–29 October 2014; Association for Computational Linguistics: Stroudsburg, PA, USA, 2014; pp. 1724–1734. [Google Scholar]
- Mikolov, T.; Yih, W.t.; Zweig, G. Linguistic Regularities in Continuous Space Word Representations. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human language Technologies, Atlanta, GA, USA, 9–15 June 2013; pp. 746–751. [Google Scholar]
- Bergstra, J.; Bardenet, R.; Bengio, Y.; Kégl, B. Algorithms for hyper-parameter optimization. In Proceedings of the 2011 25th International Conference on Neural Information Processing Systems (NIPS), Granada, Spain, 12–15 December 2011; Curran Associates, Inc.: Red Hook, NY, USA, 2011; pp. 2546–2554. [Google Scholar]
- Agarwal, C.; Zitnik, M.; Lakkaraju, H. Probing GNN Explainers: A Rigorous Theoretical and Empirical Analysis of GNN Explanation Methods. In Proceedings of the 25th International Conference on Artificial Intelligence and Statistics, Valencia, Spain, 28–30 March 2022; pp. 8969–8996. [Google Scholar]
Model | Details |
---|---|
Original FUNDED | The model introduced by Wang et al. [11], which applies a GNN model for vulnerability detection in single functions. |
Improved FUNDED | Our improved version of the original FUNDED model, in which we resolved bugs and improved the embedding strategy [13]. |
GLICE | Our previous model that combines the improved FUNDED model with inter-procedural program slicing. We trained and evaluated GLICE for two types of vulnerabilities in C/C++ program code [13]. |
MultiGLICE | Our present model that extends GLICE with multiclass detection. We train and evaluate MultiGLICE for 38 types of vulnerabilities in C/C++, C#, Java, and PHP program code. |
Name | Author | Language |
---|---|---|
PHP Vulnerability Test Suite | Bertrand C. Stivalet | PHP |
Juliet C# 1.3 | NSA Center for Assured Software | C# |
Juliet Java 1.3 | NSA Center for Assured Software | Java |
Juliet C/C++ 1.3 | NSA Center for Assured Software | C++ |
PHP test suite—XSS, SQLi 1.0.0 | Schuckert, Langweg, and Katt | PHP |
Metric | C | C# | C++ | Java | PHP | Total |
---|---|---|---|---|---|---|
Number of samples | 92,822 | 78,834 | 58,462 | 88,750 | 286,396 | 605,264 |
Percentage | 15% | 13% | 10% | 15% | 47% | 100% |
Metric | Formula |
---|---|
Precision | |
Recall | |
F1-score | |
Accuracy |
Metric | Original FUNDED | Improved FUNDED |
---|---|---|
Precision | 0.7912 | 0.8286 |
Recall | 0.9463 | 0.9619 |
F1-score | 0.8618 | 0.8902 |
Accuracy | 0.8482 | 0.8814 |
Metric | 0 | 1 | 2 | 3 | 4 |
---|---|---|---|---|---|
Micro F1-score | 0.8742 | 0.9666 | 0.9842 | 0.9886 | 0.9931 |
Weighted precision | 0.9417 | 0.9826 | 0.9863 | 0.9900 | 0.9940 |
Weighted F1-score | 0.9009 | 0.9733 | 0.9847 | 0.9889 | 0.9932 |
Macro recall | 0.8679 | 0.9633 | 0.9850 | 0.9877 | 0.9912 |
Macro precision | 0.7323 | 0.9201 | 0.9442 | 0.9632 | 0.9867 |
Macro F1-score | 0.7724 | 0.9294 | 0.9612 | 0.9735 | 0.9881 |
Maximum Depth | #Samples | %Samples |
---|---|---|
0 | 446,391 | 73.75% |
1 | 131,094 | 21.65% |
2 | 14,863 | 2.56% |
3 | 6628 | 1.10% |
4 | 6288 | 1.04% |
Sample Depth | Target Depth 0 | Target Depth 1 | Target Depth 2 | Target Depth 3 | Target Depth 4 |
---|---|---|---|---|---|
0 | 0.9960 | 0.9962 | 0.9962 | 0.9962 | 0.9962 |
1 | 0.6043 | 0.9838 | 0.9836 | 0.9839 | 0.9837 |
2 | 0.3270 | 0.3259 | 0.9943 | 0.9942 | 0.9939 |
3 | 0.5801 | 0.5759 | 0.5852 | 0.9869 | 0.9868 |
4 | 0.5620 | 0.5627 | 0.5641 | 0.5556 | 0.9872 |
Vuln. Type | Depth 0 | Depth 1 | Depth 2 | Depth 3 | Depth 4 |
---|---|---|---|---|---|
CWE-015 | 0.0484 | 0.1567 | 0.6370 | 0.7692 | 1 |
CWE-023 | 0.6631 | 0.9688 | 0.9755 | 0.9823 | 1 |
CWE-036 | 0.6667 | 0.9561 | 0.9739 | 0.9854 | 1 |
CWE-078 | 0.7857 | 0.9639 | 0.9781 | 0.9869 | 1 |
CWE-079 | 0.9787 | 0.9849 | 0.9998 | 0.9998 | 1 |
CWE-080 | 0.7961 | 0.9433 | 0.9814 | 0.9925 | 1 |
CWE-089 | 0.9601 | 0.9898 | 0.9942 | 0.9955 | 0.9987 |
CWE-090 | 0.8225 | 0.9153 | 0.9855 | 0.9956 | 1 |
CWE-091 | 0.8649 | 0.8850 | 1 | 1 | 1 |
CWE-098 | 0.8142 | 0.8833 | 1 | 1 | 1 |
CWE-113 | 0.7818 | 0.9628 | 0.9729 | 0.9852 | 0.9915 |
CWE-121 | 0.7688 | 0.9688 | 0.9707 | 0.9785 | 1 |
CWE-122 | 0.7445 | 0.8554 | 0.8668 | 0.8743 | 0.8806 |
CWE-124 | 0.6748 | 0.9531 | 0.9412 | 0.9682 | 1 |
CWE-126 | 0.8232 | 0.9498 | 0.9860 | 0.9965 | 1 |
CWE-127 | 0.7897 | 0.9732 | 0.9852 | 0.9877 | 1 |
CWE-129 | 0.7758 | 0.9528 | 0.9668 | 0.9821 | 0.9950 |
CWE-134 | 0.7119 | 0.9276 | 0.9702 | 0.9824 | 0.9974 |
CWE-190 | 0.7526 | 0.9014 | 0.9203 | 0.9196 | 0.9338 |
CWE-191 | 0.7290 | 0.8888 | 0.8927 | 0.9068 | 0.9243 |
CWE-194 | 0.7591 | 0.9483 | 0.9643 | 0.9821 | 1 |
CWE-195 | 0.7765 | 0.9694 | 0.9623 | 1 | 1 |
CWE-197 | 0.8044 | 0.9617 | 0.9751 | 0.9895 | 1 |
CWE-319 | 0.7836 | 0.9790 | 0.9459 | 0.9722 | 0.9929 |
CWE-369 | 0.7680 | 0.9602 | 0.9735 | 0.9814 | 0.9930 |
CWE-400 | 0.7835 | 0.9656 | 0.9657 | 0.9769 | 0.9941 |
CWE-401 | 0.7673 | 0.9527 | 0.9877 | 1 | 1 |
CWE-415 | 0.6351 | 0.9663 | 0.9836 | 1 | 1 |
CWE-457 | 0.9010 | 1 | 1 | 1 | 1 |
CWE-476 | 0.7886 | 0.9933 | 0.9677 | 0.9600 | 0.9799 |
CWE-563 | 0.8791 | 0.9888 | 0.9944 | 0.9944 | 1 |
CWE-590 | 0.7900 | 0.9729 | 0.9835 | 0.9853 | 1 |
CWE-601 | 0.8411 | 0.9198 | 0.9985 | 1 | 1 |
CWE-606 | 0.7541 | 0.9734 | 0.9734 | 0.9808 | 0.9922 |
CWE-643 | 0.7565 | 0.9425 | 0.9701 | 0.9878 | 0.9939 |
CWE-690 | 0.8867 | 0.9712 | 0.9643 | 0.9714 | 0.9712 |
CWE-762 | 0.5580 | 0.8366 | 0.8705 | 0.8967 | 0.9068 |
CWE-789 | 0.7862 | 0.9552 | 0.9746 | 0.9897 | 1 |
Non-vuln. | 0.9277 | 0.9821 | 0.9915 | 0.9943 | 0.9970 |
Metric | FUNDED Original | FUNDED Improved | MultiGLICE Depth 4 |
---|---|---|---|
Micro F1-score | 0.7194 | 0.8742 | 0.9931 |
Weighted precision | 0.8576 | 0.9417 | 0.9940 |
Weighted F1-score | 0.7641 | 0.9009 | 0.9932 |
Macro recall | 0.7944 | 0.8679 | 0.9912 |
Macro precision | 0.6651 | 0.7323 | 0.9867 |
Macro F1-score | 0.6940 | 0.7724 | 0.9881 |
MultiGLICE | |||||
---|---|---|---|---|---|
FUNDED Original | Target Depth 0 | Target Depth 1 | Target Depth 2 | Target Depth 3 | Target Depth 4 |
1727.24 | 3263.41 | 2525.63 | 2522.94 | 2457.84 | 2442.17 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
de Kraker, W.; Vranken, H.; Hommersom, A. MultiGLICE: Combining Graph Neural Networks and Program Slicing for Multiclass Software Vulnerability Detection. Computers 2025, 14, 98. https://doi.org/10.3390/computers14030098
de Kraker W, Vranken H, Hommersom A. MultiGLICE: Combining Graph Neural Networks and Program Slicing for Multiclass Software Vulnerability Detection. Computers. 2025; 14(3):98. https://doi.org/10.3390/computers14030098
Chicago/Turabian Stylede Kraker, Wesley, Harald Vranken, and Arjen Hommersom. 2025. "MultiGLICE: Combining Graph Neural Networks and Program Slicing for Multiclass Software Vulnerability Detection" Computers 14, no. 3: 98. https://doi.org/10.3390/computers14030098
APA Stylede Kraker, W., Vranken, H., & Hommersom, A. (2025). MultiGLICE: Combining Graph Neural Networks and Program Slicing for Multiclass Software Vulnerability Detection. Computers, 14(3), 98. https://doi.org/10.3390/computers14030098