Checker PrivacyAndroid   as of Julia version 2.6.0 (built on 6 Sep 2018)

belongs to group Advanced

Identify potential dangerous information flows in Android applications


Consider the following program:

public class MainActivity extends AppCompatActivity {
    private Button button;
    private EditText text;

    protected void onCreate(Bundle savedInstanceState) {
        button = (Button) this.findViewById(;
        button.setOnClickListener( new View.OnClickListener() {
            public void onClick(View v) {
                String writeText=text.getText().toString();

    private void memorizeText(String writeText) {
        try {
            OutputStreamWriter outputStreamWriter = new OutputStreamWriter(this.openFileOutput("StoreMyNotes.txt", Context.MODE_PRIVATE));
        catch (IOException e) {

    private void onBugShake(){
        TelephonyManager tm =(TelephonyManager)getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
        try {
            URL myUrl = new URL(""+ Build.DEVICE+"&id="+ tm.getDeviceId()+"&system="+Build.VERSION.SDK_INT);
            URLConnection uc=myUrl.openConnection();
        } catch (IOException e) {

This checker issues the following warnings: [PrivacyAndroid: URLInjectionWarning] possible URL-injection through the 0th actual parameter of init

Let us discuss the motivation of the warning. What happens here is that sensitive information flows into the first parameter of an URL connection. The result is that the web server receives sensitive information of the device. In particular the example reports a sink of the IMEI code of the device. The source of the leak is coming from the method TelephonyManager.getDeviceId() annotated as @UntrustedDevice. At the same line the sink happens. Indeed the constructor (here comes the init) of an URL object receives a parameter that is the string representation of the URL. The parameter is annotated as @UrlTrusted then the warning is the result of tainted data flowing into the constructor parameter. The goal of the Privacy checker is similar to what performs the InjectionChecker. The Privacy checker applies the behaviours and the capabilities of the Injection checker to the Android OS context. Indeed the PrivacyChecker extends Injection, but it overwrites some options parameters. In particular the boolean @UntrustedDevice is the only true by default.