Debug Checks and Responses
PreEmptive Protection - DashO can inject checks into 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;
@DebuggingCheck(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;
@DebuggingCheck(action="@debuggingFlag")
public void onCreate(Bundle state){
}
@DebuggingResponse(source="@debuggingFlag", response=ResponseType.Exit, probability=0.05f)
private int computeResult(){
}
@DebuggingResponse(source="@debuggingFlag", 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;
@DebugEnabledCheck(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 extendsandroid.context.Context
, like anApplication
orService
class, it is fine. If not, you will need to add thegetApplicationContext()
method and make sure it returns a properContext
.
Debug Enabled Response
The DebugEnabledResponse annotation interacts with the DebugEnabledCheck. This Response can be configured as described in the Overview.
private static boolean debuggingFlag;
@DebugEnabledCheck(action="@debuggingFlag")
public void onCreate(Bundle state){
}
@DebugEnabledResponse(source="@debuggingFlag", response=ResponseType.Exit,
probability=0.05f)
private int computeResult(){
}
@DebugEnabledResponse(source="@debuggingFlag", response=ResponseType.Error,
probability=0.1f)
private FileInputStream readInput(){
}