Bypass Cross-site scripting (XSS) filtering using HEX Encoding
Cross-site scripting (XSS) is a common vulnerability in Web vulnerability analysis. In many cases, it was easy to enter without filtering easily, but most of the services analyzed had strong filtering. However, there are rules in this filtering as well, and hackers can easily bypass filtering rules. In this circumstance, I would like to see a filtering bypass through HEX Encoding.
1. What is HEX Encoding?
HEX encoding is a way to represent hex data on the web via string “& # x”. It is called hex encoding to make it comfortable.
2. Insert simple XSS filter and general XSS syntax
The principle is simple. If you append 41 & # x to the hex value representing A, it means & # x41, that is, text A.
Most XSS filters use the special characters & lt; & Gt; Etc. I’d like to convert to an attacker being able to use the script,
this section is verified if the filtering for user input, an attacker can bypass the filtering rules by using the encoded data.
For example, consider the following XSS filtering function.
$output = str_replace(“<“,”<”,$inputString);
$output = str_replace(“>”,”>”,$output);
$sqlIn = $_GET[‘title’];
$sqlIn = XSSFilter($sqlIn);
/?title=<script>alert(1)</script> When you put the attack syntax in the form of the following, the posts will be filtered and appear as below.
3. XSS through HEX Encoding
Let’s try inserting the XSS syntax in a slightly different way than the one above. In the same way, we put the script syntax in the title parameter, but we put it in hex.
The XSSFilter function that is created in the above transmission is not filtered by the str_replace function. If the hex encoding is released when the DB is saved and exposed on the bulletin board, the following complete script syntax appears.
4. Bypassing XSS
In fact, I do not think there is anything about XSS bypassing methods. By default, the encoding is widely known, but actually I think the most important thing that seems to be a function of the XSS filter rules. BBT (BlackBoxTest) in the inferred rules through repeated testing and speculation, etc. because you can not see the code, you can succeed in bypassing the rules XSS attacks hayeoyaman find loopholes in it.