apk-scanner / app /services /copilot /knowledge /security /ml-classification-guide.md
Aniket2006
feat: add copilot (RAG chat) endpoint alongside apk-scan and smishing
2dca8fb
|
Raw
History Blame Contribute Delete
4.33 kB
# Machine Learning Classifiers: APK Risk and Smishing Detection
## What this means for you
Alongside rule-based checks like YARA and certificate comparisons, Shield uses two machine-learning models to help spot threats that don't match any single known pattern: one that scores whether an APK looks malicious based on its overall features, and one that scores whether an SMS message looks like a phishing (smishing) attempt. Both models are genuinely part of the system, but it's worth understanding honestly how they fit in: they're one signal among several, they have non-ML fallbacks, and (for the SMS classifier specifically) the ML path is off by default in a stock deployment until a trained model is deployed. This section explains both clearly so you know what's actually running when you get a result.
## The APK risk-fusion classifier
Shield's backend includes a **RandomForest classifier** β€” a machine-learning model trained on features extracted from APK files (permissions, manifest structure, certificate characteristics, and other static-analysis outputs) β€” which produces a **malware-probability score** for a scanned app. RandomForest models work by combining the votes of many decision trees, each trained on slightly different views of the data, which tends to make them robust and resistant to being fooled by any single unusual feature.
This ML risk-fusion classifier is **enabled by default** (`ML_ENABLED=true`). Its probability score doesn't act as the sole verdict β€” it's one input that gets fused together with static analysis, YARA/APKiD results, and certificate reputation into the overall risk score (see `risk-score-guide.md`). A high ML probability score alongside a matching certificate red flag or a YARA hit produces much stronger confidence than the ML score alone.
## The smishing (SMS phishing) classifier
For scanning SMS messages, Shield uses a **multilingual smishing classifier** designed to work across **English, Hindi, and Hinglish** (the mix of Hindi and English common in everyday texting in India) β€” an important design choice given that phishing SMS targeting Indian banking users frequently uses exactly this kind of mixed-language phrasing. The intended ML pipeline is a **sentence-embedding model (MiniLM)** that converts the message text into a numerical representation capturing its meaning, feeding into a **logistic-regression classifier head** trained to distinguish smishing from legitimate messages.
Here's the important honest detail: this ML path is **off by default** (`SMISHING_ML_ENABLED=false`) until a trained model file is deployed to the service. In a realistic, out-of-the-box deployment, the smishing classifier runs on its **deterministic keyword-heuristic fallback** rather than the ML path β€” this fallback is not a lesser afterthought, it's the actual default behavior you should expect. The heuristic fallback flags:
- **Urgency language** β€” phrases pressuring immediate action ("act now," "your account will be blocked")
- **Common fraud phrases** β€” fake KYC-update requests, prize/lottery-winner claims, "click here to verify" links
- **Suspicious domains and TLDs** β€” links using domains or extensions designed to look like a bank's real domain without actually being it
- **URL shorteners** β€” legitimate bank SMS essentially never use link-shortening services, so their presence in a banking-context message is itself a red flag
Whenever the ML path is unavailable β€” which, again, is the default state β€” this heuristic fallback is what actually evaluates every SMS message, so Shield's smishing detection is meaningfully effective even without the ML model deployed.
## Why the honest framing matters
It would be easy to describe both classifiers as "AI-powered" without qualification, but the accurate picture is more specific: the APK ML classifier is genuinely active by default, while the SMS ML classifier is not, running instead on a well-defined heuristic fallback until a trained model is deployed. Both paths β€” ML and heuristic β€” are real, functioning parts of Shield, and both feed the same overall risk-fusion logic described in `risk-score-guide.md`. Neither classifier is described here as connecting to any third-party cloud malware-scanning service; the models run as part of Shield's own backend.