MalSight
Not Just Detection — Investigation
The problem MalSight solves
The Malware Detection Problem
Traditional antivirus is failing. Signature-based detection is useless against zero-day malware, AI-generated polymorphic threats, and packed/obfuscated payloads that mutate on every deployment. 91% of cyberattacks start with a phishing email, and most companies — especially SMBs — have no dedicated malware analyst to investigate suspicious files.
What MalSight Does
MalSight is an AI-powered malware analysis platform where a Gemini 2.5 Flash agent acts as a senior security researcher. Instead of matching signatures, it thinks — forming hypotheses, calling analysis tools strategically, reasoning about results, and adapting its investigation based on what it finds.
Three ways people use it:
-
Upload a suspicious file — drag-and-drop any
.exe,.dll,.pdf,.py,.sh, or.zip. Within 60 seconds, get a full threat report in plain English with MITRE ATT&CK technique mapping, IOC extraction, and a confidence-scored verdict. -
Connect your Gmail — MalSight automatically scans every email attachment that arrives. Malicious files are quarantined and labeled before you ever open them. Zero configuration, zero human action required.
-
Send via SMTP — organizations route their mail server through MalSight's SMTP gateway. Attachments are held, analyzed in a GKE gVisor sandbox, and only delivered if clean.
What makes it different from existing tools
- Explainable verdicts — not just "malicious" but why. The full agent reasoning chain is visible: every tool call, every conclusion, every decision. Analysts can audit exactly how the verdict was reached.
- Adaptive investigation — a fixed pipeline runs the same steps on every file. MalSight's agent adapts: a known-hash file resolves in 3 seconds with 1 tool call; an unknown packed binary gets a full 10-step investigation with sandbox execution, memory forensics, and IOC enrichment.
- Real-time reasoning stream — watch the agent think live via Server-Sent Events. AGENT_THOUGHT, TOOL_CALL, TOOL_RESULT events stream to the browser as the investigation happens.
- Memory forensics — packed malware hides its real payload in memory. MalSight dumps process memory at runtime, scans for injected PEs, extracts decrypted strings, and detects shellcode patterns invisible on disk.
- Gmail integration — connect any Gmail account with one click. Attachments are scanned automatically, emails are labeled (MALSIGHT_CLEAN / MALSIGHT_MALICIOUS), and threats are moved to a quarantine folder.
Challenges we ran into
1. Cross-process SSE streaming
The RQ worker (running the Gemini agent) and the FastAPI server (serving the SSE endpoint) are separate processes — they don't share memory. Our initial STREAM_EVENTS in-memory dict was always empty on the API side. Fix: switched to Redis as a shared event bus. Agent emits events to a Redis list, SSE endpoint reads from it with 300ms polling.
2. GKE sandbox can't execute Windows PE binaries
Our sandbox runs on Linux with gVisor. When we submitted a real .exe, it failed with ENOEXEC (Exec format error) — Linux can't natively execute PE32 binaries. Fix: added smart file-type detection in the sandbox command. Windows PEs get static string analysis inside the container; Python/shell scripts get full strace execution. The agent's system prompt was updated to understand this limitation and pivot to static analysis tools for PE files.
3. Gemini FunctionResponse requires dict, not list
get_pe_sections() returns a list of section objects, but the Gemini SDK's FunctionResponse only accepts dicts. Every call to this tool crashed the agent loop with a Pydantic validation error. Fix: wrapped all non-dict tool results in {"items": result, "count": len(result)} before passing to FunctionResponse.
4. MalwareBazaar false positives
The check_malwarebazaar() function was returning found: True for every file because it wasn't checking for API error responses. The API returned {"error": "Unauthorized"} (missing auth header), and our parser treated any non-"hash_not_found" response as a hit. Fix: added explicit error key checking + the correct Auth-Key header (not API-KEY — the docs were misleading).
5. PostgreSQL generated column conflict
Dev 1's database schema had elapsed_seconds as a PostgreSQL generated column (auto-computed from timestamps). Our UPDATE statements tried to write to it directly, crashing every job. Fix: removed elapsed_seconds from all UPDATE queries and let the DB compute it.
6. Redis tunnel vs environment variables
GCP Memorystore Redis is VPC-internal — unreachable from a dev laptop. We SSH-tunnel through a GKE node to 127.0.0.1:6379, but the .env file had the direct Memorystore IP. Worse, stale shell environment variables silently overrode .env values. Fix: used load_dotenv(override=True) everywhere, and added unset REDIS_URL DATABASE_URL to the startup checklist.
7. MalwareBazaar ZIP extraction
Downloaded malware samples use compression level 5.1 which standard unzip can't handle. Extracting real samples for testing required 7zip — a small but frustrating blocker during rapid iteration.
