Join our Newsletter — 33% off our NHI Course
Home› Glossary› Threats, Abuse & Incident Response› JavaScript Cryptojacking
Threats, Abuse & Incident Response

JavaScript Cryptojacking

← Back to Glossary
By NHI Mgmt Group Updated November 25, 2026 Domain: Threats, Abuse & Incident Response

JavaScript cryptojacking is cryptomining code delivered and executed in a browser by JavaScript. It typically uses embedded scripts on websites or in adverts to mine cryptocurrency using the visitor’s CPU, often without visible consent or a separate installed payload. Blocking script injection and limiting browser execution reduce exposure.

How JavaScript cryptojacking works

JavaScript cryptojacking turns the browser into the mining runtime. A site, ad, or injected script loads mining logic into the page, then uses the visitor’s CPU while the tab stays open. Because the code runs in ordinary web execution flow, it can blend into legitimate page behaviour and avoid the friction of a separate installed binary.

What makes this technique effective is not sophistication in the miner itself, but delivery. The attacker only needs a way to place or reference script on a page, then keep the browser executing long enough to generate value. That makes browser content control, script provenance, and runtime restrictions central to understanding the threat.

Why browsers are an attractive mining environment

A browser gives cryptojacking broad reach with low deployment cost. It can target many visitors at once, exploit the user’s own compute, and disappear when the page closes. In practice, the attacker trades persistence for scale, and often accepts lower per-host yield in exchange for very wide exposure.

The browser context also provides cover. Script execution is routine, and many sites depend on third-party content that can be abused if integrity controls are weak. The result is a technique that often looks like a performance issue first, then a security problem when CPU spikes, heat, battery drain, or unusual network activity are investigated.

Exposure paths and common enablement factors

JavaScript cryptojacking usually appears through one of three paths: malicious site content, compromised third-party web dependencies, or advertising and tag injection. The underlying weakness is often not the miner code itself, but the ability to deliver untrusted script into a browser session without being blocked.

Organisation-wide exposure also increases when users can reach high-risk sites from unmanaged browsers, when script injection defenses are weak, or when content security policy is too permissive. The same pattern can affect consumer and enterprise environments, although the business impact is usually higher where many endpoints, long browsing sessions, or high-value devices are involved.

Detection and response considerations

Detection often starts with browser symptoms rather than a neat alert: sustained CPU usage, fans spinning, lag, battery drain, or a tab that consumes more resources than expected. Network indicators can include calls to mining pools, unusual WebSocket activity, or repeated requests that do not match normal site behaviour. For a broader incident perspective on cryptomining abuse and related delivery patterns, see the Cryptojacking Guide.

Response usually means removing the malicious script source, validating whether the site or ad chain was compromised, and checking whether any browser extension or endpoint process was also involved. If the exposure came through a broader malware or supply-chain path, the relevant history and evasion patterns are covered in Malware Guide and, when JavaScript delivery is part of a wider compromise, Shai Hulud npm malware campaign.

Risk and Threat Considerations

JavaScript cryptojacking is usually less about data theft than about covert resource abuse, but it still creates security and operational impact. It can degrade endpoint performance, increase cloud or power costs where browsers run on managed infrastructure, and expose gaps in web content controls that attackers can reuse for worse payloads.

Failure mechanism: The attacker abuses browser trust to execute mining code inside normal page rendering, often through injected scripts, compromised ad networks, or a malicious dependency chain. If the content source is trusted by the browser, the miner can run until defenders notice the resource anomaly or the session ends.

Impact: Organisations can see degraded user experience, higher resource consumption, and a signal that the same content path could deliver more harmful code. If the browser session is on a shared or privileged device, the cryptomining activity may also indicate broader compromise of the web delivery layer.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

MITRE ATT&CK and OWASP Non-Human Identity Top 10 address the attack and risk surface, while CIS Controls v8, NIST CSF 2.0 and OWASP ASVS set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
CIS Controls v8CIS-9 — Email and Web Browser ProtectionsBrowser cryptojacking rides web execution and script delivery paths.
Recommendation — Harden browsers and web access to reduce malicious script execution.
NIST CSF 2.0PR.PS-04 — Software, services, and applications are managed throughout their lifecyclesBrowser-delivered cryptojacking depends on unsafe web content and third-party code paths.
Recommendation — Manage web content and dependencies to limit untrusted code execution.
OWASP ASVSV13 — ConfigurationScript controls and browser-facing settings shape exposure to injected mining code.
Recommendation — Apply secure configuration controls that restrict execution of untrusted browser content.
MITRE ATT&CKT1189 — Drive-by CompromiseBrowser-delivered cryptojacking often enters through compromised or malicious web content.
Recommendation — Map browser-delivered mining activity to drive-by compromise detections and content review.
OWASP Non-Human Identity Top 10NHI-02 — Secret LeakageCryptojacking campaigns commonly co-occur with script and dependency abuse that can expose secrets.
Recommendation — Review adjacent script and dependency paths for secret exposure after a cryptojacking finding.

Practitioner Guidance

What to watch for: Treat browser CPU spikes, unexplained battery drain, and recurring mining-pool connections as investigation triggers, not just performance noise. The practical control question is whether untrusted script can run at all, which makes allowlisting, content security policy, and dependency hygiene more important than trying to spot every miner variant.

Practitioner takeaway: The strongest defence is to reduce the browser’s ability to execute unknown code, because cryptojacking succeeds when script delivery is easier than script trust.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org