Some understanding of PHP shortest Webshell

Source: Internet
Author: User

The shortest webshell of PHP

One day wandering Wooyun, found a very interesting article ———— "32C3 CTF two Web topics writeup." It mentions two interesting things:

The shortest webshell of PHP

PHP execution Operator Inverted quote

The article mentioned above, I read several times before the time is very puzzling! Later, the toast of the P-ox gave me some pointers, suddenly enlightened

Google "The shortest Webshell"


<?= ' $_get[1] '?>


One of the results from Google is 15 characters, as shown above. What's interesting here is that

PHP.ini need to open short_open_tag to use the short label, can use <?= instead of.? Echo
Parsing with semicolon-delimited statements in PHP

The last line does not require a semicolon

PHP multiple statements can be written in the same, but need to be separated by semicolons
As long as the whitespace between multiple semicolons, PHP is allowed! (to be studied)

<?= ' $_get[1] ';

Google gets the shortest webshell as shown above, a total of 14 characters

The closing tag is removed, but the semicolon is added.
The last line does not require a semicolon, but must be a closed tag!
In addition, it is not feasible to embed this type of writing in other files, so you must write a closing tag!
The magical uses of bash in Linux


<?= ' * ';


A 7 character, what can these seven characters do?

In a Linux system, running on a terminal is the same as the above!
* Used to match all file names (including directory names) under the directory.
An inverted quote is an execution operator that executes the file name in the directory as a command! The next thing is Linux.

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.