# US 2021/0176273 A1 · Detecting compromised web pages in a runtime environment

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

- Number: US 2021/0176273 A1
- Document ID: US20210176273A1
- Status: Published application
- Kind: A1
- Application number: 16/709,198
- Filed: 2019-12-10
- Published: 2021-06-10
- Earliest claimed: 2019-12-10
- Assignees: Shape Security, Inc.
- Applicants: Shape Security, Inc.
- Inventors: WESLEY HALES; JARROD OVERSON
- Web page: https://patentgrep.com/patent/US20210176273A1

## CPC

- G06F 21/55: Detecting local intrusion or implementing counter-measures
- H04L 63/1483: {service impersonation, e.g. phishing, pharming or web spoofing (detection of rogue wireless access points H04W12/12)}
- G06F 16/986: {Document structures and storage, e.g. HTML extensions}
- G06F 21/554: {involving event detection and direct action}
- G06F 21/566: {Dynamic detection, i.e. detection performed at run-time, e.g. emulation, suspicious activities}
- H04L 63/1416: {Event detection, e.g. attack signature detection}
- 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]
- G06F 2221/2119: Authenticating web pages, e.g. with suspicious links
- 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 compromised web pages in a runtime environment. A first version of a web page is retrieved and loaded in a browser comprising a browser extension configured to detect event listeners added when web pages are loaded by the browser. First data is generated describing a first set of event listeners detected by the browser extension when the first version of the web page is loaded. At a second time a second version of the web page is retrieved and loaded in the browser. Second data is generated describing a second set of event listeners detected by the browser extension when the second version of the web page is loaded. It is determined that the web page is compromised based on comparing the first data and the second data. In response to determining that the web page is compromised, a threat response action is performed.

## Claims

### Claim 1

A computer system comprising:
one or more hardware processors;
a memory coupled to the one or more hardware processors and storing one or more instructions which, when executed by the one or more hardware processors, cause the one or more hardware processors to:
at a first time, retrieve and load a first version of a web page hosted on a web server system in a browser comprising a browser extension configured to detect event listeners added when web pages are loaded by the browser;
generate first data describing a first set of event listeners detected by the browser extension when the first version of the web page is loaded;
at a second time after the first time, retrieve and load a second version of the web page in the browser;
generate second data describing a second set of event listeners detected by the browser extension when the second version of the web page is loaded;
determine that the web page is compromised based on comparing the first data and the second data; and
in response to determining that the web page is compromised, perform a threat response action.

### Claim 2 (depends on 1)

The computer system of claim 1, wherein the one or more instructions, when executed by the one or more hardware processors, cause the one or more hardware processors to:
at a third time, retrieve and load a first version of a second web page hosted on a second web server system in the browser;
generate third data describing a third set of event listeners detected by the browser extension when the first version of the second web page is loaded;
at a fourth time after the third time, retrieve and load a second version of the second web page in the browser;
generate fourth data describing a fourth set of event listeners detected by the browser extension when the second version of the second web page is loaded;
determine that the second web page is compromised based on comparing the third data and the fourth data; and
in response to determining that the second web page is compromised, perform a second threat response action.

### Claim 3 (depends on 1)

The computer system of claim 1:
wherein the one or more computing devices performing the method belong to a security server system configured to detect, in a plurality of web pages hosted by a plurality of web server systems, compromised web pages;
wherein the plurality of web pages includes the web page;
wherein the plurality of web server systems includes the web server system.

### Claim 4 (depends on 1)

The computer system of claim 1, wherein the threat response action comprises notifying the web server system that the web page is compromised.

### Claim 5 (depends on 1)

The computer system of claim 1, wherein the threat response action comprises preventing a client computing device that requests the web page from receiving the web page from the web server system.

### Claim 6 (depends on 1)

The computer system of claim 1:
wherein the first version of the web page includes first web code that adds the first set of event listeners to one or more elements of a first Document Object Model (DOM) tree generated by the browser when the first version of the web page is loaded;
wherein the second version of the web page includes second web code that adds the second set of event listeners to one or more elements of a second DOM tree generated by the browser when the second version of the web page is loaded.

### Claim 7 (depends on 6)

The computer system of claim 6:
wherein the browser extension detects the first set of event listeners by traversing the first DOM tree;
wherein the browser extension detects the second set of event listeners by traversing the second DOM tree.

### Claim 8 (depends on 1)

The computer system of claim 1:
wherein loading the second version of the web page causes malicious web code to be loaded in a runtime environment of the browser;
wherein the malicious web code second web code adds a malicious event listener that creates an XMLHttpRequest (XHR) object.

### Claim 9 (depends on 1)

The computer system of claim 1, wherein the one or more instructions, when executed by the one or more hardware processors, cause the one or more hardware processors to:
after the first time, periodically retrieve and loading subsequent versions of the web page in the browser and retrieving subsequent data describing event listeners detected by the browser extension when the subsequent versions of the web page are loaded; and
compare the subsequent data with baseline data comprising the first data to determine whether the web page is compromised.

### Claim 10 (depends on 9)

The computer system of claim 9, wherein the one or more instructions, when executed by the one or more hardware processors, cause the one or more hardware processors to:
receive an indication from the web server system that the web page has changed at the web server system;
retrieve and load an updated version of the web page in the browser;
generate updated data describing an updated set of event listeners detected by the browser extension when the updated version of the web page is loaded; and
update the baseline data with the updated data.

### Claim 11 (depends on 1)

The computer system of claim 1, wherein the one or more instructions, when executed by the one or more hardware processors, cause the one or more hardware processors to:
based on the first data, generate an XHR whitelist comprising server addresses associated with the first set of event listeners;
provide XHR whitelist code for execution on a client computing device that requests the web page after the first time, wherein the XHR whitelist code prevents XHR requests to server addresses not included in the XHR whitelist.

### Claim 12 (depends on 1)

The computer system of claim 1, wherein the XHR whitelist code is provided for execution on the client computing device by causing insertion of the XHR whitelist code into the web page such that a browser executing on the client computing device executes the XHR whitelist code when loading the web page.

### Claim 13

A method comprising:
at a first time, retrieving and loading a first version of a web page hosted on a web server system in a browser comprising a browser extension configured to detect event listeners added when web pages are loaded by the browser;
generating first data describing a first set of event listeners detected by the browser extension when the first version of the web page is loaded;
at a second time after the first time, retrieving and loading a second version of the web page in the browser;
generating second data describing a second set of event listeners detected by the browser extension when the second version of the web page is loaded;
determining that the web page is compromised based on comparing the first data and the second data; and
in response to determining that the web page is compromised, performing a threat response action;
wherein the method is performed by one or more computing devices.

### Claim 14 (depends on 13)

The method of claim 13, further comprising:
at a third time, retrieving and loading a first version of a second web page hosted on a second web server system in the browser;
generating third data describing a third set of event listeners detected by the browser extension when the first version of the second web page is loaded;
at a fourth time after the third time, retrieving and loading a second version of the second web page in the browser;
generating fourth data describing a fourth set of event listeners detected by the browser extension when the second version of the second web page is loaded;
determining that the second web page is compromised based on comparing the third data and the fourth data;
in response to determining that the second web page is compromised, performing a second threat response action.

### Claim 15 (depends on 13)

The method of claim 13:
wherein the one or more computing devices performing the method belong to a security server system configured to detect, in a plurality of web pages hosted by a plurality of web server systems, compromised web pages;
wherein the plurality of web pages includes the web page;
wherein the plurality of web server systems includes the web server system.

### Claim 16 (depends on 13)

The method of claim 13, wherein the threat response action comprises notifying the web server system that the web page is compromised.

### Claim 17 (depends on 13)

The method of claim 13, wherein the threat response action comprises preventing a client computing device that requests the web page from receiving the web page from the web server system.

### Claim 18 (depends on 13)

The method of claim 13:
wherein the first version of the web page includes first web code that adds the first set of event listeners to one or more elements of a first Document Object Model (DOM) tree generated by the browser when the first version of the web page is loaded;
wherein the second version of the web page includes second web code that adds the second set of event listeners to one or more elements of a second DOM tree generated by the browser when the second version of the web page is loaded.

### Claim 19 (depends on 18)

The method of claim 18:
wherein the browser extension detects the first set of event listeners by traversing the first DOM tree;
wherein the browser extension detects the second set of event listeners by traversing the second DOM tree.

### Claim 20 (depends on 13)

The method of claim 13:
wherein loading the second version of the web page causes malicious web code to be loaded in a runtime environment of the browser;
wherein the malicious web code second web code adds a malicious event listener that creates an XMLHttpRequest (XHR) object.

### Claim 21 (depends on 13)

The method of claim 13, further comprising:
after the first time, periodically retrieving and loading subsequent versions of the web page in the browser and retrieving subsequent data describing event listeners detected by the browser extension when the subsequent versions of the web page are loaded; and
comparing the subsequent data with baseline data comprising the first data to determine whether the web page is compromised.

### Claim 22 (depends on 21)

The method of claim 21, further comprising:
receiving an indication from the web server system that the web page has changed at the web server system;
retrieving and loading an updated version of the web page in the browser;
generating updated data describing an updated set of event listeners detected by the browser extension when the updated version of the web page is loaded; and
updating the baseline data with the updated data.

### Claim 23 (depends on 13)

The method of claim 13, further comprising:
based on the first data, generating an XHR whitelist comprising server addresses associated with the first set of event listeners; and
providing XHR whitelist code for execution on a client computing device that requests the web page after the first time, wherein the XHR whitelist code prevents XHR requests to server addresses not included in the XHR whitelist.

### Claim 24 (depends on 13)

The method of claim 13, wherein the XHR whitelist code is provided for execution on the client computing device by causing insertion of the XHR whitelist code into the web page such that a browser executing on the client computing device executes the XHR whitelist code when loading the web page.
