Android Security Code

Source: Internet
Author: User

  • WebView Remote Code Execution
    • On API16 (Android 4.2) and previous systems, If you use the Webview.addjavascriptinterface method to implement a native Java interface through JavaScript calls, the system does not have any restrictions on the registered Java class method invocation, which could allow an attacker to invoke the vulnerability by using the Java Reflection API to execute arbitrary j Ava object to achieve the purpose of the attack. The vulnerability code for injecting Java object injectedobject into JavaScript is as follows:
        WebView WebView = new WebView (this);        Webview.getsettings (). Setjavascriptenabled (true);        Webview.addjavascriptinterface (This, "injectedobject");        Webview.loadurl ("http://www.asce1885.com/index.html");
    • The attacker's HTML page below gives you the GetRuntime method to execute a series of shell commands, whatever you like:
      <! DOCTYPE html>

    • The solution to the vulnerability is as follows:
      • Api>16. Android-given solution using @javascriptinterface annotations on methods of Java classes
      • Api<=16 strongly recommends that you do not use the Addjavascriptinterface interface again, but instead use the Safe-java-js-webview-bridge function library
      • Remove the following default interface inside the Android system (this does not understand )

Android Security Code

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.