GithubHelp home page GithubHelp logo

talsec / free-rasp-android Goto Github PK

View Code? Open in Web Editor NEW
125.0 3.0 9.0 350 KB

Library for improving app security and threat monitoring on Android mobile devices.

Home Page: https://github.com/talsec/Free-RASP-Community

License: MIT License

Kotlin 100.00%
android android-library android-security android-tools frida frida-detection hooking root root-detection tampering-detection

free-rasp-android's Introduction

GitHub Repo stars GitHub GitHub Publisher 42matters

freeRASP for Android

FreeRASP for Android is a lightweight and easy-to-use mobile app protection and security monitoring SDK. It is designed to combat reverse engineering, tampering, or similar attack attempts. FreeRASP covers several attack vectors and enables you to set a response to each threat.

Android version detects security issues such as:

  • App installed on a rooted device
  • Hooking or running the app on the emulator
  • Tampering with the application
  • Attaching a debugger to the application

To learn more about freeRASP features, visit our main GitHub repository.

📔 Table of contents

Usage

The installation guide will lead you through the whole implementation, such as adding the SDK to the gradle, configuring it for your app, handling detected threats. It will also instruct you about required data safety policies.

You can check the expected result in the demo app. This is how final files should look like:

Step 1: Add Talsec to your Gradle

Set our nexus artifact repository in your project's build.gradle (or settings.gradle if you are using settings repositories):

[build.gradle (NameOfProject)]
...
repositories {
    google()
    mavenCentral()
    maven { url "https://jitpack.io" }
    maven { url "https://europe-west3-maven.pkg.dev/talsec-artifact-repository/freerasp" }
}

Make sure, that the nexus3 dependency is at the last position.

Set dependencies in your :app module's build.gradle:

[build.gradle (: app)]
...

dependencies {
    // freeRASP SDK  
    implementation 'com.aheaditec.talsec.security:TalsecSecurity-Community:9.6.0'
    ...

Step 2: Setup the Configuration for your App

  1. Create arbitrary subclass of Application(), override it's onCreate() and implement interface of ThreatListener.ThreatDetected. You can, of course, use your Application subclass if you already have one in your project.
[TalsecApplication.kt]

class TalsecApplication : Application(), ThreatListener.ThreatDetected {
    override fun onCreate() {
        super.onCreate()
    }
}
  1. Add this new subclass to AndroidManifest.xml" inside <application> tag:
[AndroidManifest.xml]

<application
    android:name=".TalsecApplication"
    ...
  1. Setup the Configuration for your app with your values 😉.

You must get your expected signing certificate hashes in Base64 form. You can go through this manual to learn how to sign your app in more detail, including manual signing and using Google's Play app signing. Alternatively, you can use already prepared helper function Log.e(..) in the onCreate() to get a hash of the signing certificate easily. The expectedSigningCertificateHashBase64 is an array of certificate hashes, as the support of multiple certificate hashes is included (e.g. if you are using a different certificate hash for Huawei App Gallery). The Helper functions are located in the Utils.kt:

[TalsecApplication.kt]

override fun onCreate() {
    super.onCreate()

    // Uncomment the following Log.e(...) to get your expectedSigningCertificateHashBase64
    // Copy the result from logcat and assign to expectedSigningCertificateHashBase64
    // Log.e("SigningCertificateHash", Utils.computeSigningCertificateHash(this))
    ...

The value of expectedPackageName is self-explanatory.

The value of watcherMail is automatically used as the target address for your security reports. Mail has a strict form '[email protected]'.

You can assign just emptyArray() to supportedAlternativeStores if you publish on the Google Play Store and Huawei AppGallery, as these are already included internally. Otherwise add package names of the alternative stores. For more information, visit the Detecting Unofficial Installation wiki page.

isProd defaults to true when undefined. If you want to use the Dev version to disable checks described in the chapter below, set the parameter to false. Make sure that you have the Release version in the production (i.e. isProd set to true)!. To simplify switching between debug and release version of Talsec based on the build type, you can use BuildConfig.BUILD_TYPE.contains("Release", true) as a value for isProd.

[TalsecApplication.kt]

companion object {
    private const val expectedPackageName = "com.aheaditec.talsec.demoapp" // Don't use Context.getPackageName!
    private val expectedSigningCertificateHashBase64 = arrayOf(
        "mVr/qQLO8DKTwqlL+B1qigl9NoBnbiUs8b4c2Ewcz0k=",
        "cVr/qQLO8DKTwqlL+B1qigl9NoBnbiUs8b4c2Ewcz0m="
    ) // Replace with your release (!) signing certificate hashes
    private const val watcherMail = "[email protected]" // for Alerts and Reports
    private val supportedAlternativeStores = arrayOf(
        "com.sec.android.app.samsungapps" // Add other stores, such as the Samsung Galaxy Store
    )
    private val isProd = true
}
[TalsecApplication.kt]

override fun onCreate() {
    ...

    // Uncomment the following Log.e(...) to get your expectedSigningCertificateHashBase64
    // Copy the result from logcat and assign to expectedSigningCertificateHashBase64 and
    // Log.e("SigningCertificateHash", Utils.computeSigningCertificateHash(this))

    val config = TalsecConfig(
        expectedPackageName,
        expectedSigningCertificateHashBase64,
        watcherMail,
        supportedAlternativeStores,
        isProd
    )
  1. Initiate ThreatListener and start Talsec just by adding these two lines below the created config:
[TalsecApplication.kt]

override fun onCreate() {
    ...

    ThreatListener(this).registerListener(this)
    Talsec.start(this, config)
}

Dev vs Release version

The Dev version is used to not complicate the development process of the application, e.g. if you would implement killing of the application on the debugger callback. It disables some checks which won't be triggered during the development process:

  • Emulator
  • Debugging
  • Tampering
  • Unofficial store

Step 3: Handle detected threats

Implement methods of ThreatListener.ThreatDetected. For example, you can kill the app, warn the user or send the event to your backend service. If you decide to kill the application from the callback, make sure that you use an appropriate way of killing it.

To learn more about these checks, visit our wiki page that provides an explanation for them.

[TalsecApplication.kt]

override fun onRootDetected() {
    TODO("Not yet implemented")
}

override fun onDebuggerDetected() {
    TODO("Not yet implemented")
}

override fun onEmulatorDetected() {
    TODO("Not yet implemented")
}

override fun onTamperDetected() {
    TODO("Not yet implemented")
}

override fun onUntrustedInstallationSourceDetected() {
    TODO("Not yet implemented")
}

override fun onHookDetected() {
    TODO("Not yet implemented")
}

override fun onDeviceBindingDetected() {
    TODO("Not yet implemented")
}

override fun onObfuscationIssuesDetected() {
    TODO("Not yet implemented")
}

(Optional) Device state information

Optionally you can use a device state listener to get additional information about device state information like device lock and HW-backed Keystore state.

private val deviceStateListener = object : ThreatListener.DeviceState {
    override fun onUnlockedDeviceDetected() {
        // Set your reaction
        TODO("Not yet implemented")
    }
    override fun onHardwareBackedKeystoreNotAvailableDetected() {
        // Set your reaction
        TODO("Not yet implemented")
    }

    override fun onDeveloperModeDetected() {
        // Set your reaction
	TODO("Not yet implemented")
    }

    override fun onSystemVPNDetected() {
        // Set your reaction
	TODO("Not yet implemented")
    }
}

and modify initialization of ThreatListener:

    ...

    ThreatListener(this, deviceStateListener).registerListener(this)
    Talsec.start(this, config)

Step 4: Test it!

The easiest way to produce an incident (trigger local reaction check and create a record in security report) is to install a release build on an emulator (i.e., Android Emulator, which comes with Android Studio). Make sure, that you have set up the isProd variable to true.

Step 5: Additional note about obfuscation

The freeRASP contains public API, so the integration process is as simple as possible. Unfortunately, this public API also creates opportunities for the attacker to use publicly available information to interrupt freeRASP operations or modify your custom reaction implementation in threat callbacks. In order for freeRASP to be as effective as possible, it is highly recommended to apply obfuscation to the final package/application, making the public API more difficult to find and also partially randomized for each application so it cannot be automatically abused by generic hooking scripts.

The majority of Android projects support code shrinking and obfuscation without any additional need for setup. The owner of the project can define the set of rules that are usually automatically used when the application is built in the release mode. For more information, please visit the official documentation

You can make sure, that the obfuscation is enabled by checking the value of minifyEnabled property in your module's build.gradle file.

android {
    ...

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

Step 6: Google Play's Data Safety Policy

See the generic info about freeRASP data collection here.

Google Play requires all app publishers to declare how they collect and handle user data for the apps they publish on Google Play. They should inform users properly of the data collected by the apps and how the data is shared and processed. Therefore, Google will reject the apps which do not comply with the policy.

Talsec recommends adding the following statements to the Privacy Policy page dedicated to your app. Also, use the text below while filling in the Google Play Safety Section for publishing.

For the purpose of Fraud prevention, user safety, and compliance, the dedicated App safety SDK needs to send the following anonymous diagnostic data off the device for detection of security issues. Thus the application collects the following data:
  • Category: App info and performance
    • Data Type: Diagnostics
    • Information about the integrity of the app and the operating system. For example, rooting, running in an emulator, hooking framework usage, etc...
  • Category: Device or other identifiers
    • Data Type: Device or other identifiers
    • Information that relates to an individual device. For example, a device model and anonymous identifier to control that app instance executed on the original device that it was initially installed on. It is needed to combat threats like bots and API abuse.

All the data collected by the freeRASP Talsec Security SDK is considered non user sensitive. Also, there is no technical way to identify the real person by the identifiers collected by freeRASP SDK.

Please follow the recommendations and data collection specifications indicated here.

After installation, please go through this checklist to avoid potential issues or solve them quickly.

And you're done 🎉! You can open an issue if you get stuck anywhere in the guide or show your appreciation by starring this repository ⭐!

Security Report

The Security Report is a weekly summary describing the application's security state and characteristics of the devices it runs on in a practical and easy-to-understand way.

The report provides a quick overview of the security incidents, their dynamics, app integrity, and reverse engineering attempts. It contains info about the security of devices, such as OS version or the ratio of devices with screen locks and biometrics. Each visualization also comes with a concise explanation.

To receive Security Reports, fill out the watcherMail field in Talsec config.

enter image description here

💸 Talsec Commercial Subscriptions

Talsec offers commercial plans on top of freeRASP (Business RASP+):

  • No limits of Fair Usage Policy (100K App Downloads)
  • No Data Collection from your app
  • FinTech grade security, features and SLA (see more in this post)
  • Protect APIs and risk scoring by AppiCrypt®

Learn more at talsec.app.

Not to overlook, the one of the most valued commercial features is AppiCrypt® - App Integrity Cryptogram.

It allows easy-to-implement API protection and App Integrity verification on the backend to prevent API abuse:

  • Bruteforce attacks
  • Botnets
  • API abuse by App impersonation
  • Session-hijacking
  • DDoS

It is a unified solution that works across all mobile platforms without dependency on external web services (i.e., without extra latency, an additional point of failure, and maintenance costs).

Learn more about commercial features at talsec.app.

TIP: You can try freeRASP and then upgrade easily to an enterprise service.

Plans Comparison

freeRASP is freemium software i.e. there is a Fair Usage Policy (FUP) that impose some limitations on the free usage. See the FUP section in the table below

freeRASP Business RASP+
Runtime App Self Protection (RASP, app shielding)
Advanced root/jailbreak protections (including Magisk) basic advanced
Runtime reverse engineering controls
  • Debugger
  • Emulator / Simulator
  • Hooking and reversing frameworks (e.g. Frida, Magisk, XPosed, Cydia Substrate and more)
basic advanced
Runtime integrity controls
  • Tampering protection
  • Repackaging / Cloning protection
  • Device binding protection
  • Unofficial store detection
basic advanced
Device OS security status check
  • HW security module control
  • Screen lock control
  • Google Play Services enabled/disabled
  • Last security patch update
  • System VPN control
  • Developer mode control
yes yes
UI protection
  • Overlay protection
  • Accessibility services misuse protection
no yes
Hardening suite
Security hardening suite
  • End-to-end encryption
  • Strings protection (e.g. API keys)
  • Dynamic TLS certificate pinning
no yes
AppiCrypt® - App Integrity Cryptogram
API protection by mobile client integrity check, online risk scoring, online fraud prevention, client App integrity check. The cryptographic proof of app & device integrity. no yes
Security events data collection, Auditing and Monitoring tools
Threat events data collection from SDK yes configurable
AppSec regular email reporting service yes (up to 100k devices) yes
UI portal for Logging, Data analytics and auditing no yes
Support and Maintenance
SLA Not committed yes
Maintenance updates Not committed yes
Fair usage policy
Mentioning of the App name and logo in the marketing communications of Talsec (e.g. "Trusted by" section on the web). over 100k downloads no
Threat signals data collection to Talsec database for processing and product improvement yes no

For further comparison details (and planned features), follow our discussion.

About Us

Talsec is an academic-based and community-driven mobile security company. We deliver in-App Protection and a User Safety suite for Fintechs. We aim to bridge the gaps between the user's perception of app safety and the strong security requirements of the financial industry.

Talsec offers a wide range of security solutions, such as App and API protection SDK, Penetration testing, monitoring services, and the User Safety suite. You can check out offered products at our web.

License

This project is provided as freemium software i.e. there is a fair usage policy that impose some limitations on the free usage. The SDK software consists of opensource and binary part which is property of Talsec. The opensource part is licensed under the MIT License - see the LICENSE file for details.

free-rasp-android's People

Contributors

matussikyna avatar msikyna avatar sirionrazzer avatar syakymchuk avatar talsec-app avatar xprikryl2 avatar yardexx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

free-rasp-android's Issues

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:checkDebugAarMetadata'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not resolve com.aheaditec.talsec.security:TalsecSecurity-Community-Flutter:9.1.0.
Required by:
project :app > project :freerasp
> Could not resolve com.aheaditec.talsec.security:TalsecSecurity-Community-Flutter:9.1.0.
> Could not get resource 'https://europe-west3-maven.pkg.dev/talsec-artifact-repository/freerasp/com/aheaditec/talsec/security/TalsecSecurity-Community-Flutter/9.1.0/TalsecSecurity-Community-Flutter-9.1.0.pom'.
> Could not GET 'https://europe-west3-maven.pkg.dev/talsec-artifact-repository/freerasp/com/aheaditec/talsec/security/TalsecSecurity-Community-Flutter/9.1.0/TalsecSecurity-Community-Flutter-9.1.0.pom'. Received status code 401 from server: Unauthorized

Issue in building gradle dependency

Issue in building gradle dependency
Gradle build not downloading dependency. I tried to open url in web its returning Error 400

To Reproduce
I integrate FreeRASPDemoApp but not able to sync and build.

Note: The same demo app was working fine a few days back.

Package manager has died crash on Android 6.0.1 devices

Describe the bug
We have started to receive a crash on 20+ users after upgrading to the latest version of the library.

To Reproduce
Have no idea, because this crash occurs only on users' devices. However, the absence of the logs and keys in Crashlytics gives a hint that this crash occurs on app start.

Expected behavior
Working without crash 🙂

Please complete the following information:

  • Devices: Galaxy Note4, Galaxy A7, Galaxy Grand Prime Plus, LG X Power. 80% are Samsung devices.
  • OS version: Android 6.0.1
  • Version of freeRASP: 8.0.4

Additional context
Here is a crash report from Crashlytics:

First part

Fatal Exception: java.lang.RuntimeException: Package manager has died
       at android.app.ApplicationPackageManager.queryIntentActivitiesAsUser(ApplicationPackageManager.java:843)
       at android.app.ApplicationPackageManager.queryIntentActivities(ApplicationPackageManager.java:807)
       at com.aheaditec.talsec.security.o1.a(SourceFile:153)
       at com.aheaditec.talsec.security.o1.a(SourceFile:141)
       at com.aheaditec.talsec.security.b.a(SourceFile:51)
       at com.aheaditec.talsec.security.o1.c(SourceFile:3)
       at com.aheaditec.talsec.security.o1.a(SourceFile:1)
       at com.aheaditec.talsec.security.a2.d(SourceFile:3)
       at java.lang.Thread.run(Thread.java:818)

Second part

Caused by android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
       at android.os.BinderProxy.transactNative(Binder.java)
       at android.os.BinderProxy.transact(Binder.java:503)
       at android.content.pm.IPackageManager$Stub$Proxy.queryIntentActivities(IPackageManager.java:3949)
       at android.app.ApplicationPackageManager.queryIntentActivitiesAsUser(ApplicationPackageManager.java:815)
       at android.app.ApplicationPackageManager.queryIntentActivities(ApplicationPackageManager.java:807)
       at com.aheaditec.talsec.security.o1.a(SourceFile:153)
       at com.aheaditec.talsec.security.o1.a(SourceFile:141)
       at com.aheaditec.talsec.security.b.a(SourceFile:51)
       at com.aheaditec.talsec.security.o1.c(SourceFile:3)
       at com.aheaditec.talsec.security.o1.a(SourceFile:1)
       at com.aheaditec.talsec.security.a2.d(SourceFile:3)
       at java.lang.Thread.run(Thread.java:818)

Unable to detect noxplayer emulator

I've tried to run the app on the Nox emulator. It seems like the SDK is not able to detect the nox emulator. Below is the system information of the emulator:

Nox version: 7.0.3.3033-9.0900220715
Android version: Android 9(64 bit)
System version: Windows10-64bit-4cpu
Computer model: MSI-MS-7850
CPU: Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz
Total memory: 15.9 GB
Available memory: 10.0 GB
CPU VT: Enabled
Rendering mode: OpenGL+
OpenGL version: 4.3.0 - Build 20.19.15.4624
OpenGL rendering: Intel(R) HD Graphics 4600
Discrete graphics: Enabled
Graphics card1: Intel(R) HD Graphics 4600
Firewall: Enabled(Recommend to disable)
Installation path: D:\Program Files\Nox\bin
Log Path: C:\Users\KK\AppData\Local\Nox
Emulator disk space: total 128G, available 116G

Cannot Access the Library. Received Status Code 521 from Server

Hi,

I tried following the instructions in Free-RASP-Android
But, when I rebuild the project, I got an error on build output:

Could not HEAD 'https://jitpack.io/com/aheaditec/talsec/security/TalsecSecurity-Community/4.2.1-dev/TalsecSecurity-Community-4.2.1-dev.pom'. Received status code 521 from server

Here is my project's build.gradle:

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url "https://maven.google.com/" }
        maven { url 'https://jitpack.io' }
        maven { url "https://nexus3-public.monetplus.cz/repository/ahead-talsec-free-rasp" }
        maven { url "https://developer.huawei.com/repo/" }
    }
}

Here is my app build.gradle:

releaseImplementation 'com.aheaditec.talsec.security:TalsecSecurity-Community:4.2.1-release'
debugImplementation 'com.aheaditec.talsec.security:TalsecSecurity-Community:4.2.1-dev'

Is there an issue with my implementation? Or is there a problem with the library?

Maybe there is a hint to resolve this issue.

Thank you.

Android Studio claims that "Library was not found"

Solution

Should you encounter such an issue during the integration process, try these steps:

  1. Add our nexus repository to the list of repositories from which your dependencies are downloaded. You can do this by adding this line of code:
    { url "[https://nexus3-public.monetplus.cz/repository/ahead-talsec-free-rasp]" }
    to one of your build.gradle files.
  • Please also check that this website https://nexus3-public.monetplus.cz/#browse/browse:ahead-talsec-free-rasp is reachable from your internal network and that you can see actual artifacts in the repository.

  • The order of the repositories matters. Gradle will try to find dependencies in the first repository, and if it fails, it moves to the next one. You can try to put our repository at the top of the list.

  1. Add the dependency to the list of your dependencies. You can do this by adding these lines of code:
        releaseImplementation 'com.aheaditec.talsec.security:TalsecSecurity-Community:3.1.0-release'
        debugImplementation 'com.aheaditec.talsec.security:TalsecSecurity-Community:3.1.0-dev'
  1. If the issue still persists, try standard notation, which is not dependent on the build variant of the project, by adding this line of code:
        implementation 'com.aheaditec.talsec.security:TalsecSecurity-Community:3.1.0-dev'

You can also try to download the artifacts from the repository manually and add them as local dependencies.

Talsec Root by pass with Magisk Manager

Describe the bug
Talsec is Not Giving Rooted Callback once give permission from Magisk Manager

To Reproduce
Download Magisk Manager from Google give Super User Permission to App open the app you will not receive Talsec rooted device callback

Expected behavior
Even after giving permission of super user Talsec should give Rooted device Callback

Screenshots

Please complete the following information:
On All Device

Additional context
Add any other context about the problem here.

build error

I follow your instruction on my cordova app. When building, it generated error:
`> Task :app:dataBindingMergeDependencyArtifactsDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong:

Execution failed for task ':app:dataBindingMergeDependencyArtifactsDebug'.

Could not resolve all files for configuration ':app:debugCompileClasspath'.

Could not find com.aheaditec.talsec.security:TalsecSecurity-Community:4.2.1-release.

 Required by:

     project :app

`
Could you let me know how to resolve this?

Frida bypassing Antiroot

Hi, I've been installing freeRASP inside my Android project (it's a React-native project, but I've inserted freeRASP in order to detect rooted devices, primarily).
import com.aheaditec.talsec_security.security.api.Talsec;
import com.aheaditec.talsec_security.security.api.TalsecConfig;
import com.aheaditec.talsec_security.security.api.ThreatListener;

public class MainApplication extends Application implements ReactApplication, ThreatListener.ThreatDetected {
public void onCreate() {
super.onCreate();
TalsecConfig config = new TalsecConfig("my.app.id","myAppHash", "[email protected]",null);
Talsec.start(this,config);
}
@OverRide
public void onRootDetected() {
System.exit(0);
}

@OverRide
public void onDebuggerDetected() {
System.exit(0);
}

@OverRide
public void onEmulatorDetected() {
System.exit(0);
}

@OverRide
public void onTamperDetected() {
System.exit(0);
}

@OverRide
public void onUntrustedInstallationSourceDetected() {

}

@OverRide
public void onHookDetected() {
System.exit(0);
}

@OverRide
public void onDeviceBindingDetected() {
System.exit(0);
}
}
I've tested in an emulator, with Frida, with the script
frida --codeshare dzonerzy/fridantiroot -f my.app.id

The result is that I can install and run my app inside the emulator, which is not desired.
An I doing something wrong?

Thanks in advance

React Native Support

I am unable to Integrate this in React Native. Is it possible to use in React Native Application?

Could not download TalsecSecurity-Community-6.0.0-release.aar

Describe the bug
Hi there, hope you're doing well :)

So , I'm trying to install your library into my app and I got this error:
Could not download TalsecSecurity-Community-6.0.0-release.aar

To Reproduce
I followed your installation guide, and then I "Make project" into Android Studio
Actually I had to add those dependencies as well in addition to yours:

implementation 'com.huawei.hms:safetydetect:6.7.0.300'
implementation 'com.madgag.spongycastle:core:1.54.0.0'
implementation 'com.madgag.spongycastle:prov:1.54.0.0'
implementation 'com.madgag.spongycastle:pkix:1.54.0.0'
implementation 'com.madgag.spongycastle:pg:1.54.0.0'

I then checked the link you provided :

url "https://nexus3-public.monetplus.cz/repository/ahead-talsec-free-rasp"

And this one gives a 400 error might be the cause ?

So I tried with the link you provided in another ticket resolution where it is question of nexus link and this one is actually working but not enough for my project to be able to download the community version :/

Expected behavior
If you could give me a hand to solve this installation's issue I would be very grateful ;)

In advance Cheers for your time

Screenshots

Execution failed for task ':my-app:dataBindingMergeDependencyArtifactsGplayDebug'.

Could not resolve all files for configuration ':my-app:gplayDebugCompileClasspath'.
Failed to transform TalsecSecurity-Community-6.0.0-release.aar (com.aheaditec.talsec.security:TalsecSecurity-Community:6.0.0-release) to match attributes {artifactType=android-databinding, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-api}.
> Could not download TalsecSecurity-Community-6.0.0-release.aar (com.aheaditec.talsec.security:TalsecSecurity-Community:6.0.0-release)

Please complete the following information:

  • Version of freeRASP: 6.0.0

Fatal Exception: java.security.ProviderException: Key size not available

Describe the bug

com.aheaditec.talsec.security.n.a
java.security.ProviderException - Failed to obtain information about key. Keystore error: 4

Fatal Exception: java.security.ProviderException: Key size not available
       at android.security.keystore2.AndroidKeyStoreSecretKeyFactorySpi.getKeyInfo(AndroidKeyStoreSecretKeyFactorySpi.java:215)
       at android.security.keystore2.AndroidKeyStoreSecretKeyFactorySpi.engineGetKeySpec(AndroidKeyStoreSecretKeyFactorySpi.java:70)
       at javax.crypto.SecretKeyFactory.getKeySpec(SecretKeyFactory.java:562)
       at com.aheaditec.talsec.security.n.a(SourceFile:7)
       at com.aheaditec.talsec.security.n.m(SourceFile:2)
       at com.aheaditec.talsec.security.p.a(SourceFile:1)
       at com.aheaditec.talsec.security.f1.c(SourceFile:9)
       at com.aheaditec.talsec.security.f1.a(SourceFile:5)
       at com.aheaditec.talsec.security.e1.c(SourceFile:1)
       at com.aheaditec.talsec.security.e1.a(SourceFile:1)
       at com.aheaditec.talsec.security.a2.d(SourceFile:3)
       at java.lang.Thread.run(Thread.java:920)

To Reproduce
Can't reproduce the issue

Expected behavior
No crash is occured

Screenshots

Please complete the following information:

  • Device: Samsung S10+
  • OS version: Android 12
  • Version of freeRASP: 8.3.0

Additional context

The Nexus server is down

Hi, I think the Nexus server is down, when I tried to build my project, I got this error
> Could not resolve com.aheaditec.talsec.security:TalsecSecurity-Community:8.0.2.
> Could not get resource 'https://nexus3-public.monetplus.cz/repository/ahead-talsec-free-rasp/com/aheaditec/talsec/security/TalsecSecurity-Community/8.0.2/TalsecSecurity-Community-8.0.2.pom'.
> Could not GET 'https://nexus3-public.monetplus.cz/repository/ahead-talsec-free-rasp/com/aheaditec/talsec/security/TalsecSecurity-Community/8.0.2/TalsecSecurity-Community-8.0.2.pom'.
> Read timed out

Also this link is not accessible
https://nexus3-public.monetplus.cz/#browse/browse:ahead-talsec-free-rasp

required help for Java code basse as we are not able to get the import packages

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Able to recompile the APK

I am able to modify the manifest file (changed the backup to false ) and recompile the application. The application is getting successfully installed on the system..

Fatal Exception: java.lang.UnsatisfiedLinkError: dlopen failed

Hello, I implemented the library version 6.0.0 and I got the following crashes:

  • Fatal Exception: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/user/0/com.gbox.android/_root/data/internal_app/com.company.android-gep493u9x7yrZ9yoy5Lqtw==/lib/arm/libpolarssl.so" is 32-bit instead of 64-bit at java.lang.Runtime.loadLibrary0(Runtime.java:1087) at java.lang.Runtime.loadLibrary0(Runtime.java:1008) at java.lang.System.loadLibrary(System.java:1664) at com.aheaditec.talsec.security.z1.<clinit>(SourceFile:1) at com.aheaditec.talsec.security.y1.<init>(SourceFile:5) at com.aheaditec.talsec.security.y1.a(SourceFile:4) at com.aheaditec.talsec_security.security.api.Talsec.start(SourceFile:1)

  • Fatal Exception: java.lang.UnsatisfiedLinkError: dlopen failed: library "libpolarssl.so" not found

When I check my universal APK, I have the libpolarssl.so both in x86 and x64. However I distribute the app as Bundle in the Google Play Console.

I had tried to add exception handler when called at com.aheaditec.talsec_security.security.api.Talsec.start but the crash still exist.

Is the Library for android support for x86? And any insight why the crash happens?

Thank you

SSLException for secured endpoints when integrating freeRASP

Describe the bug
After adding the library to our project version 8.3.0, when trying to call a secure endpoint, we get SSLException from Retrofit/OkHttp and our api calls fail.
We tried updating to 9.0.0 but that didn't fix the problem.

javax.net.ssl.SSLHandshakeException: Read error: ssl=0xb400007aa9f06888: Failure in SSL library, usually a protocol error
error:04000044:RSA routines:OPENSSL_internal:internal error (external/conscrypt/common/src/jni/main/cpp/conscrypt/native_crypto.cc:732 0x7aa3ed3791:0x00000000)

Expected behavior
To not receive SSLException from OkHttp.

Please complete the following information:

  • Device: Pixel 7 Pro
  • OS version: Android 14
  • Version of freeRASP: 8.3.0 and 9.0.0

Happen also with all opther test devices we have from Android 10 to 14 (Samsung, Pixel, Huawei, OnePlus, Fairhphone)

Additional context
For the record in our project we have the following libraries Retrofit 2.10.0, Moshi 1.15.1, Koin 3.5.3 , OkHttp 4.12.0, we have proguard, SSL pinning in the app via .certificatePinner on the OkHttpClient and we also have a custom sslSocketFactory with TLS protocol.

App configuration:

  • minSdk version is 26
  • targetSdk version is 34

The issue is raised when calling an endpoint with SSL Pinning (secure endpoint)
Endpoints which are not secured with SSL Pinning, work as expected.

Removing the RASP library fixes our issue with secure endpoints.
Here is the code for initialization:

SecurityDetectionHelper.kt

package com.xxx.lib.security.presentation

import android.content.Context
import com.aheaditec.talsec_security.security.api.Talsec
import com.aheaditec.talsec_security.security.api.TalsecConfig
import com.aheaditec.talsec_security.security.api.ThreatListener
import com.xxx.lib.BuildConfig.ANDROID_SUPPORT_MAIL
import com.xxx.lib.security.presentation.SecurityThreatDetectedError.Reason.DEBUGGER_DETECTED
import com.xxx.lib.security.presentation.SecurityThreatDetectedError.Reason.EMULATOR_DETECTED
import com.xxx.lib.security.presentation.SecurityThreatDetectedError.Reason.HOOK_DETECTED
import com.xxx.lib.security.presentation.SecurityThreatDetectedError.Reason.OBFUSCATION_ISSUES_DETECTED
import com.xxx.lib.security.presentation.SecurityThreatDetectedError.Reason.ROOT_DETECTED
import com.xxx.lib.security.presentation.SecurityThreatDetectedError.Reason.TAMPER_DETECTED
import com.xxx.lib.security.presentation.SecurityThreatDetectedError.Reason.UNTRUSTED_INSTALLATION_SOURCE_DETECTED

class SecurityDetectionHelper(
    private val context: Context,
) : ThreatListener.ThreatDetected, SecurityDetectionHelperInterface {

    private var onThreatDetected: (error: SecurityThreatDetectedError) -> Unit = {}
    private var isEnabled: Boolean = false

    private val supportedAlternativeStores = arrayOf(
        "dev.firebase.appdistribution",
    )

    private val expectedSigningCertificateHashBase64 = arrayOf(
        // App signing
        "xxx",
        // Upload key certificate
        "xxx",
        // Internal test certificate
        "xxx",
    )

    private val config: TalsecConfig
        get() = TalsecConfig(
            PACKAGE_NAME,
            expectedSigningCertificateHashBase64,
            ANDROID_SUPPORT_MAIL,
            supportedAlternativeStores,
            isEnabled,
        )

    override fun onRootDetected() {
        onThreatDetected(SecurityThreatDetectedError(ROOT_DETECTED))
    }

    override fun onDebuggerDetected() {
        onThreatDetected(SecurityThreatDetectedError(DEBUGGER_DETECTED))
    }

    override fun onEmulatorDetected() {
        onThreatDetected(SecurityThreatDetectedError(EMULATOR_DETECTED))
    }

    override fun onTamperDetected() {
        onThreatDetected(SecurityThreatDetectedError(TAMPER_DETECTED))
    }

    override fun onUntrustedInstallationSourceDetected() {
        onThreatDetected(SecurityThreatDetectedError(UNTRUSTED_INSTALLATION_SOURCE_DETECTED))
    }

    override fun onHookDetected() {
        onThreatDetected(SecurityThreatDetectedError(HOOK_DETECTED))
    }

    override fun onDeviceBindingDetected() {
        // do nothing
    }

    override fun onObfuscationIssuesDetected() {
        onThreatDetected(SecurityThreatDetectedError(OBFUSCATION_ISSUES_DETECTED))
    }

    override fun initSecurityDetection(isEnabled: Boolean, onThreatDetected: (error: SecurityThreatDetectedError) -> Unit) {
        this.onThreatDetected = onThreatDetected
        this.isEnabled = isEnabled
        ThreatListener(this).registerListener(context)
        Talsec.start(context, config)
    }

    companion object {
        private const val PACKAGE_NAME = "xxx"
    }
}

MainActivity.kt

class MainActivity : BaseActivity(R.layout.xxx_activity_main) {
    ...
    private val securityDetectionHelper: SecurityDetectionHelperInterface by inject()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        securityDetectionHelper.initSecurityDetection(THREAT_DETECTION_ENABLED, ::showAppBlockedDialog)
        ....
    }
    ...
}

Fatal Exception: java.lang.SecurityException

I'm having an issue using Community version of the library

Fatal Exception: java.lang.SecurityException
Must have USE_BIOMETRIC permission: Neither user {userId} nor current process has android.permission.USE_BIOMETRIC.

Currently the app is not using any biometric verification in it, however, I'm having this issue on some devices with Android 12 and Android 13

SDK Version: 7.0.0

"Could not find com.aheaditec.talsec.security:TalsecSecurity-Community:3.1.0-dev." with 403 on pom file

Hi,

I tried following the instructions in #2 .

I reached a point where the compilation error was partially understandable.

Here is the important portion of my android/build.gradle file:

buildscript {
    ext.kotlin_version = '1.5.21'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.aheaditec.talsec.security:TalsecSecurity-Community:3.1.0-dev'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        {url "[https://nexus3-public.monetplus.cz/repository/ahead-talsec-free-rasp]" }
    }
}
...

And here is the complete unedited run output with the error message:

Launching lib/main.dart on SM A037F in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find com.aheaditec.talsec.security:TalsecSecurity-Community:3.1.0-dev.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/aheaditec/talsec/security/TalsecSecurity-Community/3.1.0-dev/TalsecSecurity-Community-3.1.0-dev.pom
       - https://jcenter.bintray.com/com/aheaditec/talsec/security/TalsecSecurity-Community/3.1.0-dev/TalsecSecurity-Community-3.1.0-dev.pom
     Required by:
         project :

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 6s
Exception: Gradle task assembleDebug failed with exit code 1

When I try to open the pom file https://jcenter.bintray.com/com/aheaditec/talsec/security/TalsecSecurity-Community/3.1.0-dev/TalsecSecurity-Community-3.1.0-dev.pom directly, I get this output:

403 Forbidden
nginx

Is there a way to gain access to this file and any other relevant ones?

Or, is there a convenient way to use the aar files without creating a module?

Maven repo change

maven repo nexus3-public.monetplus.cz is breaked

maven { url "https://nexus3-public.monetplus.cz/repository/ahead-talsec-free-rasp" }

截屏2022-12-12 下午12 17 40

Is there any plan to change maven repo to jitpack or maven Central Repository

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.