Skip to content

lfzer0h/udjat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Udjat Logo

Udjat β€” The AI Anti-Phishing Agent

License: MIT Platform: Chrome AI-Powered Ollama Supported

Udjat (The Eye of Horus) is an advanced multimodal AI agent designed for real-time zero-day phishing detection. It intercepts every URL you visit in the browser, analyzes it with a multimodal AI (screenshot + DOM text + URL heuristics) before the page is fully interactable, and shows you an inline verdict: SAFE, MALICIOUS, or UNKNOWN.

Udjat solves the critical problem of modern phishing attacks that bypass traditional blocklists by using advanced vision and reasoning to "see" the threat as it happens.


πŸ›‘οΈ Why Udjat? (AI-Powered Phishing Prevention)

Traditional anti-phishing solutions rely on static blocklists and known signatures, leaving you vulnerable to Zero-Day attacks. Udjat changes the game by using a real-time multimodal AI agent that acts as a 24/7 personal security analyst on your device.

  • ⚑ Zero-Day Detection: Identify malicious sites minutes after they go live, without waiting for blocklist updates.
  • πŸ‘οΈ Multimodal Vision: Udjat analyzes logos, UI layouts, and brand impersonation attempts using high-end vision models.
  • 🚫 Anti-Cloaking: Analysis happens natively in your browser, bypassing attacker tricks that hide content from automated server-side scanners.
  • πŸ”’ Hyper-Private: Zero telemetry. Your data stays between you and your AI provider. Use Ollama for a 100% local, air-gapped security model.
  • 🧠 Provider Agnostic: Connect to Google Gemini, OpenAI GPT-4o, Anthropic Claude, or any local model via OpenRouter/Ollama.

πŸ“Έ In Action

1. AI Interception & Block Page Udjat stops the navigation to show you the full reasoning of the AI model before you can interact with the malicious page.

Block Page

2. Persistent Danger Banner (Bypass Mode) If you decide to proceed at your own risk on a flagged site, Udjat injects a persistent, unclosable red banner to ensure you stay alert.

Danger Banner

3. Enterprise Configuration Panel Connect Udjat to your own locally hosted AI (Ollama) or any corporate backend endpoint effortlessly.

Options Page


πŸš€ Quick Start

Get Udjat running in your local machine in under 3 minutes:

1. Clone and Install

git clone https://github.com/lfzer0h/udjat.git
cd udjat
./install.sh       # Interactively installs dependencies, runs setup, and starts server

2. Load Extension in Chrome

  1. Open chrome://extensions
  2. Enable Developer mode (top right corner)
  3. Click on Load unpacked β†’ select the extension/ folder
  4. The Udjat icon will appear in your toolbar.

(For detailed options, Ollama local AI, or Enterprise HTTPS deployment, see Installation and Configuration)


Index


🧠 1. How it Works (Core Concepts)

Udjat applies a zero-trust model to browser navigation, using a hybrid architecture that combines local heuristics with cloud or local AI.

1.1 Technical Data Flow

Udjat Technical Data Flow

1.2 The Analysis Lifecycle (Client-First Hybrid Triage)

Udjat operates on a "Plan A / Plan B" strategy to ensure maximum detection accuracy while being resilient to technical failures.

  1. Stage 1: Client-Side Capture (Plan A - Primary)
    • Capture: The extension waits 1.5s for the page to render and grabs a high-quality screenshot + DOM text.
    • Advantage: By capturing natively in your browser, Udjat sees exactly what you see, bypassing "Cloaking" (when malicious sites show a fake "safe" version to datacenter bots).
  2. Stage 2: Hybrid Fallback (Plan B - Resilience)
    • Trigger: If the extension fails to send data (timeout or error), the Backend triggers its internal Isolated Sandbox.
    • Action: A headless Chromium instance visits the URL independently to generate the required screenshot and text.
  3. Stage 3: Multi-modal AI Verdict
    • The data (from Plan A or Plan B) is sent to the AI (Gemini, Claude, GPT-4, etc.).
    • The AI analyzes brand consistency, urgency, and credential requests to issue a final verdict.

1.3 The 4 Protection Layers

Udjat uses a multi-layered approach to maximize both security and performance, ensuring that AI analysis is only performed when strictly necessary.

  • Layer 1: Static Trust (Whitelist / Allowlist) Before any network activity, Udjat checks if the domain is known to be safe.

    • Local (Extension): STATIC_ALLOWLIST (Google, Microsoft, GitHub, etc.).
    • Remote (Backend): safeDomainsCache (Centralized list from GitHub/URL).
    • Matching: Supports exact match and subdomain inheritance (e.g., google.com covers mail.google.com).
    • Result: Instant SAFE verdict with 0ms latency.
  • Layer 2: Heuristic Triage (Backend) If the domain is unknown, the backend analyzes the URL structure for risk signals.

    • Markers: Checks for brand impersonation, suspicious TLDs, redirect patterns, and keywords.
    • Logic: If 0 signals are found, the site is considered low-risk enough to bypass AI.
    • Result: SAFE verdict without the cost/latency of an AI call.
  • Layer 3: Tri-layer Session Cache To avoid redundant analysis of the same content:

    1. Extension Cache: 10-minute TTL per URL in Service Worker memory.
    2. Backend Cache: Map-based process memory for immediate simultaneous requests.
    3. Browser Storage: Persistent state for bypassed sites.
  • Layer 4: User Exceptions (Bypass & Nag) The final decision layer belongs to the user.

    • Bypass: When a site is blocked, the user can choose to "Proceed at own risk".
    • One-shot Exception: The bypass is temporary and session-based.
    • Nag System: A periodic overlay ensures the user remains aware of the risk.

1.4 Aggressive Detection System

Udjat applies two detection layers before showing a verdict:

1.4.1 Layer 1 β€” URL Heuristics (analyzeUrlSignals)

Instant local analysis of the URL before calling AI. Detects:

Signal Example
High-risk TLD .online, .xyz, .click, .tk, .icu, .buzz
Campaign parameters utm_campaign=, utm_source=, campanha=, ref=
Keywords in domain portal, secure, login, bank, verify, professional
Brand impersonation domain contains microsoft, paypal, nubank, bradesco...
Host is a direct IP http://185.220.101.45/login
Nested subdomains login.secure.account.evil.com
Very long domain >40 characters (obfuscation technique)
Number sequences bank4829301.site

1.3.2 Layer 2 β€” Score Override (aiFactory.runAnalysis)

If the model was too optimistic (returns SAFE but with score > 45), the factory corrects it to MALICIOUS.

Score Meaning Verdict
0–20 Clearly legitimate site SAFE
21–45 Minor signals SAFE
46–65 Multiple risk signals MALICIOUS
66–85 Clear signs of phishing MALICIOUS
86–100 Confirmed phishing MALICIOUS

πŸ€– 2. AI Models & Providers

2.1 Supported AI Models and Performance Comparison

The following table provides an impartial comparison of the models you can configure Udjat to use.

Warning

*** Estimated Detection Rate:** These percentages are rough approximations based on internal testing of obfuscated DOMs and screenshot analysis. Real-world performance heavily depends on the specific, evolving traits of new phishing campaigns. **** Average Costs:** These are generalized estimates. Actual API pricing fluctuates, and real token consumption depends entirely on the size of the website's DOM and the complexity of the viewport screenshot at the time of capture.

AI Model Recommended Provider Est. Detection Rate * Avg. Requests per $10 USD ** Key Characteristics
Claude 3.5 Sonnet Anthropic / OpenRouter ~98.8% ~300 - 450 βœ… State-of-the-art vision reasoning and deobfuscation.
❌ Premium pricing per token.
GPT-4o OpenAI / OpenRouter ~97.2% ~400 - 600 βœ… Extremely consistent with brilliant semantic recognition.
❌ Relatively expensive for massive user bases.
Gemini 2.5 Pro OpenRouter ~96.5% ~500 - 800 βœ… Superior reasoning for complex visual cues and brand detection.
❌ Slower inference than the Flash series.
GPT-4o-mini OpenAI / OpenRouter ~95.5% ~7,000 - 10,000 βœ… Incredible performance-to-cost ratio for high volume.
❌ Slightly less nuance in forensic analysis.
Gemini 2.5 Flash OpenRouter ~94.8% ~12,500+ βœ… Unbeatable speed and ultra-low cost for real-time triage.
❌ Best for standard phishing; might skip edge-case obfuscation.
GLM-4V / Qwen2-VL Zhipu / DashScope ~91.2% ~2,500 - 3,500 βœ… Highly cost-efficient with excellent native OCR.
❌ Ocasional structural biases on non-standard domains.
Llama 3.3 / LLaVA Ollama (LocalHost) ~75% - 85% Unlimited (Hardware) βœ… Absolute privacy (Zero-Trust), data never leaves the local network.
❌ Noticeably lower effectiveness without specific fine-tuning.

Note

Measurement Standard: Detection rates are estimated based on F1-Score averages across zero-day phishing datasets (multimodal analysis). These numbers represent the model's ability to balance precision (avoiding false positives) and recall (catching real threats).

2.2 AI Providers β€” Direct API

All providers make direct calls to their official APIs. There are no wrappers, custom proxies, or third-party abstraction layers between Udjat and the API.

  • Google Gemini (providers/gemini.js): Uses official @google/generative-ai SDK. Native JSON response.
  • OpenAI (providers/openai.js): Uses official openai SDK. Supports image_url base64 uploads.
  • Anthropic (providers/anthropic.js): Uses official @anthropic-ai/sdk. Note the different image source structure.
  • OpenRouter (providers/openrouter.js): Uses official openai SDK with custom baseURL. Automatically retries on 429 errors.
  • Ollama (providers/ollama.js): Uses official openai SDK pointing to localhost:11434. 100% private.

πŸ› οΈ 3. Configuration & Management

3.1 Setup Wizard β€” Interactive Configuration

The easiest way to configure the backend:

cd backend
npm run setup      # launches the interactive wizard

This wizard generates your .env file step-by-step, masking API keys and validating ports.

3.2 Whitelist Management

3.2.1 Local User Whitelist

  • Shortcut: Click the Udjat icon β†’ "Whitelist this domain".
  • Management: Open the Options panel (Right-click icon β†’ Options) to view, add, or remove domains.
  • Persistence: Saved in chrome.storage.local.

3.2.2 Centralized Whitelist Management

Udjat allows managing a global list of trusted domains via a remote text file (e.g., hosted on GitHub Raw).

  • Configuration: Set WHITELIST_URL in backend/.env.
  • Inheritance: Whitelisting google.com covers all subdomains.
  • Platform Protection: Trust inheritance is explicitly blocked for UGC platforms like github.io or s3.amazonaws.com to prevent bypasses.
  • Sync: Auto-refreshes every 24 hours.

3.3 Using Ollama (Local AI β€” No API Key)

  1. Install Ollama: curl -fsSL https://ollama.com/install.sh | sh.
  2. Pull a model: ollama pull llava (Vision recommended).
  3. Configure Udjat: Select "Ollama" in the Setup Wizard.

3.4 Installation and Configuration (Manual)

If you prefer not to use the automated scripts:

Backend

cd backend
npm install
npm run setup
npm start

Extension

  1. Open chrome://extensions.
  2. Enable Developer mode.
  3. Click Load unpacked β†’ select extension/ folder.

πŸ—οΈ 4. System Architecture (Deep Dive)

4.1 General Architecture

Model: Client-Side Capture + AI Triage Proxy

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                       BROWSER (Chrome)                          β”‚
β”‚                                                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  background.js           β”‚   β”‚  content.js               β”‚   β”‚
β”‚  β”‚  (MV3 Service Worker)    │◄─►│  (Content Script)         β”‚   β”‚
β”‚  β”‚                          β”‚   β”‚                           β”‚   β”‚
β”‚  β”‚  onBeforeNavigate:       β”‚   β”‚  - UDJAT_GET_DOM_TEXT     β”‚   β”‚
β”‚  β”‚    quick decisions       β”‚   β”‚    extract title+body+forms   β”‚
β”‚  β”‚    (allowlist/cache)     β”‚   β”‚  - Analysis overlay       β”‚   β”‚
β”‚  β”‚                          β”‚   β”‚  - Verdict panel          β”‚   β”‚
β”‚  β”‚  onCompleted:            β”‚   β”‚  - Nag system             β”‚   β”‚
β”‚  β”‚    captureVisibleTab()   β”‚   β”‚                           β”‚   β”‚
β”‚  β”‚    GET_DOM_TEXT          β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β”‚    SHOW_OVERLAY          β”‚                                   β”‚
β”‚  β”‚    callBackend(...)      β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚  options.html / .js       β”‚   β”‚
β”‚               β”‚                 β”‚  - Configure backend URL  β”‚   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚  - Enterprise deployment  β”‚   β”‚
β”‚  β”‚  popup.html / .js        β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚  β”‚  - Backend status        β”‚                                   β”‚
β”‚  β”‚  - Active verdict        β”‚                                   β”‚
β”‚  β”‚  - History Β· Nag config  β”‚                                   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚ POST /api/analyze
                    β”‚ { url, screenshotBase64, extractedText }
                    β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              BACKEND β€” AI Triage Proxy (Node.js)                β”‚
β”‚                                                                 β”‚
β”‚  Express API (/api/health Β· /api/analyze)                       β”‚
β”‚      β”œβ”€β”€ 1. Cache Check                                         β”‚
β”‚      β”œβ”€β”€ 2. Heuristic Triage                                    β”‚
β”‚      └── 3. AI Bridge (Gemini, GPT-4o, Claude, Ollama)          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

4.2 File Structure

udjat/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ server.js                      # Express Entry point
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ ai/                        # Strategic AI providers
β”‚   β”‚   β”œβ”€β”€ sandbox/                   # Puppeteer fallback sandbox
β”‚   β”‚   └── prompt.js                  # Unified JSON Prompt
└── extension/
    β”œβ”€β”€ background.js                  # Capture engine
    β”œβ”€β”€ content.js                     # UI Overlay & Extraction
    β”œβ”€β”€ options.html                   # Admin Panel
    └── block.html                     # Phishing block page

4.3 Complete Navigation Sequence & Messages

  1. [onBeforeNavigate]: Quick check (Whitelist/Cache).
  2. [onCompleted]: Full Analysis.
    • captureVisibleTab() β†’ clean screenshot.
    • UDJAT_GET_DOM_TEXT β†’ Title + Body + Forms.
    • UDJAT_SHOW_OVERLAY β†’ Blocks user interaction.
    • POST /api/analyze β†’ Backend triage + AI evaluation.
  3. Result: Handle verdict (Redirect to block.html OR hide overlay).

SW ↔ Content Script Messages

Message Direction Action
UDJAT_SHOW_OVERLAY SW β†’ CS Shows analysis spinner
UDJAT_SHOW_VERDICT SW β†’ CS Shows result (UNKNOWN/degraded)
UDJAT_START_NAG SW β†’ CS Starts periodic warnings
UDJAT_BYPASS_AND_GO Block β†’ SW User accepts risk

4.4 Extension UI & Hardware Constraints

  • 8-bit Icons: Chrome MV3 only accepts 8-bit PNGs for setIcon. 16-bit PNGs render fully transparent.
  • Run-at document_start: Ensuring the overlay appears before the HTML parser finishes.

πŸ›°οΈ 5. Expert Reference & Deployment

5.1 Backend API

GET /api/health

Checks backend status and active AI provider.

POST /api/analyze

Request: { "url": "https://suspicious.site" } Response:

{
  "verdict": "MALICIOUS",
  "score": 82,
  "reason": "Brand impersonation + suspicious TLD.",
  "provider": "GEMINI",
  "latencyMs": 3100
}

5.2 Environment Variables

Set in backend/.env:

  • AI_PROVIDER: GEMINI, OPENAI, ANTHROPIC, etc.
  • WHITELIST_URL: Path to remote trusted list.
  • HOST/PORT: Server network configuration.

5.3 HTTPS via Reverse Proxy

The Udjat backend is a plain HTTP server β€” it does not handle TLS natively. For deployments that require HTTPS (public servers, corporate networks with SSL inspection), the recommended approach is to place a reverse proxy in front of Express.

Chrome Extension  ──HTTPS──►  nginx / Caddy  ──HTTP──►  Express :8000

The extension talks HTTPS to the proxy; the proxy terminates TLS and forwards plain HTTP to the local Express process. No changes are needed to the Udjat source code.

5.4 Enterprise Deployment Model (Dedicated Server + Multi-Client)

Udjat handles enterprise-scale analysis naturally. You can host a single backend server and point multiple Udjat extensions to it:

  1. Deploy the backend on a dedicated server (public or VPN-accessible).
  2. Set up HTTPS: Configure Nginx/Caddy (as shown in section 5.3) to provide a secure endpoint.
  3. Configure Clients: In the Udjat extension Options Panel, simply replace http://127.0.0.1:8000 with your server's URL (e.g., https://udjat.yourcompany.com).

Udjat Enterprise Architecture

This allows a centralized security engine to protect your entire fleet with a single API key and shared intelligence.

5.6 Design and Security Decisions

  • Fail-closed: Any internal failure returns UNKNOWN (warning) β€” never SAFE.
  • Hybrid Sandbox Fallback: If the extension fails to send data, the backend triggers an integrated Puppeteer Sandbox for independent capture.
  • Chromium Reincarnation: To maintain stability, the backend sandbox recycles Chromium every 100 uses to prevent memory leaks.
  • No Telemetry: Analysis is private. Data only reaches your backend and chosen AI provider.

5.7 Enterprise Readiness & Maintenance

  • Structured Logging: Ready for SIEM (Splunk/ELK) ingestion.
  • Standard JSDoc: The entire codebase follows professional JSDoc standards for easy auditing.
  • Rate Limiting: Protects the backend from DoS and budget depletion.

βš–οΈ 6. License

This project is licensed under the MIT License.


🏷️ Keywords & Tags

ai-phishing antiphishing cybersecurity-agent security-llm zero-day-detection ollama-security multimodal-ai-agent phishing-prevention automated-security-analyst browser-security-extension