# US 2025/0094581 A1 · System and Method for Efficient Malicious Code Detection and Malicious Open-Source Software Package Detection Using Large Language Models

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2025/0094581 A1
- Document ID: US20250094581A1
- Status: Published application
- Kind: A1
- Application number: 18/885,799
- Filed: 2024-09-16
- Published: 2025-03-20
- Earliest claimed: 2023-09-14
- Assignees: Apiiro Ltd.
- Applicants: Apiiro Ltd.
- Inventors: Gil DAVID; Eli SHALOM; Idan PLOTNIK; Yonatan Eldar
- Web page: https://patentgrep.com/patent/US20250094581A1

## CPC

- G06F 21/563: {by source code analysis}
- G06F 16/3347: {using vector based model}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method for the efficient use of Large Language Models (LLMs) in malicious code detection, the method including: assessing code and assigning a probability level of being malicious; and running code assessed to be above a predetermined probability level through an LLM to determine if the code is malicious.

## Claims

### Claim 1

A method for the efficient use of Large Language Models (LLMs) in malicious code detection, the method comprising:
assessing code and assigning a probability level of being malicious; and
running code assessed to be above a predetermined probability level through an LLM to determine if the code is malicious.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
filtering the code, prior to the assessing step, to determine whether the code is capable of performing one or more activities of a predetermined set of activities necessary for malicious activity.

### Claim 3 (depends on 2)

The method of claim 2, wherein the filtering step employs a binary filter.

### Claim 4 (depends on 1)

The method of claim 1, wherein the assessing step uses at least heuristics to determine the probability level of maliciousness.

### Claim 5 (depends on 1)

The method of claim 1, wherein the assessing step employs a Code Embedding mechanism to determine the probability level of maliciousness, the code embedding mechanism including:
generating a vector representation of the code being assessed,
comparing and clustering of the vector representation with a database of malicious code embeddings, and
assigning a probability value based on similarity to one or more of the malicious code embeddings;
wherein the probability value is used in calculating the probability level during the assessing step.

### Claim 6 (depends on 5)

The method of claim 5, wherein the database of malicious code embeddings includes a plurality attack embedding vectors each generated by a code embedding mechanism from a corresponding malicious code.

### Claim 7 (depends on 1)

The method of claim 1, wherein the assessing step employs a prompt Embedding mechanism to determine the probability level of maliciousness, the prompt embedding mechanism including:
generating a vector representation of the code being assessed,
comparing and clustering of the vector representation with a database of malicious prompt embeddings, and
assigning a probability value based on similarity to one or more of the malicious code embeddings;
wherein the probability value is used in calculating the probability level during the assessing step.

### Claim 8 (depends on 7)

The method of claim 7, wherein the database of malicious prompt embeddings includes a plurality prompt embedding vectors each generated by a descriptions processor from a corresponding free-text description of a malicious cyber-attack technique.

### Claim 9

A method for efficient use of Large Language Models (LLMs) in malicious code detection, the method comprising:
generating a Large Language Model (LLM) Code Pattern (LCP) detector, generating the LCP detector includes:
generating a plurality of LLM embeddings from respective malicious code segments;
enhancing each of the LLM embeddings with metadata to form LLM code Patterns (LCPs) of malicious code;
indexing the LCPs in a vector database;
embedding code to receive code embeddings; and
comparing the code embeddings to the LCPs of malicious code in the vector database.

### Claim 10 (depends on 9)

The method of claim 9, further comprising:
clustering the code embeddings; and
flagging abnormal patterns of clustering that are associated with malicious campaigns.

### Claim 11 (depends on 10)

The method of claim 10, wherein an abnormal pattern of clustering includes multiple code embeddings of recently published code segments exhibit high similarity to each other.

### Claim 12 (depends on 9)

The method of claim 9, further comprising:
generating new LCPs from embeddings of new malicious code segments;
adding the new LCPs to the vector database.

### Claim 13 (depends on 12)

The method of claim 12, further comprising:
re-comparing the code embeddings to the vector database with the new LCPs.
