看到同学求助我这个东西,于是乎打开电脑看看这玩意。
打开就是这么一个黑屏,然后程序会一直设置手机音量为最大,播放xx声音,无法更改。但是这个和我想的类似锁机还不一样,这个退出来直接清理后台就没了。。
看完效果直接抄家伙。
看到包体文件结构里面有lua,so,然后lua还是被加密的。所以查阅lua vm的加载过程,定位到so当中的函数luaL_loadbuffer:[1]
往上找xref看一下。
直接有个jni函数BLX调用,应该不会太麻烦。
一看就很简单了,估计是为了过安全软件免杀才做的这个小加解密。用java层读入加密后的lua,load之前解密,然后load。
很显然这里是解密函数: 还对文件的第一个字节进行了判断,用010editor打开文件后发现文件都是以0x1B开头,验证通过。
直接复制过来 写出来c代码解密:
#include <stdio.h>
#include <stdlib.h>
unsigned char* decrypt_lua(unsigned char *a, int size){
if ( *a == 0x1B && a[1] != 76 )
{
unsigned char *v9 = (unsigned char *)malloc(size);
if ( size )
{
v9[0] = 27;
if ( size != 1 )
{
int v10 = 0;
int v11 = 1;
do
{
v10 += size;
v9[v11] = a[v11] ^ (v10
+ ((unsigned int)((0xFFFFFFFF80808081LL * v10 >> 32) + v10) >> 7)
+ ((signed int)((0xFFFFFFFF80808081LL * v10 >> 32) + v10) < 0));
++v11;
}
while ( size != v11 );
}
}
return v9;
}
}
解密出来LuaS文件
查询资料[2],试过了luadec [3],报错
发现要用另外一个工具unluac [4]:
java -jar unluac_2015_06_13.jar 2.lua > 3.lua
这样可以得到lua代码。程序的逻辑也就很清楚了。
local L0_0
appname = "\233\128\129\231\187\153\230\156\128\229\165\189\231\154\132TA"
appver = "1.0"
appcode = "10"
appsdk = "15"
path_pattern = ""
packagename = "com.sgzh.dt"
theme = "Theme_DeviceDefault_Dialog_NoActionBar_MinWidth"
app_key = ""
app_channel = ""
developer = ""
description = ""
debugmode = false
L0_0 = {
"INTERNET",
"WRITE_EXTERNAL_STORAGE"
}
user_permission = L0_0
require("import")
import("android.app.*")
import("android.os.*")
import("android.widget.*")
import("android.view.*")
import("android.view.View")
import("android.content.Context")
import("android.media.MediaPlayer")
import("android.media.AudioManager")
import("com.androlua.Ticker")
activity.getSystemService(Context.AUDIO_SERVICE).setStreamVolume(AudioManager.STREAM_MUSIC, 15, AudioManager.FLAG_SHOW_UI)
activity.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE)
m = MediaPlayer()
m.reset()
m.setDataSource(activity.getLuaDir() .. "/0.mp3")
m.prepare()
m.start()
m.setLooping(true)
ti = Ticker()
ti.Period = 10
function ti.onTick()
activity.getSystemService(Context.AUDIO_SERVICE).setStreamVolume(AudioManager.STREAM_MUSIC, 15, AudioManager.FLAG_SHOW_UI)
activity.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE)
end
ti.start()
function onKeyDown(A0_0, A1_1)
if string.find(tostring(A1_1), "KEYCODE_BACK") ~= nil then
activity.getSystemService(Context.AUDIO_SERVICE).setStreamVolume(AudioManager.STREAM_MUSIC, 15, AudioManager.FLAG_SHOW_UI)
end
return true
end
网传的其他隐私窃取的恶意行为应该是被人改版所为。我这里没有样本。
截屏函数实际只是AndroLua+提供的api,具体程序逻辑需要查看main.lua。
参考链接:
[1]https://blog.csdn.net/u014753748/article/details/97282549(浅析android手游lua脚本的加密与解密)
[2]https://www.52pojie.cn/forum.php?mod=viewthread&tid=697540&page=1&authorid=765171(lua脚本解密)
[3]https://github.com/viruscamp/luadec(luadec)
[4]https://sourceforge.net/projects/unluac/files/latest/download(unluac)