# US 2024/0020384 A1 · Detecting malicious scripts in a web page

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

- Number: US 2024/0020384 A1
- Document ID: US20240020384A1
- Status: Published application
- Kind: A1
- Application number: 18/374,188
- Filed: 2023-09-28
- Published: 2024-01-18
- Earliest claimed: 2020-06-26
- Assignees: Shape Security, Inc.
- Applicants: Shape Security, Inc.
- Inventors: Tim DISNEY; Madhukar Kedlaya; Claire Schlenker; Nitish Khadke
- Web page: https://patentgrep.com/patent/US20240020384A1

## CPC

- G06F 21/563: {by source code analysis}
- G06F 21/54: by adding security routines or objects to programs
- G06F 21/554: {involving event detection and direct action}
- G06F 21/568: {eliminating virus, restoring damaged files}
- H04L 63/1441: {Countermeasures against malicious traffic (countermeasures against attacks on cryptographic mechanisms H04L9/002)}
- H04L 63/1475: {Passive attacks, e.g. eavesdropping or listening without modification of the traffic monitored}
- H04L 67/02: based on web technology, e.g. hypertext transfer protocol [HTTP]
- H04L 67/53: using third party service providers
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

Techniques are provided for detecting a malicious script in a web page. Instrumentation code is provided for serving to a client computing device with a web page. The instrumentation code is configured to monitor web code execution at the client computing device when a script referenced by the web page is processed. Script activity data generated by the instrumentation code is received. The script activity data describes one or more script actions detected by the instrumentation code at the client computing device. Prior script activity data generated by a prior instance of the instrumentation code is obtained. A malicious change in the script is detected based on comparing the script activity data and the prior script activity data. In response to detecting the malicious change in the script, a threat response action is performed.

## Claims

### Claim 1

A non-transitory computer readable medium having stored thereon instructions for filtering content comprising executable code which when executed by processors, causes the processors to:
provide instrumentation code for serving to a client computing device with a web page requested by the client computing device, the instrumentation code configured to monitor web code execution at the client computing device when a script referenced by the web page is processed and generate script activity data when the instrumentation code detects script behavior that can exfiltrate data;
receive the script activity data generated by the instrumentation code at the client computing device, the script activity data describing one or more script actions detected by the instrumentation code, wherein the one or more script actions include the script using a Web API interface that enables reading contents of a form field of the web page that is configured to receive data input by a user;
obtain prior script activity data generated by a prior instance of the instrumentation code served with the web page to one or more other client computing devices;
detect a malicious change in the script based on comparing the script activity data and the prior script activity data; and
in response to detecting the malicious change in the script, perform a threat response action.

### Claim 2 (depends on 1)

The medium as set forth in claim 1, wherein the one or more script actions include the script using a Web API interface that accesses data from an event object or performs an outbound network request.

### Claim 3 (depends on 1)

The medium as set forth in claim 1, wherein detecting the malicious change includes detecting that the script:
uses a new Web API interface in the script activity data compared to the prior script activity data,
accesses a new form field in the script activity data compared to the prior script activity data,
performs a new outbound network request in the script activity data compared to the prior script activity data, or
accesses a new event object compared to the prior script activity data.

### Claim 4 (depends on 1)

The medium as set forth in claim 1, wherein the threat response action includes providing threat response code for serving to a second client computing device with the web page, the threat response code configured to performing a blocking action on the script.

### Claim 5 (depends on 4)

The medium as set forth in claim 4, wherein the blocking action includes at least one of:
blocking the script from loading at the second client computing device;
blocking the script from using one or more APIs at the second client computing device;
blocking the script from accessing one or more elements of the web page at the second client computing device; and
blocking the script from initiating one or more outbound network requests at the second client computing device.

### Claim 6

A method implemented by one or more network traffic management apparatuses, server devices, or client devices, the method comprising:
providing instrumentation code for serving to a client computing device with a web page requested by the client computing device, the instrumentation code configured to monitor web code execution at the client computing device when a script referenced by the web page is processed and generate script activity data;
receiving the script activity data generated by the instrumentation code at the client computing device, the script activity data describing one or more script actions detected by the instrumentation code;
obtaining prior script activity data generated by a prior instance of the instrumentation code served with the web page to one or more other client computing devices;
detecting a malicious change in the script based on comparing the script activity data and the prior script activity data; and
in response to detecting the malicious change in the script, performing a threat response action.

### Claim 7 (depends on 6)

The method as set forth in claim 6, wherein the generated script activity data comprises a description of a usage from the web code execution of Web API interface aspects that enables reading contents of a form field of the web page that is configured to receive data input by a user.

### Claim 8 (depends on 6)

The method as set forth in claim 6, wherein the instrumentation code is further configured to monitor the web code execution to determine whether the web code execution accessed a particular web element.

### Claim 9 (depends on 6)

The method as set forth in claim 6, wherein the generated script activity data comprises a description of attempts by the web code execution to access a particular form field associated with sensitive data.

### Claim 10 (depends on 9)

The method as set forth in claim 9, wherein the instrumentation code is further configured to monitor the web code execution to determine whether the web code execution accesses event objects with the sensitive data, and wherein the event objects comprise a touch event, pointer event, input event, or a keyboard event.

### Claim 11

A non-transitory computer readable medium having stored thereon instructions for filtering content comprising executable code which when executed by processors, causes the processors to:
provide instrumentation code for serving to a client computing device with a web page requested by the client computing device, the instrumentation code configured to monitor web code execution at the client computing device when a script referenced by the web page is processed and generate script activity data;
receive the script activity data generated by the instrumentation code at the client computing device, the script activity data describing one or more script actions detected by the instrumentation code;
obtain prior script activity data generated by a prior instance of the instrumentation code served with the web page to one or more other client computing devices;
detect a malicious change in the script based on comparing the script activity data and the prior script activity data; and
in response to detecting the malicious change in the script, perform a threat response action.

### Claim 12 (depends on 11)

The medium as set forth in claim 11, wherein the generated script activity data comprises a description of a usage from the web code execution of Web API interface aspects that enables reading contents of a form field of the web page that is configured to receive data input by a user.

### Claim 13 (depends on 11)

The medium as set forth in claim 11, wherein the instrumentation code is further configured to monitor the web code execution to determine whether the web code execution accessed a particular web element.

### Claim 14 (depends on 11)

The medium as set forth in claim 11, wherein the generated script activity data comprises a description of attempts by the web code execution to access a particular form field associated with sensitive data.

### Claim 15 (depends on 14)

The medium as set forth in claim 14, wherein the instrumentation code is further configured to monitor the web code execution to determine whether the web code execution accesses event objects with the sensitive data, and wherein the event objects comprise a touch event, pointer event, input event, or a keyboard event.

### Claim 16

A network traffic manager apparatus, comprising memory comprising programmed instructions stored in the memory and processors configured to be capable of executing the programmed instructions stored in the memory to:
provide instrumentation code for serving to a client computing device with a web page requested by the client computing device, the instrumentation code configured to monitor web code execution at the client computing device when a script referenced by the web page is processed and generate script activity data;
receive the script activity data generated by the instrumentation code at the client computing device, the script activity data describing one or more script actions detected by the instrumentation code;
obtain prior script activity data generated by a prior instance of the instrumentation code served with the web page to one or more other client computing devices;
detect a malicious change in the script based on comparing the script activity data and the prior script activity data; and
in response to detecting the malicious change in the script, perform a threat response action.

### Claim 17 (depends on 16)

The device as set forth in claim 16, wherein the generated script activity data comprises a description of a usage from the web code execution of Web API interface aspects that enables reading contents of a form field of the web page that is configured to receive data input by a user.

### Claim 18 (depends on 16)

The device as set forth in claim 16, wherein the instrumentation code is further configured to monitor the web code execution to determine whether the web code execution accessed a particular web element.

### Claim 19 (depends on 16)

The device as set forth in claim 16, wherein the generated script activity data comprises a description of attempts by the web code execution to access a particular form field associated with sensitive data.

### Claim 20 (depends on 19)

The device as set forth in claim 19, wherein the instrumentation code is further configured to monitor the web code execution to determine whether the web code execution accesses event objects with the sensitive data, and wherein the event objects comprise a touch event, pointer event, input event, or a keyboard event.

### Claim 21

A network traffic management system, comprising traffic management apparatuses, server devices, or client devices, the network traffic management system comprising memory comprising programmed instructions stored thereon and processors configured to be capable of executing the stored programmed instructions to:
provide instrumentation code for serving to a client computing device with a web page requested by the client computing device, the instrumentation code configured to monitor web code execution at the client computing device when a script referenced by the web page is processed and generate script activity data;
receive the script activity data generated by the instrumentation code at the client computing device, the script activity data describing one or more script actions detected by the instrumentation code;
obtain prior script activity data generated by a prior instance of the instrumentation code served with the web page to one or more other client computing devices;
detect a malicious change in the script based on comparing the script activity data and the prior script activity data; and
in response to detecting the malicious change in the script, perform a threat response action.

### Claim 22 (depends on 21)

The network traffic management system as set forth in claim 21, wherein the generated script activity data comprises a description of a usage from the web code execution of Web API interface aspects that enables reading contents of a form field of the web page that is configured to receive data input by a user.

### Claim 23 (depends on 21)

The network traffic management system as set forth in claim 21, wherein the instrumentation code is further configured to monitor the web code execution to determine whether the web code execution accessed a particular web element.

### Claim 24 (depends on 21)

The network traffic management system as set forth in claim 21, wherein the generated script activity data comprises a description of attempts by the web code execution to access a particular form field associated with sensitive data.

### Claim 25 (depends on 24)

The network traffic management system as set forth in claim 24, wherein the instrumentation code is further configured to monitor the web code execution to determine whether the web code execution accesses event objects with the sensitive data, and wherein the event objects comprise a touch event, pointer event, input event, or a keyboard event.
