// HackTheBox  ·  writeup

Suspicious_Browser_Extension

HackTheBox Medium unzipfilegrep
Malware Analysis

Scenario

Analyze suspicious browser extension

Executive Summary

A Chrome extension masquerading as a finance tool was delivered as a CRX package. Unpacked, it turned out to be a small two-script extension: a background script and a content script injected into pages. The extension checks the renderer for virtual machine signatures and, if it finds one, tears down the browser process to frustrate sandbox analysis. On real systems, the content script watches for visits to login pages and logs keystrokes, then the background script posts the captured data over XHR to a domain styled after Google Analytics. Everything was recoverable by static reading of the package; nothing was executed.

Artifacts

Tool note: The questions reference ExtAnalysis. It was not run here, so the ExtAnalysis-specific answers (Q4, Q5) were reasoned from the extracted files instead. Both are called out below.

Persistence

Q1 — Which browser supports this extension?

Extract the archive and run file on the package. The header reports a Chrome extension, CRX version 3, which is the format Chromium-based browsers install from. The browser is named in the answer format as two words.

unzip -P '<password from danger.txt>' evidence/danger.zip -d work/x
file work/x/FinanceEYEfeeder.crx
Click flag to reveal google chrome
Q2 — What is the name of the main file which contains metadata?

Unzip the CRX. Every Chromium extension carries one manifest at the package root, declaring the name, version, permissions, background page and content script matches. That is the file to read first.

unzip FinanceEYEfeeder.crx -d work/x/c
Click to reveal answer manifest.json
Q3 — How many js files are there? (Answer should be numerical)

List the extracted tree for .js files. Only content.js and background.js exist; the HTML pages carry their logic inline or reference these two.

find work/x/c -name '*.js'
Click flag to reveal 2
Q4 — Download and install ExtAnalysis. Is the author of the extension known? (Yes/No)

This was reasoned, not read from ExtAnalysis. The manifest.json has no author field, and ExtAnalysis reports author information from that metadata, so the author is unknown.

grep -i author work/x/c/manifest.json

Note: The grep returns nothing, which is the evidence for the answer. HTB accepted it, but it was not confirmed in the tool the question names.

Click to reveal answer no
Q5 — Often there are URLs and domains in malicious extensions. Using ExtAnlaylsis, check the ‘URLs and Domains’ tab How many URLs & Domains are listed? (Answer should be numerical)

Also reasoned rather than read from ExtAnalysis. The URLs found in background.html and background.js pointed at the number of entries the tab would list. The count of eyeballed URLs is the trap here.

grep -oE 'https?://[^"'"'"' )]+' work/x/c/background.html work/x/c/background.js

Gotcha: A naive count of every URL-looking string overshoots what the tool lists. The accepted figure is lower than the first guess.

Click flag to reveal 2

Defense Evasion

Q6 — Find the piece of code that uses an evasion technique. Analyse it, what type of systems is it attempting to evade?

ThankYou.html tests the graphics renderer string for swiftshader, vmware and virtualbox. Those strings show up when a browser runs inside a virtual machine or a headless sandbox, so the code is checking for analysis environments.

grep -inE 'swiftshader|vmware|virtualbox' work/x/c/ThankYou.html
Click to reveal answer virtual machine
Q7 — If this type of system is detected what function is triggered in its response?

Follow the same renderer check in ThankYou.html to its branch. When a VM renderer matches, the page calls the chrome.processes API to terminate process 0, killing the browser process so the sandbox run ends.

grep -n 'chrome.processes' work/x/c/ThankYou.html
Click flag to reveal chrome.processes.terminate(0)

Collection

Q8 — What keyword in a user visited URL will trigger the if condition statement in the code?

In content.js the URL test is written as a hex-escaped regular expression to dodge simple string searches. Decoding the escapes gives the page name login.aspx, so the condition fires on login pages and the keyword is the first part of that name.

grep -n 'test\|match' work/x/c/content.js

Tip: Decode the \x hex escapes before reading the condition; the keyword is not visible as plain text.

Click to reveal answer login
Q9 — Based on the analysis of the content.js, what type of malware is this?

Once the login-page condition passes, content.js attaches an onkeydown handler and records every key pressed. Capturing keystrokes on a login form is a keylogger.

grep -n 'onkeydown' work/x/c/content.js
Click flag to reveal keylogger

Exfiltration

Q10 — Which domain/URL will data be sent to?

background.js receives the data from the content script and sends it with an XHR POST. The destination is a .txt path on a domain built to look like Google Analytics.

grep -n 'XMLHttpRequest\|POST\|http' work/x/c/background.js
Click to reveal answer https://google-analytics-cm.com/analytics-3032344.txt
Q11 — As a remediation measure, what type of credential would you recommend all affected users to reset immediately?

Reasoned from the behavior, not read from an artifact. The keylogger targets login pages, so what it captures is typed credentials; the password is what to reset.

Click flag to reveal password

Attack Summary

PhaseAction
PersistenceMalicious extension installed as a CRX v3 package in Chrome
Defense EvasionThankYou.html checks the renderer for VM signatures and terminates the browser process if found
Collectioncontent.js triggers on login pages and keylogs with onkeydown
Exfiltrationbackground.js POSTs captured data over XHR to a look-alike analytics domain

IOCs

TypeValue
FileFinanceEYEfeeder.crx
URLhxxps[://]google-analytics-cm[.]com/analytics-3032344[.]txt
Domaingoogle-analytics-cm[.]com

MITRE ATT&CK

TechniqueIDDescription
Browser ExtensionsT1176Malicious Chrome extension delivered as a CRX
Virtualization/Sandbox Evasion: System ChecksT1497.001Renderer string check for VM signatures, then process termination
Input Capture: KeyloggingT1056.001onkeydown capture on login pages
Exfiltration Over C2 ChannelT1041XHR POST to the attacker domain
Masquerading: Match Legitimate Name or LocationT1036.005Domain styled after Google Analytics

Defender Takeaways

Unmanaged extensions are an unmonitored code path. This package runs with page access on every site and ships its own network client. Restrict installs to an allowlist through Chrome enterprise policy (ExtensionInstallAllowlist) so a CRX sideloaded from a zip is blocked.

Review the manifest before anything else. A missing author, broad host permissions and a background page are cheap signals. Triage the manifest first, then read the two scripts.

Look-alike analytics domains should be a proxy detection. google-analytics-cm.com is not Google. Flag domains that contain a trusted brand name but are not on its real domain list, and alert on POSTs to .txt paths.

Plan for credential reset on keylogger exposure. Anyone who browsed login pages while the extension was active should reset passwords, and the extension should be removed fleet-wide.

Conclusion

A harmless-looking finance extension was a login-page keylogger with sandbox evasion and a look-alike exfiltration domain. Two small scripts were enough, which is why a five-minute static read of the manifest and JavaScript beats waiting for it to misbehave in a lab.