ScanGuard is a self-hosted, privacy-respecting malware analysis web portal inspired by VirusTotal, but designed with a defensive security mindset. Built as a cybersecurity graduate portfolio project, it demonstrates secure file handling, malware detection, and privacy-first architecture.
| Feature | VirusTotal | ScanGuard |
|---|---|---|
| Malware Engines | 70+ (cloud-based) | 1 (ClamAV, self-hosted) |
| Data Storage | Files stored indefinitely | Zero permanent storage |
| Privacy | Shared with security vendors | Fully isolated, no sharing |
| User Tracking | Account-based, logged | No accounts, no tracking |
| Threat Intel | Multi-source aggregation | Single-engine detection |
| Use Case | Production malware analysis | Educational/Research |
| Architecture | Proprietary cloud service | Open-source, self-hosted |
- Isolation First: All file processing occurs in isolated temporary directories
- Immediate Deletion: Files deleted within milliseconds of scan completion
- No Execution: Files are NEVER executed under any circumstances
- Minimal Attack Surface: Single scanning engine, no external API calls
- Rate Limiting: In-memory rate limiting prevents abuse (10 requests/60s)
- Input Validation: Strict file size, extension, and hash format validation
βββββββββββββββββββ
β File Upload β
β (Client-Side) β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Size & Type ββββββ Max 10MB
β Validation ββββββ Extension Allowlist
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Isolated Temp ββββββ Temporary Directory
β Directory ββββββ Restricted Permissions
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β SHA-256 Hash β
β Computation β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β ClamAV Scan ββββββ No File Execution
β (Signature) ββββββ Pattern Matching Only
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Return Result ββββββ Clean / Suspicious / Malicious
β + Metadata ββββββ Detection Name (if found)
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β File & Dir ββββββ CRITICAL: Always executed
β Deletion ββββββ Even on errors/exceptions
βββββββββββββββββββ
- Malicious File Uploads: Users uploading actual malware samples
- Exploitation Attempts: Files crafted to exploit vulnerabilities in scanning engine
- Abuse/DoS: Repeated uploads to overwhelm the system
- Privacy Attacks: Attempts to infer user identity from scans
- Curious Probing: Users testing system boundaries
| Threat | Mitigation |
|---|---|
| Malware Execution | Files never executed; signature-based scanning only |
| Path Traversal | Isolated temp directories with unique names |
| Resource Exhaustion | 10MB file limit + rate limiting (10 req/min) |
| User Tracking | No IP logging, no user accounts, no permanent logs |
| Signature Evasion | Regular ClamAV definition updates (not automated in demo) |
| Zero-Day Malware | Limited Protection (single-engine limitation) |
- Zero-Day Threats: ClamAV relies on signatures; novel malware may not be detected
- Advanced Evasion: Polymorphic/metamorphic malware may bypass detection
- Nation-State Attacks: Not hardened against advanced persistent threats (APTs)
- Production Hardening: Demo setup; not audited for production deployment
- Comprehensive Coverage: Single engine vs. multi-engine analysis (VirusTotal's strength)
- Framework: FastAPI (Python 3.11+)
- Malware Engine: ClamAV (via
python-clamd) - File Handling:
tempfile+shutil(secure temp directories) - Rate Limiting: In-memory dictionary (production: Redis)
- Hashing: Python
hashlib(SHA-256)
- Framework: React 19 (SPA)
- UI Library: shadcn/ui + Tailwind CSS
- Animations: Framer Motion
- HTTP Client: Axios
- Notifications: Sonner (toast notifications)
- Server: FastAPI on Uvicorn
- Database: None (no persistent storage by design)
- Deployment: Docker container (ClamAV + App)
- Python 3.11+
- Node.js 18+
- ClamAV installed and running
Ubuntu/Debian:
sudo apt-get update
sudo apt-get install clamav clamav-daemon
sudo systemctl start clamav-daemon
sudo systemctl enable clamav-daemon
# Update virus definitions
sudo freshclammacOS (Homebrew):
brew install clamav
brew services start clamav
# Update virus definitions
freshclamDocker (Recommended for Demo):
docker run -d -p 3310:3310 clamav/clamav:latestcd backend
pip install -r requirements.txt
# Start FastAPI server
uvicorn server:app --host 0.0.0.0 --port 8001 --reloadcd frontend
yarn install
# Update .env with backend URL
echo "REACT_APP_BACKEND_URL=http://localhost:8001" > .env
# Start React app
yarn startcurl http://localhost:8001/api/healthExpected response:
{
"status": "operational",
"clamav_available": true,
"engine_version": "ClamAV 1.0.0/..."
}Check API and ClamAV engine status.
Response:
{
"status": "operational",
"clamav_available": true,
"engine_version": "ClamAV 1.0.0/27034/Tue Jan 7 12:00:00 2025"
}Upload and scan a file.
Request:
- Method:
POST - Content-Type:
multipart/form-data - Body:
file(binary file, max 10MB)
Response (Clean File):
{
"scan_id": "a1b2c3d4-...",
"file_hash": "e3b0c44298fc1c14...",
"file_name": "document.pdf",
"file_size": 524288,
"status": "clean",
"detection_name": null,
"engine_version": "ClamAV 1.0.0/27034",
"scan_time": "2025-01-07T12:00:00Z",
"message": "File scanned successfully"
}Response (Malicious File):
{
"scan_id": "f5e6d7c8-...",
"file_hash": "275a021bbfb6489e...",
"file_name": "malware.exe",
"file_size": 102400,
"status": "malicious",
"detection_name": "Win.Trojan.Generic-12345",
"engine_version": "ClamAV 1.0.0/27034",
"scan_time": "2025-01-07T12:05:00Z",
"message": null
}Lookup a SHA-256 hash.
Request:
{
"hash": "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f"
}Response:
{
"hash": "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f",
"status": "malicious",
"message": "Hash matches known threat: EICAR-Test-File"
}The EICAR test file is a standard, harmless file recognized by all antivirus engines.
Download EICAR:
curl -o eicar.com https://secure.eicar.org/eicar.com.txtTest Upload:
- Navigate to
http://localhost:3000 - Click File Upload tab
- Upload
eicar.com - Expected result: MALICIOUS with detection name
Eicar-Test-Signature
Test Hash Lookup:
- Click Hash Lookup tab
- Enter:
275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f - Expected result: MALICIOUS with message about EICAR
- β Files: Deleted immediately after scan (verified in code)
- β User IP Addresses: Not logged in application logs
- β Upload Timestamps Linked to Users: Only coarse timestamps shown
- β User Accounts: No authentication system
- β Session Cookies: No persistent session tracking
- β File Metadata Beyond Scan: Only hash + scan result kept in memory briefly
- β±οΈ Rate Limit Counters: In-memory only, auto-expires after 60 seconds
- β±οΈ Scan Results: Displayed to user, not persisted to disk/database
File Deletion (server.py:273-287):
finally:
# CRITICAL: Always delete temporary files and directory
if temp_file_path and temp_file_path.exists():
temp_file_path.unlink()
logger.info(f"Deleted temporary file: {temp_file_path}")
if temp_dir and Path(temp_dir).exists():
shutil.rmtree(temp_dir)
logger.info(f"Deleted temporary directory: {temp_dir}")This tool is designed for:
- Educational purposes (cybersecurity coursework/portfolio)
- Research (malware analysis in controlled environments)
- Personal file verification (scanning your own files)
Do NOT use this tool for:
- β Analyzing files you do not own or have permission to scan
- β Circumventing security measures on systems you don't control
- β Production malware analysis without proper hardening
- β Distributing malware or weaponizing detection gaps
- Malware Possession: Possessing malware samples may be illegal in some jurisdictions
- Liability: This tool is provided "as-is" without warranties
- No Guarantees: Single-engine scanning cannot guarantee threat detection
- User Responsibility: You are responsible for how you use this tool
- Automated ClamAV Updates: Schedule
freshclamruns via cron - Hash Database: Local cache of scanned hashes (SQLite, with TTL)
- YARA Rules Integration: Custom signature creation
- Sandbox Analysis: Integrate Cuckoo Sandbox for dynamic analysis
- Multi-Engine Support: Add additional scanners (Windows Defender API, VirusTotal API)
- Threat Intelligence Feeds: Integrate with MISP, OTX, or similar
- Containerized Scanning: Isolate scans in Docker containers
- Metrics Dashboard: Scan statistics (total scans, detection rate)
This is a portfolio project, but contributions are welcome:
- Security Issues: Report vulnerabilities via GitHub Issues (private disclosure)
- Bug Fixes: Submit pull requests with clear descriptions
- Documentation: Improve README, add code comments
- Feature Requests: Open issues with detailed use cases
This project is licensed under the MIT License.
- ClamAV: Open-source antivirus engine (https://www.clamav.net/)
- EICAR: Standard test file for AV testing (https://www.eicar.org/)
- FastAPI: Modern Python web framework (https://fastapi.tiangolo.com/)
- shadcn/ui: Beautiful UI components (https://ui.shadcn.com/)
- VirusTotal: Inspiration for multi-engine analysis concept (https://www.virustotal.com/)
For questions or feedback:
- GitHub: Open an issue
- Email: your.email@example.com (replace with your contact)
Think like a blue-team engineer, not a SaaS founder.