IP Library Granted Patent US 10,223,533
Granted Patent B2
US 10,223,533 · App. 14/519,511 · Granted Mar 5, 2019

Systems and methods for analysis of cross-site scripting vulnerabilities

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 10,223,533
App. No.
14/519,511
Granted
Mar 5, 2019
Kind
B2
Abstract

A system for detecting XSS vulnerabilities includes determining the context in which a probe supplied as an input to a webpage or an application exists in a script associated with the webpage or application. A payload is generated based on, at least in part, the context such that during execution of the script, an executable code fragment in the payload can escape out of the context in which the probe exists and into a the global context of the script. The payload may include additional characters that prevent the payload from causing errors in the execution of the script.

Claims (70)

1. A method comprising:

supplying to a target an input that comprises a first probe;

based on a response that includes the first probe within a script element, generating a syntax tree model from the script element;

determining a context in which the first probe exists within the script element based on the syntax tree model;

generating an attack payload to detect vulnerability of the target to escape out of the context; and

supplying the attack payload to the target.

2. The method of claim 1 , further comprising:

determining that the response includes the first probe;

identifying a location of the first probe within the response; and

determining that the location is associated with the script element, wherein generating the syntax tree model is based on the determination that the first probe is at the location associated with the script element.

3. The method of claim 1 , further comprising:

crawling a website to determine a plurality of webpages that accept input, wherein the plurality of webpages includes the target;

generating a second probe in addition to the first probe;

supplying to the plurality of webpages inputs comprising the first and the second probes, which includes supplying the input to the target;

based on a second response that includes the second probe within a second script element, generating a second syntax tree model from the second script element;

determining a second context in which the second probe exists within the second script element based on the second syntax tree model;

generating a second attack payload to detect vulnerability of the website to escape out of the second context; and

supplying the second attack payload to the website.

4. The method of claim 1 , wherein the context in which the first probe exists comprises at least one of: a variable assignment, an integer assignment, a function definition, an if-then-else structure, a nested structure, and a function argument.

5. The method of claim 1 , wherein generating the attack payload comprises:

determining a number N, wherein N is indicative of a number of structures within which the context is nested, wherein determining the context comprises determining that the context is a nested structure; and

generating the attack payload with, in order, N context closing elements, a function for reporting vulnerability, and N context opening elements.

6. The method of claim 1 , wherein generating the attack payload to detect vulnerability of the target to escape out of the context comprises generating the attack payload to detect vulnerability of the target to escape out of the context to a global context of the target.

7. The method of claim 1 , wherein generating the attack payload comprises generating the attack payload with a set of one or more escape characters to escape the determined context to a global context of the target and with a function to report the vulnerability.

8. The method of claim 1 , wherein generating the attack payload to detect vulnerability of the target to escape out of the context comprises generating the attack payload to detect vulnerability of the target to escape out of the context and to avoid parsing errors when the script element is executed with the attack payload.

9. A system comprising:

a processor; and

a storage medium comprising instructions executable by the processor to cause the system to,

supply to a target an input that comprises a first probe;

based on a first response that includes the first probe within a first script element, generate a first syntax tree model from the first script element;

determine a first context in which the first probe exists within the first script element based on the first syntax tree model;

generate a first attack payload to detect vulnerability of the target to escape out of the first context; and

supply the first attack payload to the target.

10. The system of claim 9 , further comprising instructions executable by the processor to cause the system to:

determine that the first response includes the first probe;

identify a location of the first probe within the first response; and

determine that the location is associated with the first script element, wherein the instructions to generate the first syntax tree model comprise the instructions to generate the first syntax tree model based on a determination that the first probe is at the location associated with the first script element.

11. The system of claim 9 , further comprising instructions executable by the processor to cause the system to:

crawl a website to determine a plurality of webpages that accept input, wherein the plurality of webpages includes the target;

generate multiple probes, wherein the instructions to generate multiple probes include the instructions to generate the first probe;

supply to the plurality of webpages inputs comprising the multiple probes, wherein the instructions to supply to the plurality of webpages the inputs comprise the instructions to supply the input to the target;

based on each response that includes at least one of the multiple probes within a script element, generate syntax tree models from the script elements of the responses, wherein the instructions to generate the syntax tree models comprise the instructions to generate the first syntax tree model;

for each of the syntax trees models, determine a context in which a corresponding one of the multiple probes exist within a corresponding one of the script element based on the syntax tree model, wherein the instructions to determine the context comprise the instructions to determine the first context;

for each of the determined contexts, generate an attack payload to detect vulnerability of the website to escape out of the context, wherein the instructions to generate the attack payload comprise the instructions to generate the first attack payload; and

supply the attack payloads to the website, wherein the instructions to supply the first attack payload comprise the instructions to supply the first attack payload.

12. The system of claim 9 , wherein the first context in which the first probe exists comprises at least one of: a variable assignment, an integer assignment, a function definition, an if-then-else structure, a nested structure, and a function argument.

13. The system of claim 9 , wherein the instructions to cause the system to generate the first attack payload comprise instructions executable by the processor to cause the system to:

determine a number N, wherein N is indicative of a number of structures within which the context is nested, wherein the instructions to determine the first context comprise instructions executable by the processor to cause the system to determine that the first context is a nested structure; and

generate the first attack payload with, in order, N context closing elements, a function for reporting vulnerability, and N context opening elements.

14. The system of claim 9 , wherein the instructions executable to cause the system to generate the first attack payload to detect vulnerability of the target to escape out of the context comprise instructions executable by the processor to cause the system to generate the first attack payload to detect vulnerability of the target to escape out of the context to a global context of the target.

15. The system of claim 9 , wherein the instructions executable to cause the system to generate the first attack payload comprise instructions executable by the processor to cause the system to generate the first attack payload with a set of one or more escape characters to escape the determined first context to a global context of the target and with a function to report the vulnerability.

16. The system of claim 9 , wherein the instructions executable to cause the system to generate the first attack payload to detect vulnerability of the target to escape out of the first context comprise instructions executable by the processor to cause the system to generate the first attack payload to detect vulnerability of the target to escape out of the first context and to avoid parsing errors when the first script element is executed with the first attack payload.

17. A processor-readable storage medium comprising instructions executable by the processor to:

supply to a target an input that comprises a first probe,

based on a response that includes the first probe within a script element, generate a syntax tree model from the script element,

determine a context in which the first probe exists within the script element based on the syntax tree model,

generate an attack payload to detect vulnerability of the target to escape out of the context, and

supply the attack payload to the target.

18. The processor-readable storage medium of claim 17 , further comprising instructions to:

determine that the response includes the first probe;

identify a location of the first probe within the response; and

determine that the location is associated with the script element, wherein the instructions to generate the syntax tree model comprise the instructions to generate the syntax tree model based on the determination that the first probe is at the location associated with the script element.

19. The processor-readable storage medium of claim 17 , wherein the instructions to generate the attack payload comprise instructions to generate the attack payload to detect vulnerability of the target to escape out of the context to a global context of the target.

20. The processor-readable storage medium of claim 17 , wherein the instructions to generate the attack payload comprise instructions to:

crawl a website to determine a plurality of webpages that accept input, wherein the plurality of webpages includes the target;

generate multiple probes, wherein the instructions to generate multiple probes include the instructions to generate the first probe;

supply to the plurality of webpages inputs comprising the multiple probes, wherein the instructions to supply to the plurality of webpages the inputs comprise the instructions to supply the input to the target;

based on each response that includes at least one of the multiple probes within a script element, generate syntax tree models from the script elements of the responses, wherein the instructions to generate the syntax tree models comprise the instructions to generate the first syntax tree model;

for each of the syntax trees models, determine a context in which a corresponding one of the multiple probes exist within a corresponding one of the script element based on the syntax tree model, wherein the instructions to determine the context comprise the instructions to determine the first context;

for each of the determined contexts, generate an attack payload to detect vulnerability of the website to escape out of the context, wherein the instructions to generate the attack payload comprise the instructions to generate the first attack payload; and supply the attack payloads to the website, wherein the instructions to supply the first attack payload comprise the instructions to supply the first attack payload.

Assignments (4)
SECURITY INTEREST Recorded May 25, 2022
From: VERACODE, INC
To: DEUTSCHE BANK AG NEW YORK BRANCH, AS COLLATERAL AGENT
Reel/Frame 060011/0351 →
RELEASE OF SECURITY INTEREST IN PATENTS Recorded May 2, 2022
From: BARCLAYS BANK PLC, AS AGENT
To: VERACODE, INC.
Reel/Frame 059846/0650 →
INTELLECTUAL PROPERTY SECURITY AGREEMENT Recorded Nov 5, 2020
From: VERACODE, INC.
To: BARCLAYS BANK PLC, AS COLLATERAL AGENT
Reel/Frame 054330/0624 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 12, 2015
From: DAWSON, ISAAC M.
To: VERACODE, INC.
Reel/Frame 034683/0227 →
Cited By (18)
US 12,190,330 US 12,204,564 US 12,216,794 US 12,259,882 US 12,265,896 US 12,277,232 US 12,288,233 US 12,299,065 US 12,353,405 US 12,381,915 US 12,412,140 US 12,536,329 US 12,591,828 US 12,609,938 US 12,641,108 US 12,688,324 US 12,694,044 US 12,718,167