Mutated JavaScript Tokens for XSS Defense

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current methods for preventing cross-site scripting (XSS) attacks, such as Content Security Policy (CSP), are difficult to adopt and implement due to the requirement of refactoring websites, especially in handling inline JavaScript programs, leading to low adoption rates and inefficiencies in detecting vulnerabilities.

Innovation Solution

Implementing a moving target defense (MTD) by maintaining multiple versions of a website with randomly mutated JavaScript, where a server selects a version for each request, and browsers adjust their JavaScript interpreters accordingly, allowing inline JavaScript while preventing malicious scripts by mutating specific tokens like the left parenthesis and assignment operator.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If Content Security Policy (CSP) is implemented to prevent XSS attacks by prohibiting inline JavaScript, then XSS protection is improved, but website refactoring complexity and implementation difficulty increase significantly

Engineering Contradiction:
ImproveXSS protectionVSAvoidwebsite refactoring complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent changes the parameter of JavaScript token representation by introducing mutated forms of lexical tokens (such as transforming '(' into '\x28' or other obfuscated forms). This allows inline JavaScript to remain functional while making it unreadable and unusable for XSS attackers, thus achieving protection without requiring website refactoring.

Inventive Principle:
Principle #35Parameter changes

Solution Approach 2:

The patent segments the JavaScript delivery process into multiple stages: (1) serving mutated JavaScript code to legitimate users, (2) providing a translation layer that converts mutated tokens back to normal JavaScript in the browser, and (3) detecting non-mutated JavaScript patterns that indicate XSS attacks. This segmentation enables protection without refactoring the core website structure.

Inventive Principle:
Principle #1Segmentation

2Reliability

If traditional XSS prevention methods are used, then security is improved, but detection precision of vulnerabilities decreases due to inability to distinguish malicious from legitimate inline JavaScript

Engineering Contradiction:
ImprovesecurityVSAvoidvulnerability detection precision
Core Design Contradiction:
ReliabilityVSMeasurement precision

Solution Approach 1:

By transforming JavaScript lexical tokens into mutated forms (e.g., changing '(' to '\x28' or other obfuscated representations), the system creates a distinctive parameter pattern that serves as a fingerprint for legitimate JavaScript. This enables precise detection of XSS attacks, which will use normal unmutated tokens, thereby improving vulnerability detection precision while maintaining security.

Inventive Principle:
Principle #35Parameter changes

3Reliability

If inline JavaScript is prohibited to prevent XSS, then XSS protection is improved, but web functionality and developer flexibility deteriorate

Engineering Contradiction:
ImproveXSS protectionVSAvoidweb functionality
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

The patent creates a virtual copy of the JavaScript execution environment where mutated tokens are translated back to their normal forms before execution. This copying approach allows inline JavaScript to function normally for legitimate purposes while the mutated form prevents XSS attacks, thus preserving web functionality and developer flexibility without sacrificing security.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS9521133B2Moving target defense against cross-site scripting
Publication Date: 2016.12.13 THE UNIV OF NORTH CAROLINA AT CHAPEL HILL
  • US9521133B2 patent drawing
  • US9521133B2 patent drawing
  • US9521133B2 patent drawing

AI summary

A method, in a server, implementing a moving target defense against cross-site scripting includes receiving a request for a web page, wherein the server has N versions of the web page each with a mutated version of JavaScript; selecting a web page of the N versions; and sending an indication of the mutated version of JavaScript associated with the web page in response to the request. Another method, in a client device, using a moving target defense against cross-site scripting includes requesting a web page; receiving an indication of a mutated version of JavaScript for the web page; and adjusting a JavaScript interpreter based on the mutated version of JavaScript for the web page.