标 题: Java虚拟机拦截之GPS信息伪造
作 者: 蟑螂一号
时 间: 2013-11-16 10:40:00
原文链接:
9d7K9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8Y4N6%4N6#2)9J5k6i4y4S2L8Y4N6Z5L8#2)9J5k6h3y4G2L8g2)9J5c8U0x3%4x3#2)9J5k6h3S2@1L8h3H3`.
android中java层拦截涉及so注入,动态加载jar技术。相关技术实现细节可以参考古河大哥的libinject.so以及相关动态加载技术的文章。由于java层拦截是修改服务代理达到目的,服务代理中的关键函数如下:
transact(int arg0, Parcel arg1, Parcel arg2, int arg3)
函数中arg0表示函数调用编号,arg1表示请求数据包容器,arg2表示应答数据包容器,arg3不用管。
以下是gps经纬度伪造的关键修改处,仅供学习交流。
@Override
public boolean transact(int arg0, Parcel arg1, Parcel arg2, int arg3)
throws RemoteException {
// TODO Auto-generated method stub
Log.i(“hooklocation”, “transact**********:” + arg0);
// if(true)
// {
// Log.i(“hooklocation”,”transact**********return true”);
// return true;
// }
int getLastKnowLocation = HookUtil.getStaticFiled(
“android.location.ILocationManager$Stub”,
“TRANSACTION_getLastKnownLocation”);
Log.i(“hooklocation”, “********transact arg0:” + arg0);
if (arg0 == getLastKnowLocation) {
// Parcel data=arg1;
// Parcel reply=arg2;
Log.i(“hooklocation”, “getLastKnowLocation**********:” + arg0);
arg2.setDataPosition(0);
arg1.setDataPosition(0);
arg1.enforceInterface(“android.location.ILocationManager”);
java.lang.String _arg0;
_arg0 = arg1.readString();
Log.i(“hooklocation”, “_arg0:” + _arg0);
android.location.Location _result = new Location(_arg0);
_result.setLatitude(1111111111111111.12);
_result.setAltitude(2222222222222222.12);
arg2.writeNoException();
if (_result != null) {
arg2.writeInt(1);
_result.writeToParcel(arg2,
android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Log.i(“hooklocation”, “_result:” + _result);
} else {
Log.i(“hooklocation”, “_result:null”);
arg2.writeInt(0);
}
//Log.i(“hooklocation”, “arg2:” + arg);
arg2.setDataPosition(0);
return true;
/*
* Log.i(“hooklocation”, “getLastKnowLocation**********:” + arg0);
* arg2.writeNoException(); arg2.writeInt(0); return true;
*/
}
return this.binder.transact(arg0, arg1, arg2, arg3);
}
[培训]科锐逆向工程师培训第53期2025年7月8日开班!