How vaginessa/qrljacking works
Project Type and Purpose
• This repository is an open-source security tool and exploitation framework (QRLJacking Framework) with example phishing templates.
• Its purpose is to demonstrate and automate the QRLJacking attack vector: hijacking “Login with QR code” sessions by proxying, cloning, and serving attacker-controlled QR codes.
File-Structure Analysis
• Top-level components:
• QrlJacking-Framework/ – Python-based core framework (QRLJacker.py, Data/Custom.ini, requirements.txt).
• Templates-Examples/ – Example modules and phishing page templates (All-in-one module, WhatsApp Web, etc.).
• Standalone demo files (WhatsAppQRJackingModule.js, phishing.html, qrHandler.php) for quick manual use.
• The framework follows a plug-in pattern: modules in Templates-Examples or custom JS files injected via Greasemonkey.
• Deployment artifacts: qrHandler.php (converts base64 strings to tmp.jpg), storeQR.php (example of QR persistence).
Key Insights from README
• Two logical sides:
a) Server Side – hosts phishing page, serves cloned QR images.
b) Client Side – injects code into target site to hijack the QR payload in real time.
• Supports manual (Greasemonkey) and automated (QRLJacker.py) modes.
• Examples focus on WhatsApp Web, but any QR-login service is vulnerable.
Components
A. Attacker Infrastructure
1. QRLJacking Framework (Python)
• QRLJacker.py: WebSocket/HTTP proxy trapping QR data.
• Data/Custom.ini: Configuration (target URL, ports).
• requirements.txt: Dependencies (e.g., flask, socketIO).
2. Phishing Server (PHP)
• qrHandler.php: Converts incoming base64 → tmp.jpg.
• phishing.html/storeQR.php: Phishing page serving tmp.jpg and capturing session.
3. Greasemonkey Module (JS)
• WhatsAppQRJackingModule.js (or other modules): Injects into victim’s browser to intercept the QR from the legitimate site.
B. Victim Environment
• Victim’s Browser on web.whatsapp.com (or other target service).
• Scans attacker-controlled QR on phishing page.
C. Target Service
• Legitimate WebSocket endpoint on web.whatsapp.com delivering QR challenge.
Relationships and Data Flow
1. Framework proxy opens a WebSocket to the real target service and injects into it, capturing the live QR base64.
2. QRLJacker.py pushes the base64 to the phishing server’s qrHandler.php via HTTP POST.
3. qrHandler.php writes tmp.jpg to the phishing root.
4. Victim accesses phishing.html which poll-loads tmp.jpg.
5. Victim scans QR; whose session cookie is bound to the attacker’s proxied WebSocket.
6. Attacker’s QRLJacker.py now controls the session and can issue API calls or extract cookies.
• Real Target → Framework Proxy (WebSocket)
• Framework → qrHandler.php (HTTP POST)
• Phishing Page → tmp.jpg (HTTP GET polling)
• Victim Mobile App → Legitimate Service (QR scan)
• Legitimate Service → Framework Proxy (authenticated session flow)
Architectural Patterns and Principles
• Proxy Pattern: QRLJacker acts as middleware between victim and real service.
• Plugin/Module Architecture: Templates-Examples folder demonstrates how new modules (JS files + HTML/PHP) can be dropped in.
• Separation of Concerns:
• Python side handles communication and WebSocket hijacking.
• PHP side handles presentation and image conversion.
• JS side handles in-browser injection.