An open API service indexing awesome lists of open source software.

https://github.com/esr-style/surakshamitra

This project implements a real-time behavioral and cognitive authentication system for mobile apps, focused on user verification through subtle patterns like typing cadence, swipe behavior, and hesitation flow. It can authenticate users accurately with as few as 7 samples.
https://github.com/esr-style/surakshamitra

behaviour ml security

Last synced: 9 months ago
JSON representation

This project implements a real-time behavioral and cognitive authentication system for mobile apps, focused on user verification through subtle patterns like typing cadence, swipe behavior, and hesitation flow. It can authenticate users accurately with as few as 7 samples.

Awesome Lists containing this project

README

          

# 🛡️ SurakshaMitra: Advanced Cognitive-Behavioral Continuous Authentication Framework for Mobile Devices

[![Expo Build](https://img.shields.io/badge/Expo-Build%20Ready-blue)](https://expo.dev/accounts/esr-style/projects/my-expo-app/builds/93d417e8-89ca-4352-9353-e038bbf83432)
[![React Native](https://img.shields.io/badge/React%20Native-0.79.5-blue.svg)](https://reactnative.dev/)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.8.3-blue.svg)](https://www.typescriptlang.org/)
[![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)

> *Revolutionizing mobile security through multi-layered cognitive-behavioral biometric authentication with breakthrough low-dataset machine learning models*

## 🌟 Overview

**SurakshaMitra** (Sanskrit: *Guardian Friend*) is a cutting-edge mobile security framework that implements **continuous authentication** through multiple sophisticated security layers. This innovative system combines physical device security, behavioral biometrics, and cognitive psychology to create an unprecedented level of mobile device protection.

### 🎯 Key Innovations

- **🧠 Cognitive Layer Authentication**: Leverages human psychology and reflexive responses
- **📱 Behavioral Biometric Analysis**: Advanced keystroke dynamics and touch pattern recognition
- **🔍 Physical Security Detection**: Comprehensive device integrity verification
- **🤖 Breakthrough ML Model**: Siamese neural network inspired binary classification method achieving high accuracy with just **7 training samples**
- **⚡ Continuous Authentication**: Real-time security monitoring without user friction

---

## 📱 Quick Start

### Installation Options

#### Option 1: Install Pre-built APK (Recommended)
Download and install the latest build:
```
https://expo.dev/accounts/esr-style/projects/my-expo-app/builds/93d417e8-89ca-4352-9353-e038bbf83432
```

#### Option 2: Local Development
```bash
# Clone the repository
git clone https://github.com/ESR-style/SurakshaMitra.git
cd SurakshaMitra/app/my-expo-app

# Install dependencies
npm install

# Start the development server
npx expo start

# Launch on Android
# Press 'a' for Android emulator or USB-connected device
```

### Prerequisites
- Node.js 18+
- Expo CLI
- Android Studio (for emulator) or physical Android device
- **Separate Backend Server** (required for authentication models)

---

## 🏗️ Multi-Layered Security Architecture

SurakshaMitra implements a revolutionary **three-tier security framework** that continuously validates user authenticity through multiple behavioral and physical indicators.

### 🔒 Layer 1: Physical Security Detection

The foundation layer performs comprehensive device integrity analysis:

#### Device Integrity Verification
- **Root Detection**: Advanced multi-vector root detection using system property analysis
- **Emulator Detection**: Sophisticated emulator identification through hardware fingerprinting
- **Developer Mode Monitoring**: Real-time detection of USB debugging and development settings
- **Smart Sensor Analysis**: Accelerometer, gyroscope, and magnetometer pattern validation

#### Hardware Fingerprinting
- **User-Agent Verification**: Device model and manufacturer validation
- **Hardware Sensor Authenticity**: Sensor noise pattern analysis to distinguish real devices
- **System Property Inspection**: Deep analysis of Android build properties and system characteristics

```typescript
// Physical layer detection metrics
interface SecurityMetrics {
isEmulator: boolean;
isRooted: boolean;
isDeveloperMode: boolean;
deviceFingerprint: string;
sensorAuthenticity: number;
hardwareValidation: boolean;
}
```

### 🧬 Layer 2: Behavioral Biometric Authentication

#### Advanced Keystroke Dynamics
Our proprietary keystroke analysis captures over **25+ behavioral metrics**:

- **Temporal Patterns**:
- Dwell time (key press duration)
- Flight time (inter-key intervals)
- Typing rhythm and cadence
- Pause patterns and hesitations

- **Touch Biometrics**:
- Pressure sensitivity analysis
- Touch area and finger contact patterns
- Coordinate precision and drift
- Multi-touch gesture characteristics

- **Error Recovery Patterns**:
- Backspace usage frequency
- Correction timing and methodology
- Error pattern consistency
- Recovery behavior analysis

#### Machine Learning Innovation
Our **breakthrough Neural Network** model achieves:
- ✅ **High Accuracy** with minimal training data
- ✅ **Only 7 samples required** for user authentication
- ✅ **Real-time inference** capabilities
- ✅ **Adaptive learning** for improved accuracy over time

```typescript
// Behavioral metrics captured
interface BiometricData {
flightTimes: number[];
dwellTimes: number[];
pressureVariance: number;
touchAreaVariance: number;
sessionEntropy: number;
typingPatternVector: number[];
errorRecoveryMetrics: object;
}
```

### 🧠 Layer 3: Cognitive Authentication

#### Psychological Response Analysis
Leveraging principles of **cognitive psychology** and human reflexive behavior:

- **Contextual Decision Making**: Time-sensitive security questions that test natural human responses
- **Reflex Pattern Analysis**: Measuring decision-making speed and consistency
- **Cognitive Load Assessment**: Analyzing response patterns under different mental states
- **Habituation Detection**: Identifying learned vs. natural response patterns

#### Continuous Cognitive Monitoring
- **Two-Factor Authentication Preferences**: User choice patterns and consistency
- **WiFi Safety Decisions**: Network selection behavior analysis
- **Navigation Method Preferences**: UI interaction pattern recognition
- **First Action Tendencies**: Initial response behavior in security scenarios

```typescript
// Cognitive layer metrics
interface CognitiveMetrics {
decisionLatency: number;
choiceConsistency: number;
reflexiveResponse: boolean;
cognitiveLoad: number;
behaviorPattern: string;
}
```

---

## 🔬 Technical Implementation

### Backend Architecture
- **Separate Backend Required**: The ML models and authentication logic run on an independent server
- **API Endpoints**: RESTful APIs for real-time authentication
- **Model Training**: Continuous learning pipeline for user adaptation
- **Data Security**: Encrypted communication and secure data handling

### Frontend Framework
- **React Native + Expo**: Cross-platform mobile development
- **TypeScript**: Type-safe development
- **Real-time Data Collection**: High-frequency sensor and input monitoring
- **Secure Storage**: Local data encryption and secure transmission

### Machine Learning Pipeline
```
Data Collection → Feature Extraction → NN → Binary Classification → Continuous Learning
```

---

## 📊 Metrics & Analytics

### Captured Biometric Features
| Category | Metrics | Count |
|----------|---------|-------|
| **Keystroke Dynamics** | Dwell times, flight times, rhythm patterns | 8+ |
| **Touch Biometrics** | Pressure, area, coordinates, gestures | 7+ |
| **Behavioral Patterns** | Error recovery, typing speed, consistency | 6+ |
| **Cognitive Responses** | Decision timing, choice patterns, reflexes | 4+ |
| **Device Characteristics** | Hardware fingerprint, sensor data | 5+ |

### Performance Metrics
- **Authentication Accuracy**: >85% with just 7 training samples
- **Response Time**: <100ms for real-time decisions
- **Battery Impact**: <1% additional drain

---

### Research Collaboration
For academic partnerships and research collaboration opportunities, please reach out through my mail.

---

---

## 🏆 Acknowledgments

- **Siamese Neural Network Research**: Inspiration from breakthrough biometric authentication research
- **Behavioral Biometrics Community**: Ongoing research in keystroke dynamics
- **Mobile Security Researchers**: Contributions to device integrity detection methods
- **Cognitive Psychology**: Integration of human behavioral patterns in security

---

### 🛡️ *"Security through Understanding Human Behavior"*

**SurakshaMitra** - *Where Technology Meets Psychology for Ultimate Mobile Security*

![Made with ❤️ in India](https://img.shields.io/badge/Made%20with%20%E2%9D%A4%EF%B8%8F%20in-India-orange)