Web Application XSS Protection via Automatic CSP Header Generation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing web applications are vulnerable to cross-site scripting (XSS) attacks due to the lack of separation between code and presentation components, making them incapable of utilizing Content Security Policy (CSP) headers for protection.

Innovation Solution

Automatically modifying web application output by stripping out code components, replacing them with placeholders, and adding correct CSP headers, allowing for real-time transformation into CSP-compliant output without developer intervention.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If web applications are written with separation of code and presentation components to enable CSP headers, then security against XSS attacks is improved, but application complexity and development difficulty increase

Engineering Contradiction:
ImprovesecurityVSAvoidapplication complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent automatically segments the web application output by parsing HTML content and separating script components from presentation components. This is achieved through regex-based pattern matching that identifies script tags, event handlers, and other code elements, then extracts them into separate artifacts while maintaining the presentation layer intact.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an intermediary processing layer (the server-side script) that sits between the original web application and the browser. This intermediary automatically performs the separation of code and presentation, generates CSP headers, and delivers the processed content to users without requiring developers to modify their existing codebase.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If Content Security Policy headers are implemented to prevent XSS attacks, then security is improved, but compatibility with existing web applications deteriorates

Engineering Contradiction:
ImprovesecurityVSAvoidcompatibility
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

The patent implements a self-service mechanism where the server automatically processes web application output, extracts script components, and generates appropriate CSP headers without requiring any developer intervention or configuration. The system adapts to existing applications by analyzing their output structure and applying appropriate security policies automatically.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The patent creates a universal solution that works with existing web applications regardless of their specific framework or technology stack. The processing mechanism is framework-agnostic and can handle various types of web applications by automatically analyzing their output and applying appropriate CSP policies, making it universally applicable across different platforms.

Inventive Principle:
Principle #6Universality (Multi-functionality)

3Reliability

If code components are separated from presentation components and served as separate artifacts, then CSP header functionality is improved, but processing time and server load increase

Engineering Contradiction:
ImproveCSP functionalityVSAvoidprocessing time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent applies partial action by selectively processing only the portions of web application output that contain script components or event handlers. Rather than processing entire pages uniformly, the system uses pattern matching to identify and extract only the relevant code portions, reducing overall processing time while maintaining CSP functionality.

Inventive Principle:
Principle #16Partial or excessive action

Solution Approach 2:

The patent performs preliminary parsing and identification of script components during the request processing phase, before the actual CSP header generation. By pre-identifying script tags and event handlers in the incoming request, the system can efficiently extract and process only the necessary portions, reducing the time required for the actual separation and header generation.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS10318732B2Prevention of cross site scripting attacks using automatic generation of content security policy headers and splitting of content to enable content security policy
Publication Date: 2019.06.11 TREND MICRO INC
  • US10318732B2 patent drawing
  • US10318732B2 patent drawing
  • US10318732B2 patent drawing

AI summary

The present disclosure provides a method and system for transforming web application output that is vulnerable to XSS attacks to CSP-compliant web application output. This transformation is accomplished by parsing the output code to identify headers and script and splitting the headers and script to form CSP-compliant web application output.