# US 10,956,477 B1 · System and method for detecting malicious scripts through natural language processing modeling

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

- Number: US 10,956,477 B1
- Document ID: US10956477B1
- Status: Granted
- Kind: B1
- Application number: 16/219,780
- Filed: 2018-12-13
- Granted: 2021-03-23
- Earliest claimed: 2018-03-30
- Assignees: FireEye, Inc.
- Applicants: FireEye, Inc.
- Inventors: Chunsheng Fang; Daniel Bohannon
- Web page: https://patentgrep.com/patent/US10956477B1

## CPC

- G06F 16/35: Clustering; Classification
- G06F 21/563: {by source code analysis}
- G06F 16/313: {Selection or weighting of terms for indexing}
- G06F 21/562: {Static detection}
- G06F 40/30: Semantic analysis
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method for detecting a cyberattack on a network device is described. The method features receiving script text and performing a normalization operation on the script text to produce a normalized script text. The normalized script text includes a plurality of analytic tokens each being an instance of a sequence of characters grouped together as a useful semantic unit for natural language processing (NLP). Thereafter, a NLP model is applied to the normalized script text to classify a script associated with the script text as malicious or benign. Responsive to the script being classified as malicious, generating an alert message provided to an administrator to identify the malicious script.

## Claims

### Claim 1

A computerized method for detecting a cyberattack on a network device, the method comprising:
receiving script text including a first plurality of characters;
performing a normalization operation on the script text to produce a normalized script text having a second plurality of characters being less than the first plurality of characters, the normalized script text including a plurality of analytic tokens each being an instance of a sequence of characters grouped together as a useful semantic unit for natural language processing (NLP);
applying, by modeling logic, a NLP model to the normalized script text to generate a set of tokens for use by a classifier, the classifier being configured to correlate the set of tokens with tokens associated with a corpus of at least known malicious scripts and classify a script associated with the script text as malicious or benign; and
responsive to the script being classified as malicious, generating an alert message provided to an administrator to identify the malicious script.

### Claim 2 (depends on 1)

The computerized method of claim 1, wherein the receiving of the script text comprises detecting a script running as a process on the network device and obtaining the script text from the script.

### Claim 3 (depends on 1)

The computerized method of claim 1, wherein the performing of the normalization operation on the script text comprises
determining whether at least a first portion of the script text is encoded;
responsive to determining that the at least first portion of the script text is encoded, determining an encoding scheme used to encode the at least first portion of the script text; and
upon determining the encoding scheme, decoding the at least first portion of the script text so that the script text undergoing the normalization operation features no encoded text.

### Claim 4 (depends on 3)

The computerized method of claim 3, wherein the normalization operation on the script text comprises inserting a prefix before each analytic token of the plurality of analytic tokens corresponding to the decoded first portion of the script text, the prefix being a symbol signaling the NLP model to increase a scrutiny of analysis associated with each analytic token following the prefix.

### Claim 5 (depends on 3)

The computerized method of claim 3, wherein the performing of the normalization operation on the script text further comprises performing a tokenization operation on the script text after decoding the at least first portion of the script text to produce the plurality of analytic tokens.

### Claim 6 (depends on 5)

The computerized method of claim 5, wherein the performing of the normalization operation on the script text further comprises performing a stemmer operation on the plurality of analytic tokens of the script text to simplify a syntax associated with the plurality of analytic tokens, the stemmer operation being conducted in accordance with a prefix tree.

### Claim 7 (depends on 6)

The computerized method of claim 6, wherein the performing of the normalization operation on the script text further comprises updating a vocabulary data store utilized during the normalization operation on the script text with one or more sequences of characters from the script text that arise to a predetermined level of significance for use in classification of the script, the predetermined level of significance being determined in accordance with a frequency of occurrence in the script text of the one or more sequences of characters.

### Claim 8 (depends on 7)

The computerized method of claim 7, wherein the predetermined level of significance being determined in accordance with term frequency-inverse document frequency (tf-idf).

### Claim 9 (depends on 7)

The computerized method of claim 7, wherein the performing of the normalization operation on the script text further comprises reconstructing the script text to produce the normalized script by at least removing one or more words from the script so that the plurality of analytic tokens include words only stored in the vocabulary data store.

### Claim 10 (depends on 1)

The computerized method of claim 1, wherein the applying of the NLP model to the normalized script text includes generating the set of tokens corresponding to model-adapted tokens, from the plurality of analytic tokens, and applying the NLP model to the model-adapted tokens to produce a prediction score representing a level of maliciousness of the script.

### Claim 11 (depends on 1)

The computerized method of claim 1, wherein the applying of the NLP model to the normalized script text includes analyzing each of the plurality of analytic tokens after normalization using a neural network trained using the tokens associated with the corpus of at least known malicious scripts being labeled training sets of malicious tokens in order to identify any of the plurality of analytic tokens probative in classifying the script and the classifier communicatively coupled to the neural network to classify the script in accordance with a set of classification rules.

### Claim 12

A computerized method for detecting a cyberattack on a network device, the method comprising:
receiving script text as input;
performing, by normalization logic, a normalization operation on the script text to produce a normalized script text, the normalized script text including a plurality of analytic tokens each being an instance of a sequence of characters grouped together as a useful semantic unit for natural language processing (NLP);
applying, by modeling logic, a NLP model to the normalized script text to generate a set of tokens; and
classifying, by a classifier, a script associated with the script text as malicious or benign based on at least a correlation between the set of tokens and tokens associated with a corpus of known malicious scripts,
wherein each of the normalization logic, the modeling logic and the classifier is software that is stored in one or more non-transitory storage mediums.

### Claim 13 (depends on 12)

The computerized method of claim 12, wherein the performing of the normalization operation on the script text comprises
determining whether at least a first portion of the script text is encoded; and
responsive to determining that the at least first portion of the script text is encoded, determining an encoding scheme used to encode the at least first portion of the script text and decoding the at least first portion of the script text based on a decoding scheme to counter the encoding scheme.

### Claim 14 (depends on 12)

The computerized method of claim 12, wherein the normalization operation on the script text comprises (i) decoding at least a first portion of the script text being encoded and (ii) inserting a prefix before each analytic token of the plurality of analytic tokens corresponding to the decoded first portion of the script text, the prefix being a symbol signaling the NLP model to increase a scrutiny of analysis associated with each analytic token following the prefix.

### Claim 15 (depends on 12)

The computerized method of claim 12, wherein the performing of the normalization operation on the script text further comprises performing a tokenization operation on the script text after decoding any encoded portions of the script text to produce the plurality of analytic tokens.

### Claim 16 (depends on 15)

The computerized method of claim 15, wherein the performing of the normalization operation on the script text further comprises performing a stemmer operation on the plurality of analytic tokens of the script text to simplify syntax associated with the plurality of analytic tokens, the stemmer operation being conducted in accordance with a prefix tree.

### Claim 17 (depends on 15)

The computerized method of claim 15, wherein the receiving of the script includes receiving a shell script entered via a command line interface or graphical user interface.

### Claim 18

A network device, comprising:
one or more hardware processors; and
a non-transitory storage medium communicatively coupled to the one or more hardware processors, the non-transitory storage medium comprises a software agent including
a monitoring software component configured to detect a script and obtain script text associated with the script,
an analysis software component configured to process the script text and generate a plurality of analytic tokens based on the script text,
a modeling software component configured to generate a set of tokens based on the plurality of analytic tokens for use by a classifier to (i) correlate the set of tokens with tokens associated with a corpus of at least known malicious scripts and (ii) classify the script associated with the script text as malicious or benign, and
reporting logic configured to generate an alert message provided to an administrator responsive to the script being classified as malicious.

### Claim 19 (depends on 18)

The network device of claim 18, wherein the analysis software component, deployed as part of the software agent, upon execution by the one or more hardware processors, to perform a normalization operation on the script text to produce a normalized script text including a second plurality of characters being less than a first plurality of characters forming the script text, the normalized script text including the plurality of analytic tokens each being an instance of a sequence of characters grouped together as a useful semantic unit for natural language processing (NLP).

### Claim 20 (depends on 19)

The network device of claim 19, wherein the modeling software component, deployed as part of the software agent, upon execution by the one or more hardware processors, to apply a NLP model to the normalized script text to classify the script.

### Claim 21 (depends on 20)

The network device of claim 20, wherein the analysis software component, deployed as part of the software agent, upon execution by the one or more hardware processors, to perform the normalization operation by at least
determining whether at least a first portion of the script text is encoded;
responsive to determining that the at least first portion of the script text is encoded, determining an encoding scheme used to encode the at least first portion of the script text; and
upon determining the encoding scheme, decoding the at least first portion of the script text so that the script text undergoing the normalization operation features no encoded text.

### Claim 22 (depends on 21)

The network device of claim 21, wherein the analysis software component, deployed as part of the software agent, upon execution by the one or more hardware processors, to further perform the normalization operation by at least inserting a prefix before each analytic token of the plurality of analytic tokens corresponding to the decoded first portion of the script text, the prefix being a symbol signaling the NLP model to increase a scrutiny of analysis associated with each analytic token following the prefix.

### Claim 23 (depends on 21)

The network device of claim 21, wherein the analysis software component, deployed as part of the software agent, upon execution by the one or more hardware processors, to perform the normalization operation that further comprises performing a tokenization operation on the script text after the decoding of the at least first portion of the script text to produce the plurality of analytic tokens.

### Claim 24 (depends on 23)

The network device of claim 23, wherein the analysis software component, deployed as part of the software agent, upon execution by the one or more hardware processors, to perform the normalization operation that further comprises performing a stemmer operation on the plurality of analytic tokens of the script text to simplify a syntax associated with the plurality of analytic tokens, the stemmer operation being conducted in accordance with a prefix tree.

### Claim 25 (depends on 24)

The network device of claim 24, wherein the analysis software component, deployed as part of the software agent, upon execution by the one or more hardware processors, to perform the normalization operation that further comprises updating a vocabulary data store utilized during the normalization operation on the script text with one or more sequences of characters from the script text that arise to a predetermined level of significance for use in classification of the script, the predetermined level of significance being determined in accordance with a frequency of occurrence in the script text of the one or more sequences of characters.

### Claim 26 (depends on 25)

The network device of claim 25, wherein the analysis software component, deployed as part of the software agent, upon execution by the one or more hardware processors, to perform the normalization operation that further comprises reconstructing the script text to produce the normalized script by at least removing one or more words from the script so that the plurality of analytic tokens include words only stored in the vocabulary data store.

### Claim 27 (depends on 20)

The network device of claim 20, wherein the modeling software component, deployed as part of the software agent, upon execution by the one or more hardware processors, applying the NLP model to the normalized script text to at least generate generating model-adapted tokens corresponding to the set of tokens, from the plurality of analytic tokens, and applying the NLP model to the model-adapted tokens to produce a prediction score representing a level of maliciousness of the script.

### Claim 28 (depends on 20)

The network device of claim 20, wherein the modeling software component, deployed as part of the software agent, upon execution by the one or more hardware processors, applying of the NLP model to the normalized script text by at least analyzing each of the plurality of analytic tokens after normalization using a neural network trained using the tokens associated with the corpus of at least known malicious scripts corresponding to labeled training sets of malicious tokens in order to identify any of the plurality of analytic tokens probative in classifying the script and the classifier communicatively coupled to the neural network to classify the script in accordance with a set of classification rules.

### Claim 29

A non-transitory storage medium including a software agent that, upon execution by one or more hardware processors, automatically detects a script and classifies the script as malicious or benign, comprising:
a monitoring software component configured to detect a script and obtain script text associated with the script;
an analysis software component configured to process the script text and generate a plurality of analytic tokens based on the script text;
a modeling software component configured to generate a set of tokens based on the plurality of analytic tokens for use by a classifier to (i) correlate the set of tokens with tokens associated with a corpus of at least known malicious scripts and (ii) classify the script associated with the script text as malicious or benign; and
a reporting software component configured to generate an alert message provided to an administrator responsive to the script being classified as malicious.

### Claim 30 (depends on 1)

The computerized method of claim 1, wherein the classifier is further configured to correlate the set of tokens with tokens associated with a corpus of known benign scripts and the classifier to assign prediction scores to the set of token, the predictive scores collectively representing a likelihood of the script text being associated with a cyberattack.

### Claim 31 (depends on 29)

The non-transitory storage medium of claim 29, wherein the analysis software component, deployed as part of the software agent, to perform a normalization operation on the script text to produce a normalized script text including a second plurality of characters being less than a first plurality of characters forming the script text, the normalized script text including the plurality of analytic tokens each being an instance of a sequence of characters grouped together as a useful semantic unit for natural language processing (NLP).

### Claim 32 (depends on 29)

The non-transitory storage medium of claim 29, wherein the modeling software component, deployed as part of the software agent, to apply a NLP model to the normalized script text to classify the script.

### Claim 33 (depends on 32)

The non-transitory storage medium of claim 32, wherein the analysis software component, deployed as part of the software agent, to perform the normalization operation by at least
determining whether at least a first portion of the script text is encoded;
responsive to determining that the at least first portion of the script text is encoded, determining an encoding scheme used to encode the at least first portion of the script text; and
upon determining the encoding scheme, decoding the at least first portion of the script text so that the script text undergoing the normalization operation features no encoded text.

### Claim 34 (depends on 33)

The non-transitory storage medium of claim 33, wherein the analysis software component, deployed as part of the software agent, to further perform the normalization operation by at least inserting a prefix before each analytic token of the plurality of analytic tokens corresponding to the decoded first portion of the script text, the prefix being a symbol signaling the NLP model to increase a scrutiny of analysis associated with each analytic token following the prefix.

### Claim 35 (depends on 33)

The non-transitory storage medium of claim 33, wherein the analysis software component, deployed as part of the software agent, to perform the normalization operation that further comprises performing a tokenization operation on the script text after the decoding of the at least first portion of the script text to produce the plurality of analytic tokens.

### Claim 36 (depends on 35)

The non-transitory storage medium of claim 35, wherein the analysis software component, deployed as part of the software agent, to perform the normalization operation that further comprises performing a stemmer operation on the plurality of analytic tokens of the script text to simplify a syntax associated with the plurality of analytic tokens, the stemmer operation being conducted in accordance with a prefix tree.

### Claim 37 (depends on 36)

The non-transitory storage medium of claim 36, wherein the analysis software component, deployed as part of the software agent, to perform the normalization operation that further comprises updating a vocabulary data store utilized during the normalization operation on the script text with one or more sequences of characters from the script text that arise to a predetermined level of significance for use in classification of the script, the predetermined level of significance being determined in accordance with a frequency of occurrence in the script text of the one or more sequences of characters.

### Claim 38 (depends on 37)

The non-transitory storage medium of claim 37, wherein the analysis software component, deployed as part of the software agent, to perform the normalization operation that further comprises reconstructing the script text to produce the normalized script by at least removing one or more words from the script so that the plurality of analytic tokens include words only stored in the vocabulary data store.

### Claim 39 (depends on 32)

The non-transitory storage medium of claim 32, wherein the modeling software component, deployed as part of the software agent, applying of the NLP model to the normalized script text to at least generate generating model-adapted tokens corresponding to the set of tokens, from the plurality of analytic tokens, and applying the NLP model to the model- adapted tokens to produce a prediction score representing a level of maliciousness of the script.

### Claim 40 (depends on 32)

The non-transitory storage medium of claim 32, wherein the modeling software component, deployed as part of the software agent, applying of the NLP model to the normalized script text by at least analyzing each of the plurality of analytic tokens after normalization using a neural network trained using the tokens associated with the corpus of at least known malicious scripts corresponding to labeled training sets of malicious tokens in order to identify any of the plurality of analytic tokens probative in classifying the script and the classifier communicatively coupled to the neural network to classify the script in accordance with a set of classification rules.
