PreEmptive Protection - DashO v8.2 User Guide

Debug Checks and Responses

PreEmptive Protection - DashO can instrument Java and Android applications to detect if they are being run in a debuggable mode, or if they are being actively debugged. The Debugging Checks and Responses are configured on the Debug Check screen or by adding code annotations.

Debugging Check

To detect if an application is being debugged, place a DebuggingCheck on one or more methods in your application. DashO adds code that performs a runtime check that determines if it is being debugged. This check can be configured as described in the Overview.

An application can contain multiple uses of DebuggingCheck with various configurations. Using more than one Check or mixing the Responses will hamper attackers.

private static boolean debuggingFlag;
private static Properties myProps;

@DebuggingCheck(sendMessage=true, customDataSource="@myProps", action="@debuggingFlag")
public void onCreate(Bundle check){

}

@DebuggingCheck(response=ResponseType.Hang)
private int computeResult(){

}

Note: On non-Android platforms, if a debugger is attached after the application has started, it will not be detected correctly.

Debugging Response

The DebuggingResponse annotation interacts with the DebuggingCheck. This Response can be configured as described in the Overview.

private static boolean debuggingFlag;

private Properties customData(){...}

@DebuggingCheck(sendMessage=true, action="@debuggingFlag")
public void onCreate(Bundle state){

}

@DebuggingResponse(source="@debuggingFlag", sendMessage=true,
    customDataSource="customData()", response=ResponseType.Exit, probability=0.05f)
private int computeResult(){

}

@DebuggingResponse(source="@debuggingFlag", sendMessage=true,
    response=ResponseType.Error, probability=0.1f)
private FileInputStream readInput(){

}

Debug Enabled Check

To detect if an app is setup to be debugged, place a DebugEnabledCheck on one or more methods in your application. DashO adds code that performs a runtime check that determines if it is setup to allow debugging. This Check can be configured as described in the Overview.

An application can contain multiple uses of DebugEnabledCheck with various configurations. Using more than one Check or mixing the Responses will hamper attackers.

private static boolean debuggingFlag;
private static Properties myProps;

@DebugEnabledCheck(sendMessage=true, customDataSource="@myProps", action="@debuggingFlag")
public void onCreate(Bundle check){

}

@DebugEnabledCheck(response=ResponseType.Hang)
private int computeResult(){

}

Note: The Debug Enabled Check for Android requires access to the application's context; it expects a getApplicationContext() method to exist on the class where it is being injected. If you inject the Debug Enabled Check into a class which extends android.context.Context, like an Application or Service class, it is fine. If not, you will need to add the getApplicationContext() method and make sure it returns a proper Context. If you plan to send messages and want offline message support, you will also need to exclude the added getApplicationContext() method from renaming.

Debug Enabled Response

The DebugEnabledResponse annotation interacts with the DebuggingCheck. This Response can be configured as described in the Overview.

private static boolean debuggingFlag;

private Properties customData(){...}

@DebugEnabledCheck(sendMessage=true, action="@debuggingFlag")
public void onCreate(Bundle state){

}

@DebugEnabledResponse(source="@debuggingFlag", sendMessage=true,
    customDataSource="customData()", response=ResponseType.Exit, probability=0.05f)
private int computeResult(){

}

@DebugEnabledResponse(source="@debuggingFlag", sendMessage=true,
    response=ResponseType.Error, probability=0.1f)
private FileInputStream readInput(){

}

PreEmptive Protection - DashO Version 8.2.0. Copyright © 2017 PreEmptive Solutions, LLC