IP Library › Granted Patent US 9,419,991
Granted Patent B2
US 9,419,991 · App. 14/501,798 · Granted Aug 16, 2016

De-obfuscating scripted language for network intrusion detection using a regular expression signature

Inventor: Ankur Tyagi (Surat, IN)
Assignee: Juniper Networks, Inc.
H04L63/1425G06F8/427G06F9/45504G06F17/271G06F21/562
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 9,419,991
App. No.
14/501,798
Granted
Aug 16, 2016
Kind
B2
Abstract

A device receives data, identifies a context associated with the data, and identifies a script, within the data, associated with the context. The device parses the script to identify tokens, forms nodes based on the tokens, and assembles a syntax tree using the nodes. The device renames one or more identifiers associated with the nodes and generates a normalized text, associated with the script, based on the syntax tree after renaming the one or more identifiers. The device determines whether the normalized text matches a regular expression signature and processes the data based on determining whether the normalized text matches the regular expression signature. The device processes the data by a first process when the normalized text matches the regular expression signature or by a second process, different from the first process, when the normalized text does not match the regular expression signature.

Claims (112)

1. A device, comprising:

a memory; and

one or more processors to:

receive data;

identify a context associated with the data;

identify a script, within the data, associated with the context;

parse the script to identify tokens;

form nodes based on the tokens;

assemble a syntax tree using the nodes;

rename one or more identifiers associated with the nodes;

generate a normalized text, associated with the script, based on the syntax tree after renaming the one or more identifiers;

generate, based on the normalized text, a call list that includes information identifying:

an ordered list of calls to functions that allow the script to interact with an environment,

a quantity of the calls to the functions, and

one or more arguments passed to the functions,

the functions being defined outside of the script;

determine whether the call list matches a regular expression signature; and

selectively process the data based on determining whether the call list matches the regular expression signature,

the data being processed by a first process when the call list matches the regular expression signature,

the data being processed by a second process when the call list does not match the regular expression signature, and

the first process being different from the second process.

2. The device of claim 1 , where the one or more processors, when generating the normalized text based on the syntax tree, are to:

generate a normalized script, corresponding to the script, by traversing the nodes of the syntax tree,

the normalized text being the normalized script.

3. The device of claim 1 , where the one or more processors, when generating the normalized text based on the syntax tree, are to:

generate a normalized script, corresponding to the script, by traversing the nodes of the syntax tree;

interpret a portion of the normalized script;

generate a trace based on information obtained by interpreting the portion of the normalized script; and

generate the normalized text based on the trace.

4. The device of claim 1 ,

where the one or more processors are further to:

identify, from the script, a reducible expression; and

determine a reduced expression corresponding to the reducible expression, and where the one or more processors, when generating the normalized text, are to:

substitute the reduced expression in place of the reducible expression,

the normalized text being the script having the reduced expression substituted in place of the reducible expression.

5. The device of claim 4 ,

where the reducible expression is an encoded expression, and

where the one or more processors, when determining the reduced expression, are to:

decode the encoded expression to generate the reduced expression.

6. The device of claim 1 ,

where, when receiving the data, the one or more processors are to:

receive the data from a sending end-point, and

where, when processing the data based on determining whether the call list matches the regular expression signature, are to:

identify a receiving end-point associated with the data;

send the data to the receiving end-point based on determining that the call list does not match the regular expression signature; and

drop the data, without sending the data to the receiving end-point, based on determining that the call list matches the regular expression signature.

7. A method comprising:

receiving, by a device, data from an end-point device;

extracting, by the device, scripted code from the data;

parsing, by the device, the scripted code to generate nodes associated with identifiers;

populating, by the device, a syntax tree with the nodes;

generating, by the device, a normalized script based on the syntax tree;

generating, by the device and based on the normalized script, a call list that includes information identifying:

an ordered list of calls to functions that allow the scripted code to interact with an environment,

a quantity of the calls to the functions, and

one or more arguments passed to the functions,

the functions being provided by the environment;

determining, by the device, whether the call list matches a signature; and

selectively sending, by the device, the data to another end-point device, associated with the data, based on determining whether the call list matches the signature,

the data being sent to the other end-point device based on determining that the call list does not match the signature, and

the data not being sent to the other end-point device based on determining that the call list matches the signature.

8. The method of claim 7 , further comprising:

converting the nodes of the syntax tree into scripted expressions,

where generating the normalized script comprises:

generating the normalized script by assembling the scripted expressions according to a normalizing scheme.

9. The method of claim 7 , further comprising:

interpreting a portion of the scripted code in the environment;

observing an interaction between objects of the interpreted portion of the scripted code and between the portion of the scripted code and the environment;

modifying, to obtain a modified portion of the scripted code, the portion of the scripted code based on the interaction; and

generating the normalized script being based on the modified portion of the scripted code.

10. The method of claim 9 , where modifying the portion of the scripted code comprises:

concatenating one or more split strings identified within the portion of the scripted code.

11. The method of claim 9 , where modifying the portion of the scripted code comprises:

iteratively modifying the portion of the scripted code.

12. The method of claim 9 , where modifying the portion of the scripted code comprises:

decoding the portion of the scripted code.

13. The method of claim 9 , where modifying the portion of the scripted code comprises:

replacing a function call identified in the portion of the scripted code with a result of the function call.

14. A computer-readable medium storing instructions, the instructions comprising:

one or more instructions that, when executed by one or more processors, cause the one or more processors to:

receive data;

identify executable code contained in the data;

execute the executable code within an environment;

generate a trace based on executing the executable code;

generate, based on the trace, a call list that includes information identifying:

an ordered list of calls to one or more functions that allow the executable code to interact with the environment,

a quantity of the calls to the one or more functions, and one or more arguments passed to the one or more functions,

the one or more functions being defined outside of the executable code;

generate, based on the trace, an optimized code by replacing a portion of the executable code with an alternative portion,

the portion and the alternative portion being equivalent with respect to interaction with the environment during execution;

modify whitespace contained in the optimized code based on a whitespace normalizing scheme;

modify identifiers contained in the optimized code based on an identifier normalizing scheme;

provide the optimized code, after modifying the whitespace and after modifying the identifiers, for matching against a code signature to determine whether the executable code is malicious,

the code signature being associated with determining whether the executable code is malicious; and

provide the call list for matching against a list signature to determine whether the executable code is malicious,

the list signature being associated with determining whether the executable code is malicious.

15. The computer readable medium of claim 14 , where the one or more instructions, that cause the one or more processors to provide the optimized code and the call list, cause the one or more processors to:

provide the optimized code or the call list to a device associated with a user to permit the user to determine whether the optimized code matches the code signature or whether the call list matches the list signature.

16. The computer-readable medium of claim 14 , where the one or more instructions, when executed by the one or more processors, further cause the one or more processors to:

determine that the call list does not match the list signature;

determine that the optimized code does not match the code signature; and

send, to another device associated with receiving the data, the data based on determining that the call list does not match the list signature and based on determining that the optimized code does not match the code signature.

17. The computer-readable medium of claim 16 , where the code signature is associated with a regular expression.

18. The computer-readable medium of claim 14 , where the one or more instructions, that cause the one or more processors to generate the optimized code, cause the one or more processors to:

generate an abstract syntax tree based on the executable code;

determine, from the trace, a behavior associated with one or more nodes of the abstract syntax tree;

generate one or more substitute nodes associated with the behavior; and

generate the optimized code based on the abstract syntax tree and the one or more substitute nodes.

19. The computer-readable medium of claim 18 , where the one or more instructions, that cause the one or more processors to generate the optimized code, further cause the one or more processors to:

repeat, iteratively, determining the behavior and generating the one or more substitute nodes.

20. The device of claim 1 , where the one or more processors are further to:

select the regular expression signature from a list of regular expression signatures determined to match call lists associated with one or more malicious scripts.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 30, 2014
From: TYAGI, ANKUR
To: JUNIPER NETWORKS, INC.
Reel/Frame 033856/0445 →
Continuity (1)
Related Publication 20160094572A1 · Mar 31, 2016