Coder Social home page Coder Social logo

bhardwajrahul / android-maliciousaccessibilityserviceappsdetector Goto Github PK

View Code? Open in Web Editor NEW

This project forked from theowni/android-maliciousaccessibilityserviceappsdetector

0.0 1.0 0.0 97.54 MB

The application is a PoC that helps in identifying modern bankers, potentially malicious and remote controlling applications abusing Android AccessibilityService.

License: MIT License

Java 100.00%

android-maliciousaccessibilityserviceappsdetector's Introduction

Motivation

Project aims to help in:

  • identifying keyloggers and events hijacking malicious applications such as Anubis/TeaBot,
  • identifying a "fake bank consultant scenario" when a victim is requested to install a remote control application and then log in to a bank account,
  • identifying other suspicious applications abusing Android AccessibilityService mechanisms

The methods implemented in RemoteDetector class should not be considered as a comprehensive list of checks. It's a PoC that provides you a way to collect more pieces of information about potentially suspicious applications and implement propper checks. However, some of the presented checks may be highly effective in your environments.

Furthermore, you may want to implement your custom checks to outpace bad actors.

Demos

Anubis Detection

DemoAnubisPoC.mp4

Remote Control App Detection

DemoTeamViewerPoC.mp4

Description

The project aims to provide a way to detect when an Android device might be controlled or some events hijacked/keylogged. The application is a PoC that helps in identifying modern bankers such as Anubis/TeaBot, potentially malicious and remote controlling applications abusing Android AccessibilityService.

Modern banker apps abuse AccessibilityService that was created to assist users with disabilities in using Android devices and apps. They run in the background and receive callbacks by the system when AccessibilityEvents are fired. Such events denote some state transition in the user interface, for example, the focus has changed, a button has been clicked, etc.

RemoteDetector Java class allows to:

  • list suspicious applications (configurable by a list of packages)
  • list installed applications with suspicious AccessibilityService capabilities
  • list applications with enabled AccessibilityService which uses suspicious capabilities
  • list applications that uses suspicious ports (PoC currently works for Android < 10)
  • list suspicious applications installed in last 15minutes
  • list suspicious applications that installTime is similar to AccessibilityService package installTime (if different packages)

Usage

Example usage can be found in MainActivity class. Specifically, the following code performs checks if a suspicious application was installed in last 15minutes and is currently enabled as AccessibilityService:

Set<String> appsWithSuspiciousASvcsEnabled = remoteDetector.getSuspiciousAccessibilityServicesEnabled();
Set<String> appsInstalledInLastQuarter = remoteDetector.getAvailabilityServicesInstalledInLastQuarter();
Set<String> appsWithCorrelatedInstallTimesWithSuspiciousApps = remoteDetector.getAppsWithCorrelatedInstallTimesWithSuspiciousApps();

if (Sets.intersection(
                Sets.intersection(appsWithSuspiciousASvcsEnabled, appsInstalledInLastQuarter),
                appsWithCorrelatedInstallTimesWithSuspiciousApps).size() > 0) {
            Log.d(logTag, "Recently installed and enabled suspicious AccessibilityService!");
        }

Another example that may aid with detection malicious application that can draw over other apps:

Set<String> accessibilityServicesPermittedToOverlay = remoteDetector.getAccessibilityServicesPermittedToOverlay();
Set<String> appsWithSuspiciousASvcsSettings = remoteDetector.getAccessibilityServicesWithSuspiciousSettingsInstalled();

if (Sets.intersection(
                Sets.intersection(remoteDetector.getAccessibilityServiceIDsEnabled(), appsWithSuspiciousASvcsSettings),
                accessibilityServicesPermittedToOverlay)
                .size() > 0) {
            Log.d(logTag, "Suspicious AccessibilityService enabled and can draw over apps");
            ((Switch) findViewById(R.id.switch31)).setChecked(true);
        }

List of detectable remote control application can be configured via /res/raw/appconfigs.json file

More methods can be found in "RemoteDetector" class.

Details

The RemoteDetector uses information provided by Android API, especially by AccessiblityManager and PackageManager.

AccessibilityServices currently enabled on a device can be listed via getEnabledAccessibilityServiceList.

To obtain capabilities used by AccessibilityServices getCapabilities method is used. For example, to verify if a service can perform gestures, the following code returns true:

if ((svc.getCapabilities() & CAPABILITY_CAN_PERFORM_GESTURES) != 0)
    return true;

Specific pieces of information about suspicious applications are obtained from PackageManager class.

To draw over application the SYSTEM_ALERT_WINDOW is commonly utilised by malicious applications.

Documentation

Code contains document comments, especially in RemoteDetector class.

Credits to

All Android malware analytics publishing their researches, especially for:

android-maliciousaccessibilityserviceappsdetector's People

Contributors

theowni avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.