Detecting Code Vulnerabilities with Heterogeneous GNN Training | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Research Article Detecting Code Vulnerabilities with Heterogeneous GNN Training Yu Luo, Weifeng Xu, Dianxiang Xu This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-6397101/v1 This work is licensed under a CC BY 4.0 License Status: Published Journal Publication published 20 Sep, 2025 Read the published version in International Journal of Information Security → Version 1 posted 10 You are reading this latest preprint version Abstract Detecting vulnerabilities in source code is a critical task for software security assurance. Graph Neural Network (GNN) machine learning can be a promising approach by modeling source code as graphs. Early approaches treated code elements uniformly, limiting their capacity to model diverse relationships that contribute to various vulnerabilities. Recent research addresses this limitation by considering the heterogeneity of node types and using Gated Graph Neural Networks (GGNN) to aggregate node information through different edge types. However, these edges primarily function as conduits for passing node information and may not capture detailed characteristics of distinct edge types. This paper presents Inter-Procedural Abstract Graphs (IPAGs) as an efficient, language-agnostic representation of source code, complemented by heterogeneous GNN training for vulnerability prediction. IPAGs capture the structural and contextual properties of code elements and their relationships. We also propose a Heterogeneous Attention GNN (HAGNN) model that incorporates multiple subgraphs capturing different features of source code. These subgraphs are learned separately and combined using a global attention mechanism, followed by a fully connected neural network for final classification. The proposed approach has achieved up to 96.6% accuracy on a large C dataset of 108 vulnerability types and 97.8% on a large Java dataset of 114 vulnerability types, outperforming state-of-the-art methods. Its applications to various real-world software projects have also demonstrated low false positive rates. Full Text Additional Declarations No competing interests reported. Cite Share Download PDF Status: Published Journal Publication published 20 Sep, 2025 Read the published version in International Journal of Information Security → Version 1 posted Editorial decision: Revision requested 29 Jul, 2025 Reviews received at journal 22 Jul, 2025 Reviewers agreed at journal 02 Jul, 2025 Reviews received at journal 15 Jun, 2025 Reviewers agreed at journal 30 May, 2025 Reviewers agreed at journal 18 May, 2025 Reviewers invited by journal 13 May, 2025 Editor assigned by journal 08 Apr, 2025 Submission checks completed at journal 08 Apr, 2025 First submitted to journal 07 Apr, 2025 You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-6397101","acceptedTermsAndConditions":true,"allowDirectSubmit":false,"archivedVersions":[],"articleType":"Research Article","associatedPublications":[],"authors":[{"id":456515449,"identity":"257059c8-2082-4ca8-8e21-84931a07b4a7","order_by":0,"name":"Yu Luo","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAnUlEQVRIiWNgGAWjYFAC5gYGhgoom4c4LYxALWdI1sLYRooWgxuJbRIf5x2W121vYHzwto2wDrAWyZnbDhtuO3OA2XAusVqkebcdTjC7kcAmzUu8ljlgLey/SdDSALGFmSgtkmceNlvOOJYO9MvBZsk554jQwnc8+eCNDzXW8mbHmw9+eFNGhBaFA3AmKE6JAfJEqhsFo2AUjIKRDACeWTnzCpE63QAAAABJRU5ErkJggg==","orcid":"","institution":"University of Central Missouri","correspondingAuthor":true,"prefix":"","firstName":"Yu","middleName":"","lastName":"Luo","suffix":""},{"id":456515450,"identity":"325dc3cb-0c11-4083-871b-25da1fa09957","order_by":1,"name":"Weifeng Xu","email":"","orcid":"","institution":"University of Baltimore","correspondingAuthor":false,"prefix":"","firstName":"Weifeng","middleName":"","lastName":"Xu","suffix":""},{"id":456515451,"identity":"ef109db4-7539-4cc2-b3a4-e5171340e908","order_by":2,"name":"Dianxiang Xu","email":"","orcid":"","institution":"University of Missouri–Kansas City","correspondingAuthor":false,"prefix":"","firstName":"Dianxiang","middleName":"","lastName":"Xu","suffix":""}],"badges":[],"createdAt":"2025-04-07 19:53:15","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-6397101/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-6397101/v1","draftVersion":[],"editorialEvents":[{"content":"https://doi.org/10.1007/s10207-025-01132-x","type":"published","date":"2025-09-20T15:57:42+00:00"}],"editorialNote":"","failedWorkflow":false,"files":[{"id":91889889,"identity":"5c3d1b56-2fe5-4f74-bdd4-507a886b39be","added_by":"auto","created_at":"2025-09-22 16:03:17","extension":"pdf","order_by":1,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":2096750,"visible":true,"origin":"","legend":"","description":"","filename":"InternationalJournalofInformationSecurityV1.pdf","url":"https://assets-eu.researchsquare.com/files/rs-6397101/v1_covered_d5e2bedf-f4b4-4243-ad57-1a9b6497aded.pdf"}],"financialInterests":"No competing interests reported.","formattedTitle":"Detecting Code Vulnerabilities with Heterogeneous GNN Training","fulltext":[],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":false,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":false,"hideJournal":false,"highlight":"","institution":"","isAcceptedByJournal":true,"isAuthorSuppliedPdf":true,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":true,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"
[email protected]","identity":"international-journal-of-information-security","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":false,"externalIdentity":"ijis","sideBox":"Learn more about [International Journal of Information Security](http://link.springer.com/journal/10207)","snPcode":"10207","submissionUrl":"https://submission.nature.com/new-submission/10207/3","title":"International Journal of Information Security","twitterHandle":"","acdcEnabled":true,"dfaEnabled":true,"editorialSystem":"em","reportingPortfolio":"Springer Hybrid","inReviewEnabled":true,"inReviewRevisionsEnabled":false},"keywords":"","lastPublishedDoi":"10.21203/rs.3.rs-6397101/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-6397101/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"Detecting vulnerabilities in source code is a critical task for software security assurance. Graph Neural Network (GNN) machine learning can be a promising approach by modeling source code as graphs. Early approaches treated code elements uniformly, limiting their capacity to model diverse relationships that contribute to various vulnerabilities. Recent research addresses this limitation by considering the heterogeneity of node types and using Gated Graph Neural Networks (GGNN) to aggregate node information through different edge types. However, these edges primarily function as conduits for passing node information and may not capture detailed characteristics of distinct edge types. This paper presents Inter-Procedural Abstract Graphs (IPAGs) as an efficient, language-agnostic representation of source code, complemented by heterogeneous GNN training for vulnerability prediction. IPAGs capture the structural and contextual properties of code elements and their relationships. We also propose a Heterogeneous Attention GNN (HAGNN) model that incorporates multiple subgraphs capturing different features of source code. These subgraphs are learned separately and combined using a global attention mechanism, followed by a fully connected neural network for final classification. The proposed approach has achieved up to 96.6% accuracy on a large C dataset of 108 vulnerability types and 97.8% on a large Java dataset of 114 vulnerability types, outperforming state-of-the-art methods. Its applications to various real-world software projects have also demonstrated low false positive rates.","manuscriptTitle":"Detecting Code Vulnerabilities with Heterogeneous GNN Training","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2025-05-16 07:55:01","doi":"10.21203/rs.3.rs-6397101/v1","editorialEvents":[{"type":"communityComments","content":0},{"type":"decision","content":"Revision requested","date":"2025-07-29T07:45:52+00:00","index":"","fulltext":""},{"type":"editorInvitedReview","content":"","date":"2025-07-22T07:03:06+00:00","index":"hide","fulltext":""},{"type":"reviewerAgreed","content":"274693882592143517602646707336505634878","date":"2025-07-02T23:47:30+00:00","index":"hide","fulltext":""},{"type":"editorInvitedReview","content":"","date":"2025-06-15T23:46:50+00:00","index":"hide","fulltext":""},{"type":"reviewerAgreed","content":"159820017337692755220172131207921271616","date":"2025-05-30T06:38:16+00:00","index":"hide","fulltext":""},{"type":"reviewerAgreed","content":"25804565674961543502008226943508142511","date":"2025-05-18T14:02:58+00:00","index":"hide","fulltext":""},{"type":"reviewersInvited","content":"","date":"2025-05-13T10:50:31+00:00","index":"","fulltext":""},{"type":"editorAssigned","content":"","date":"2025-04-08T14:23:44+00:00","index":"","fulltext":""},{"type":"checksComplete","content":"","date":"2025-04-08T14:19:01+00:00","index":"","fulltext":""},{"type":"submitted","content":"International Journal of Information Security","date":"2025-04-07T19:46:08+00:00","index":"","fulltext":""}],"status":"published","journal":{"display":true,"email":"
[email protected]","identity":"international-journal-of-information-security","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":false,"externalIdentity":"ijis","sideBox":"Learn more about [International Journal of Information Security](http://link.springer.com/journal/10207)","snPcode":"10207","submissionUrl":"https://submission.nature.com/new-submission/10207/3","title":"International Journal of Information Security","twitterHandle":"","acdcEnabled":true,"dfaEnabled":true,"editorialSystem":"em","reportingPortfolio":"Springer Hybrid","inReviewEnabled":true,"inReviewRevisionsEnabled":false}}],"origin":"","ownerIdentity":"913bc1f3-cb3e-4fbe-ac9a-affce48ffc37","owner":[],"postedDate":"May 16th, 2025","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"published-in-journal","subjectAreas":[],"tags":[],"updatedAt":"2025-09-22T16:01:33+00:00","versionOfRecord":{"articleIdentity":"rs-6397101","link":"https://doi.org/10.1007/s10207-025-01132-x","journal":{"identity":"international-journal-of-information-security","isVorOnly":false,"title":"International Journal of Information Security"},"publishedOn":"2025-09-20 15:57:42","publishedOnDateReadable":"September 20th, 2025"},"versionCreatedAt":"2025-05-16 07:55:01","video":"","vorDoi":"10.1007/s10207-025-01132-x","vorDoiUrl":"https://doi.org/10.1007/s10207-025-01132-x","workflowStages":[]},"version":"v1","identity":"rs-6397101","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-6397101","identity":"rs-6397101","version":["v1"]},"buildId":"8U1c8b4HqxoKbykW_rLl7","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}
Text is read by the "Ask this paper" AI Q&A widget below.
Extraction quality varies by source — PMC NXML preserves structure
cleanly, OA-HTML may include some navigation residue, and OA-PDF can
have broken hyphenation. The publisher copy
(via DOI)
is the canonical version.