💡 Inspiration

Over ₹1,000 Crore is lost annually to digital payment and UPI fraud in India. Fraudsters weaponize social engineering: SMS electricity bill threats, fake KYC update links on WhatsApp, and deceptive QR codes promising "cashback" that actually drain victims' accounts when they enter their UPI PIN.

Traditional anti-fraud systems are reactive—they flag suspicious behavior after money has already left the victim's account. We asked ourselves: Why not warn users BEFORE they pay?

PayGuard AI is built on a single, uncompromising principle: Prevention at the moment of payment, not post-fraud detection.


🛡️ What It Does

PayGuard AI acts as an intelligent, real-time security shield across three distinct digital attack vectors:

  1. Phishing Link Analyzer: Scans URLs received over WhatsApp/SMS. Detects typosquatting (Levenshtein distance against trusted brands like Paytm, SBI, PhonePe, Google Pay), high-risk TLDs (.xyz, .top, .click), raw IP hosts, @ character redirection tricks, punycode/homograph attacks, and open redirects.
  2. QR Deep Link Inspector: Decodes and verifies UPI payment deep links (upi://pay). It flags payee name vs. VPA mismatches (e.g. display name says "Official Support" but VPA is a personal ID), detects the common "UPI Collect" trick where users are tricked into entering a PIN to "receive" money, and catches tampered high pre-filled amounts (₹50,000+).
  3. Behavioral Anomaly Engine: Analyzes transaction requests against personalized user baselines (z-score amount deviation, burst velocity, odd midnight hours 1–5 AM, unseen payees, and psychological urgency keywords like "urgent refund" or "KYC blocked").
  4. Safety-Gated UX & AI Explainer: High-risk threats trigger a full-screen blocking modal with an audio alert. Users are prevented from proceeding unless they actively acknowledge a safety-gated override checkbox. Every verdict includes a plain-English, non-technical explanation explaining what scammers are trying to do.
  5. Accessibility: Fully bilingual in English and Hindi (हिन्दी) with dark/light mode and interactive analytics.

⚙️ How We Built It

We structured PayGuard AI as a production-grade monorepo adhering strictly to a unified API contract:

  • Backend (FastAPI + Python 3.11):
    • RandomForest Classifier: Trained on 10,000+ balanced legitimate and phishing URLs with hard negatives (feature importance: suspicious keywords 38.7%, brand spoofing 18.2%, suspicious TLDs 11.8%).
    • IsolationForest Anomaly Detector: Unsupervised behavioral modeling on synthetic per-user spending profiles calibrated to continuous risk probabilities.
    • Deterministic Risk Engine: Weighted blending of heuristic cybersecurity rules and ML confidence into calibrated risk scores (0–100, LOW/MEDIUM/HIGH tiers).
    • Storage & Logging: SQLite with SQLAlchemy for audit trails, with automated query-parameter masking to ensure zero user credentials or tokens are logged.
  • Frontend (React 18 + Vite + Tailwind CSS):
    • Live webcam scanner and file dropzone powered by jsQR.
    • Interactive SVG risk gauges, warning modals, and threat analytics charts using Recharts.
    • Dynamic bilingual translation engine (English & Hindi).
  • Testing & DevOps:
    • 36 pytest unit/integration tests with 87% test coverage.
    • 9 Vitest/RTL unit tests and 5 Playwright end-to-end tests.
    • Sub-10ms P95 latency benchmark across all analyze endpoints.
    • Deployed on Render (FastAPI backend) and Vercel (React frontend).

🥊 Challenges We Ran Into

  • Synthesizing Realistic Hard Negatives: Standard ML models easily overfit by flagging any URL with hyphens as malicious. We generated hard negatives (e.g., legitimate enterprise domains like developer-support.microsoft.com and long official paths) to ensure 0% false positives on genuine banking portals.
  • UPI Architecture Nuances: Standard UPI QR codes don't standardise payee names vs. merchant category codes uniformly. We built a resilient URI parser capable of handling malformed strings, embedded URLs, and non-UPI plain text without crashing.
  • Air-Gapped & Latency Constraints: Live WHOIS lookups can take 1–3 seconds, causing unacceptable friction at checkout. We designed an abstract WhoisProvider interface with a high-speed deterministic mock (< 5ms) and an optional live network provider.

🏆 Accomplishments That We're Proud Of

  • Sub-10ms P95 Latency: Achieved an average response time of ~5ms per analysis locally and sub-30ms in production.
  • Zero False Negatives on Sample Data: 100% of malicious test vectors scored HIGH or MEDIUM, and 100% of legitimate payment links scored LOW.
  • Accessible & Empowering UX: Everyday users without cybersecurity knowledge can instantly understand the plain-English explanations in their preferred language (English or Hindi).

📚 What We Learned

  • Prevention in fintech requires human-centered friction: a subtle warning is often ignored, which is why safety-gating (requiring manual checkbox acknowledgement before paying) is essential for high-risk alerts.
  • Combining rule-based heuristics with statistical ML creates an explainable and reliable defense system—heuristics capture known deterministic attack patterns while ML catches emerging structural anomalies.

🚀 What's Next for PayGuard AI

  • Browser Extension & SMS Auto-Scrubber: Auto-analyzing payment links directly inside mobile SMS and WhatsApp Web notifications before the user even clicks them.
  • Crowdsourced Threat Intelligence: Community-driven reporting network verified by consensus scoring to rapidly flag zero-day scam VPAs across India.

Built With

Share this project:

Updates

Submission history