Reflective XSS for code-audit learning

Source: Internet
Author: User

0X01 Basics Introduction

XSS Vulnerability classification: generally divided into three kinds

Reflection Type XSS

Save-as XSS

Dom-based XSS

Learn reflective XSStoday: It sends a URL with malicious script code parametersto others, and when the URL address is opened, the unique malicious Code parameter is parsed and executed by HTML. Its features are non-persistent and must be clicked by a user with a link to a specific parameter.

Cause and utilization of 0x02

In general, many of the causes of vulnerabilities are due to the user's input too trust caused by the lack of rigorous filtering, usually in the process of code audit, audit to obtain user input functions or operations such as storage and so on

First, the direct output of the variable

For example:

<?php
echo$_get[' XSS '];
?>

Two: $_server variable parameter
$_server[' Php_self ']

Test code:

<?php
echo $_server[' php_self '];
?>

Pop-up window:

$_server[' Http_user_agent ']

This function is to get browser information

<?php
echo $_server[' http_user_agent '];
?>

Operation Result:

mozilla/5.0 (Windows NT 10.0; WOW64; rv:42.0) gecko/20100101 firefox/42.0

You can change the contents of user-agent via Firefox plugin modify headers:

$_server[' Http_referer ']

This one's going to change referer.

$_server[' Request_uri ']

This function obtains the contents of the URL and encodes the special characters, which must be used in PHP to achieve the effect of UrlDecode XSS.

With the UrlDecode () after:

<?php
echo urldecode ($_server[' Request_uri ');
?>

0X03 Summary

Knowledge of the incomplete, are some of the more basic things, know the principle, the back will slowly go deep!

Reflective XSS for code-audit learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.