Detection of HTTP Proxy

A system-wide HTTP proxy configuration can force all HTTP (and, in some cases, HTTPS) requests from your app to pass through a proxy server. This is a potentially harmful behaviour since the proxy server can then inspect or even modify request payloads. Furthermore, Android allows configuring an HTTP proxy without the user being fully aware of this fact.

Malwarelytics for Android is able to detect that an HTTP proxy is being used and can be configured to terminate the app in such case.

Configuration

This feature can be configured during the Malwarelytics initialization phase:

val raspConfig = RaspConfig.Builder()
    .checkHttpProxy(Boolean)
    .exitOnHttpProxy(Boolean)
    // configuration of other RASP features
    .build()
Method Description
checkHttpProxy(Boolean) indicates whether HTTP proxy use should be detected automatically. Defaults to true.
exitOnHttpProxy(Boolean) indicates whether the app should be terminated when the use of an HTTP proxy is detected. Defaults to false.

Usage

After initialization, the HTTP proxy detection feature can be accessed via RaspManager. This can be used to register an observer or to trigger a manual HTTP proxy detection check.

Registering an Observer

HTTP proxy detection can trigger a certain action. To achieve that, an observer needs to be configured and registered.

Observer configuration:

val raspObserver = object : RaspObserver {
    override fun onHttpProxyDetected(httpProxyDetected: Boolean) {
        // handle http proxy detection
    }
    // handle detection of other RASP features
}

The observer can be registered in RaspManager. When it is no longer needed, it can be unregistered again.

raspManager.registerRaspObserver(raspObserver)
raspManager.unregisterRaspObserver(raspObserver)

Triggering a Manual Check

HTTP proxy detection check can be triggered manually in RaspManager by calling the isHttpProxyEnabled() method. A simple boolean answer is given.

val isHttpProxyEnabled = raspManager.isHttpProxyEnabled()

More information on general RASP feature configuration and usage can be found in this overview.

Last updated on May 02, 2022 (20:53) View product
Search

0.20.x

Malwarelytics for Android