---
name: break-filter-js-from-html
description: This skill provides guidance for XSS filter bypass tasks where the goal is to craft HTML payloads that execute JavaScript despite sanitization filters. Use this skill when tasks involve bypassing HTML sanitizers (like BeautifulSoup), exploiting parser differentials between server-side sanitizers and browsers, or security testing/CTF challenges involving XSS filter evasion.
---
# XSS Filter Bypass Methodology
## Overview
This skill provides a systematic approach for bypassing HTML/JavaScript sanitization filters in authorized security testing contexts (CTF challenges, penetration testing, security research). The methodology emphasizes understanding filter mechanisms before attempting bypasses, avoiding trial-and-error approaches in favor of systematic analysis.
## Phase 1: Filter Analysis
Before attempting any bypasses, thoroughly analyze the filter implementation:
### Identify the Sanitization Library
- Determine which library performs sanitization (BeautifulSoup, DOMPurify, html-sanitizer, etc.)
- Identify the parser being used (html.parser, lxml, html5lib for BeautifulSoup)
- Research known quirks and bypass techniques for that specific library/parser combination
### Map Filter Behavior
Create a systematic map of what the filter blocks vs. preserves:
1. **Blocked Elements**: Test which HTML tags are removed
- Script-related: `-->`
- **Encoding mismatches**: UTF-7, charset switching
### Category 2: Alternative JavaScript Execution Vectors
If ``
- **SVG event handlers**: `