IP Library Granted Patent US 12,373,575
Granted Patent B2
US 12,373,575 · App. 18/174,135 · Granted Jul 29, 2025

Vulnerability reduction for syntactically incomplete code

Inventors: Alexander Winthrop Helyar (Redmond, WA); Aaron Yue-Chiu Chan (Provo, UT); Roshanak Zilouchian Moghaddam (Kirkland, WA); Eslam Kamal Abdelreheem (Sammamish, WA); Yevhen Mohylevskyy (Redmond, WA); Mohamed Ali Mohamed Elkamhawy (Redmond, WA); Ahmed Ezzat Abdelgawad Magooda (Redmond, WA); Kyle P. Jackson (Shoreline, WA)
Assignee: Microsoft Technology Licensing, LLC
G06F21/577G06F2221/033
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,373,575
App. No.
18/174,135
Granted
Jul 29, 2025
Kind
B2
Abstract

Example solutions performing software code vulnerability reduction. An input code portion is extracted from input software code. The input code portion may be syntactically incomplete and/or syntactically incorrect. A code vulnerability is detected in the input code portion. A correction of the code vulnerability is made, and an output code portion is generated including the correction. In some examples, a code vulnerability detection tool takes, as input, the output from a code completion tool. The output is thus annotated or corrected in real-time, as a user is developing the code.

Claims (47)

1. A system comprising:

a processor; and

a computer-readable medium storing instructions that are operative upon execution by the processor to:

receive input software code from a development environment;

extract an input code portion at least by applying a sliding window to the input software code, the sliding window having a sliding window length;

detect a code vulnerability within the input code portion using a machine learning (ML) model trained on a code segment having a length equal to the sliding window length, the code segment having a dependency external to the code segment,

the ML model having an input layer having a size equal to the sliding window length, and

the ML model having an output layer having a size based on a number of different vulnerability classes;

generate, from the input code portion and the detection of the code vulnerability, an output code portion containing a correction of the code vulnerability; and

send the output code portion to the development environment.

2. The system of claim 1 , wherein the sliding window has a length of 50 or fewer characters.

3. The system of claim 1 , wherein the input code portion is syntactically incomplete.

4. The system of claim 1 , wherein the input code portion comprises a portion of software code in a software language selected from the list consisting of:

Java, Python, R, and a C-based language.

5. The system of claim 1 , wherein the code vulnerability comprises a vulnerability selected from the list consisting of:

a hard-coded credential, cleartext logging, and structured query language (SQL) injection.

6. The system of claim 1 , wherein generating the output code portion is performed within 20 milliseconds of receiving the input code portion.

7. The system of claim 1 , wherein the correction of the code vulnerability comprises an annotation to the output code portion identifying the code vulnerability.

8. A computer-implemented method comprising:

receiving syntactically incomplete input software code;

extracting an input code portion at least by applying a sliding window to the input software code, the sliding window having a sliding window length;

detecting a code vulnerability within the input code portion using a machine learning (ML) model trained on a code segment having a length equal to the sliding window length,

the ML model having an input layer having a size equal to the sliding window length, and

the ML model having an output layer having a size based on a number of different vulnerability classes; and

generating, from the input code portion and the detection of the code vulnerability, an output code portion containing a correction of the code vulnerability.

9. The computer-implemented method of claim 8 , wherein the sliding window has a length of 50 or fewer characters.

10. The computer-implemented method of claim 8 , further comprising sending the output code portion to a development environment.

11. The computer-implemented method of claim 8 , further comprising:

detecting malicious logic within the input code portion using the ML model; and

generating, from the input code portion and the detection of the malicious logic, an alert indicating that the input code portion comprises the malicious logic.

12. The computer-implemented method of claim 8 , wherein the code vulnerability comprises a vulnerability matched from a common weakness enumeration (CWE) dictionary.

13. The computer-implemented method of claim 8 , wherein generating the output code portion is performed within 20 milliseconds of receiving the input code portion.

14. The computer-implemented method of claim 8 , wherein the correction of the code vulnerability comprises an annotation to the output code portion identifying the code vulnerability.

15. A computer storage device having computer-executable instructions stored thereon, which, on execution by a computer, cause the computer to perform operations comprising:

receiving input software code;

extracting an input code portion at least by applying a sliding window to the input software code, the sliding window having a sliding window length;

detecting a code vulnerability within the input code portion using a machine learning (ML) model trained on a code segment having a length equal to the sliding window length,

the ML model having an input layer having a size equal to the sliding window length, and

the ML model having an output layer having a size based on a number of different vulnerability classes; and

generating, from the input code portion and the detection of the code vulnerability, in real time, an output code portion containing a correction of the code vulnerability.

16. The computer storage device of claim 15 , wherein the input code portion has a length of 50 or fewer characters.

17. The computer storage device of claim 15 , wherein the sliding window is syntactically incomplete.

18. The computer storage device of claim 15 , wherein the input code portion comprises a portion of software code in a software language selected from the list consisting of:

Java, Python, R, and a C-based language.

19. The computer storage device of claim 15 , wherein the code vulnerability comprises a vulnerability selected from the list consisting of:

a hard-coded credential, cleartext logging, and structured query language (SQL) injection.

20. The computer storage device of claim 15 , wherein the correction of the code vulnerability comprises an annotation to the output code portion identifying the code vulnerability.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Feb 24, 2023
From: HELYAR, ALEXANDER WINTHROP; CHAN, AARON YUE-CHIU; ZILOUCHIAN MOGHADDAM, ROSHANAK; ABDELREHEEM, ESLAM KAMAL; MOHYLEVSKYY, YEVHEN; ELKAMHAWY, MOHAMED ALI MOHAMED; MAGOODA, AHMED EZZAT ABDELGAWAD; JACKSON, KYLE P.
To: MICROSOFT TECHNOLOGY LICENSING, LLC
Reel/Frame 062797/0348 →
Continuity (2)
Provisional Application 63382882 · Nov 8, 2022
Related Publication 20240152624A1 · May 9, 2024
References Cited (21)
US 8838992B1 · Zhu · 2014 [cited by examiner]
US 11238377B2 · Polleri · 2022 [cited by examiner]
US 20190018967A1 · Ramasamy · 2019 [cited by examiner]
US 20200301808A1 · Mola · 2020 [cited by examiner]
US 20210109881A1 · Moustafa · 2021 [cited by examiner]
US 20220004642A1 · Pujar · 2022 [cited by examiner]
US 20220108022A1 · Bishop, III · 2022 [cited by examiner]
US 20230239323A1 · Seletskiy · 2023 [cited by examiner]
US 20230267066A1 · Ross · 2023 [cited by examiner]
US 20240331868A1 · Zhang · 2024 [cited by examiner]
US 20240389887A1 · Sastre · 2024 [cited by examiner]
CN 114996705A · 2022 [cited by examiner]
CN 118520467A · 2024 [cited by examiner]
WO WO2024180374A1 · 2024 [cited by examiner]
Wang et al, Graph Confident Learning for Software Vulnerability Detection, Engineering Applications of Artificial Intelligence 133, p. 1-15 (Year: 2024). [cited by examiner]
Lardinois, Frederic, “Amazon Launches CodeWhisperer, A GitHub Copilot-Like AI Pair Programming Tool”, Retrieved from: https://techcrunch.com/2022/06/23/amazon-launches-codewhisperer-its-ai-pair-programming-tool/, Jun. 2… [cited by applicant]
International Search Report and Written Opinion received for PCT Application No. PCT/US23/035930, mailed on Feb. 28, 2024, 15 pages. [cited by applicant]
Mamede, et al., “A transformer-based IDE plugin for vulnerability detection”, Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering, Oct. 10, 2022, 04 Pages. [cited by applicant]
Wang, et al., “Multi-passage BERT: A Globally Normalized BERT Model for Open-domain Question Answering”, Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International J… [cited by applicant]
Xie, et al., “ASIDE: IDE support for web application security”, Proceedings of the 27th Annual Computer Security Applications Conference, Dec. 5, 2011, pp. 267-276. [cited by applicant]
International preliminary report on patentability Received in European Patent Application No. PCT/US2023/035930, mailed on May 22, 2025, 12 pages. [cited by applicant]
Cited By (1)
US 12,572,654