How worm0x1/h1j4ck works
Project type and purpose
• This is a Chrome browser extension built for educational demonstration of how malicious extensions can exfiltrate sensitive data.
• It consists of three files at the root:
• manifest.json – declares permissions, scripts, and extension metadata
• content.js – injected into web pages to capture credentials and cookies
• background.js – runs in the background, receives messages from content scripts, and forwards data to the attacker’s Telegram bot
File structure
• Top-level files only; no nested directories.
• manifest.json shows the extension’s architecture:
• “content_scripts” section → content.js runs in page context
• “background” section → background.js is the long-lived event handler
• content.js and background.js communicate via the Chrome messaging API.
• No build or deployment scripts—loading is manual via chrome://extensions.
README for architectural clues
• Extension monitors login forms on any website.
• Captured data (username/password + session cookies) is sent via HTTPS POST to the Telegram Bot API.
• The attacker views the exfiltrated data in a Telegram chat.
Main components
a. User’s Browser
• Chrome runtime hosting the extension
• Web pages (login form targets)
b. Chrome Extension
• Content Script (content.js) – DOM listener for form submissions + cookie capture
• Background Script (background.js) – handles outbound HTTP requests
• manifest.json – configuration (permissions: cookies, activeTab, webRequest, http://*/https://* for Telegram API)
c. External Service
• Telegram Bot API endpoint (api.telegram.org/bot<token>/sendMessage)
d. Attacker
• Telegram client receiving messages
Relationships and data flow
1. User navigates to a target site (e.g., bank.com).
2. content.js injects into the page, attaches to login form events.
3. On form submit: content.js reads form fields and document.cookie.
4. content.js sends a Chrome runtime message to background.js with the payload.
5. background.js composes an HTTPS request to the Telegram Bot API using the bot token and chat_id.
6. Telegram API responds; attacker views the message in their mobile/desktop Telegram client.
Architectural patterns and design principles
• Event-driven: content scripts react to DOM events; background script listens to messages.
• Separation of concerns:
• content.js handles sensing/extraction
• background.js handles network communication
Key technologies and libraries
• Chrome Extensions API (chrome.runtime.sendMessage, chrome.cookies)
• JavaScript ES6+ for logic
• HTTPS communication to Telegram