Skip to content

6- Developer Backdoors & Hidden Functionality

Si nos vamos al código de DoLogin.java

Vemos que el usuario devlogin se puede loguear en el endpoint /devlogin

java
public void postData(String valueIWantToSend) throws BadPaddingException, JSONException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, IOException, InvalidKeyException, InvalidAlgorithmParameterException {
            HttpResponse responseBody;
            HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost(DoLogin.this.protocol + DoLogin.this.serverip + ":" + DoLogin.this.serverport + "/login");
            HttpPost httppost2 = new HttpPost(DoLogin.this.protocol + DoLogin.this.serverip + ":" + DoLogin.this.serverport + "/devlogin");
            List<NameValuePair> nameValuePairs = new ArrayList<>(2);
            nameValuePairs.add(new BasicNameValuePair("username", DoLogin.this.username));
            nameValuePairs.add(new BasicNameValuePair("password", DoLogin.this.password));
            if (DoLogin.this.username.equals("devadmin")) {
                httppost2.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                responseBody = httpclient.execute(httppost2);
            } else {
                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                responseBody = httpclient.execute(httppost);
            }
            InputStream in = responseBody.getEntity().getContent();
            DoLogin.this.result = convertStreamToString(in);
            DoLogin.this.result = DoLogin.this.result.replace("\n", "");
            if (DoLogin.this.result != null) {
                if (DoLogin.this.result.indexOf("Correct Credentials") != -1) {
                    Log.d("Successful Login:", ", account=" + DoLogin.this.username + ":" + DoLogin.this.password);
                    saveCreds(DoLogin.this.username, DoLogin.this.password);
                    trackUserLogins();
                    Intent pL = new Intent(DoLogin.this.getApplicationContext(), (Class<?>) PostLogin.class);
                    pL.putExtra("uname", DoLogin.this.username);
                    DoLogin.this.startActivity(pL);
                    return;
                }
                Intent xi = new Intent(DoLogin.this.getApplicationContext(), (Class<?>) WrongLogin.class);
                DoLogin.this.startActivity(xi);
            }
        }
Pasted image 20260830131038

Interceptamos la petición y cambiamos el endpoint por /devlogin

Pasted image 20260830131130

Nos podemos loguear como ese usuario sin contraseña, incluso sin proporcionar el parámetro de la contraseña.

Aquí se demuestra que estamos logueados como ese usuario:

Pasted image 20260830130814

En el código de LoginActivity.java hay un botón que desaparece si el string is_admin de /resources/res/values/strings.xml está en "no"

java
String mess = getResources().getString(R.string.is_admin);
if (mess.equals("no")) {
	View button_CreateUser = findViewById(R.id.button_CreateUser);
	button_CreateUser.setVisibility(8);
}

Si nos fijamos en activity_log_main.xml hay un botón de crear usuario

xml
 <Button
	android:textSize="15sp"
	android:textStyle="bold"
	android:textColor="#890000"
	android:layout_gravity="center"
	android:id="@+id/button_CreateUser"
	android:layout_width="wrap_content"
	android:layout_span="2"
	android:text="Create User"/>

Podríamos parchear el APK para cambiarlo, pero no va A valer la pena porque no dispara mucha funcionalidad extra:

java
protected void createUser() {
	Toast.makeText(this, "Create User functionality is still Work-In-Progress!!", 1).show();
}

Notas personales de seguridad ofensiva.