Join our Newsletter — 33% off our NHI Course
Home› Guides› CAPEC-662 Adversary in the Browser (AiTB): How the…
Guide Attack Techniques & Malware

CAPEC-662 Adversary in the Browser (AiTB): How the Attack Pattern Works and How to Defend

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 11 November 2026 15 min read
On this page

An adversary in the browser changes what a user sends and what a user sees after TLS, MFA and the login page have all done their jobs. MITRE CAPEC-662 describes an attacker who uses a trojan, a malicious extension or injected code to sit inside the browser and observe, filter or alter traffic between the user and a web application, while showing the user the transaction they expected. Older names for the same idea are man in the browser, boy in the browser and man in the mobile. This guide explains how the pattern works, how it differs from network and phishing-proxy attacks, and the server-side, endpoint and browser-policy controls that blunt it. It is written for security architects, endpoint and browser administrators, fraud and detection teams, and application owners who run high-value web transactions. For how CAPEC itself is structured, see the MITRE CAPEC Guide.

Key takeaways

  • Encryption and MFA still work, which is the problem. CAPEC-662 notes that the attack succeeds even when SSL/PKI and multifactor authentication are present, because the attacker acts inside the authenticated session, before encryption and after decryption.
  • The trojan comes first. Every variant needs code on the endpoint: a malicious extension, an injected DLL, a modified hosts file or a trojan mobile app. Extension control and endpoint hardening remove most of the attack surface.
  • Defend the transaction, not only the login. Out-of-band confirmation that shows the real amount and payee on a separate device, plus server-side transaction monitoring, is the control that still holds when the browser itself is lying.
  • Browser pivoting needs privilege. MITRE ATT&CK T1185 notes that pivoting through a victim browser typically needs SeDebugPrivilege or high integrity, so standard user rights and injection telemetry are high-value controls.
  • The session is the identity. An AiTB inherits cookies, single sign-on sessions and client certificates, so short session lifetimes, device-bound sessions and fast revocation limit what one compromised browser can reach.

What CAPEC-662 describes

CAPEC-662 is a Standard-level attack pattern in CAPEC 3.9, rated likelihood High and typical severity Very High. It is a child of the meta pattern CAPEC-94 Adversary in the Middle (AiTM), and it can follow CAPEC-185 Malicious Software Download and CAPEC-542 Targeted Malware. The related weaknesses are CWE-300 Channel Accessible by Non-Endpoint and CWE-494 Download of Code Without Integrity Check. CAPEC maps it to MITRE ATT&CK T1185 Browser Session Hijacking.

The CAPEC execution flow has two phases. In the experiment phase the adversary gets a trojan onto the victim system (phishing, drive-by download or a malicious extension posing as a legitimate one) and then inserts itself into the communication channel as a routing proxy between the two components. In the exploit phase it observes, filters or alters data of its choosing. CAPEC lists these prerequisites: a trojan is installed, two components are communicating, the attacker understands the communication mechanism, strong mutual authentication is not used between the components, and for browser pivoting, SeDebugPrivilege and a high-integrity process are available.

The variants CAPEC groups under AiTB

VariantWhere the attacker sitsTypical goalPrimary defensive lever
Man in the browser (web injects, form tampering)Malicious extension, injected module or hooked browser API inside the browser processChange payment amount or payee on submit, then restore the original values on the receipt pageOut-of-band transaction confirmation, extension allowlisting, server-side transaction monitoring
Browser pivotingCode injected into a running browser processReuse the victim's cookies, HTTP sessions and client certificates to reach intranet apps such as SharePoint or webmailStandard user rights, injection detection, short sessions
Boy in the browserTrojan that edits the hosts file or proxy settings, then often deletes itselfReroute traffic to a look-alike site the attacker controlsHosts file and proxy integrity monitoring, phishing-resistant authentication bound to the origin
Man in the mobileTrojan app on the phoneCapture SMS one-time codes to defeat SMS out-of-band authenticationApp-based or hardware confirmation instead of SMS, mobile threat defence

The man in the mobile variant links naturally to the Android Banking Trojans Guide, and regional families such as Grandoreiro and Melcoz, both listed as T1185 procedure examples by MITRE, are covered in the Latin American Banking Trojans Guide.

AiTB is often confused with network interception and reverse-proxy phishing, and the controls differ.

PatternAttacker positionDoes phishing-resistant MFA stop it?Where to read more
CAPEC-662 Adversary in the BrowserInside the user's own browser or deviceNo. The user authenticates genuinely to the real site; the attacker rides the sessionThis guide; planned MITRE ATT&CK T1185 Browser Session Hijacking
CAPEC-94 Adversary in the Middle (network)On the network path (ARP, DNS, rogue access point, relay)Largely yes, where authentication is bound to the origin and channelMITRE ATT&CK T1557 Adversary-in-the-Middle
Reverse-proxy (AiTM) phishingA proxy site between user and real login pageYes. FIDO2 and passkeys bind the credential to the real originAiTM Phishing Guide
Cookie theft and replayInfostealer exfiltrates cookies for use from another machineNo, but device-bound sessions and short lifetimes helpSession Hijacking and Cookie Theft Guide

Passkeys are still right, but they do not close AiTB. Once code runs in the authenticated browser, what remains is keeping code out, detecting it, limiting the session and confirming intent on a channel the browser cannot touch.

Where it shows up

  • Online banking and payments: the classic case. CAPEC's own example describes a malicious plugin that inflates a funds transfer, redirects it to the attacker and then rewrites the confirmation page so the victim sees the original details. OWASP's man-in-the-browser page describes the same submit-and-restore sequence and notes that the server cannot tell the altered form from a genuine one.
  • Corporate intranet and SaaS: browser pivoting lets an attacker browse internal sites as the user. ATT&CK T1185 names SharePoint and webmail as examples, and notes that pivoting may bypass two-factor authentication.
  • Credential and data harvesting: CAPEC cites Agent Tesla, used in 2020 against oil, gas and energy organisations, with form grabbing, keylogging, clipboard capture and screenshots.

Detection

Detection has two halves: the endpoint, where the trojan runs, and the application, where altered transactions arrive. Neither alone is enough.

Endpoint and browser telemetry

MITRE's detection strategy for T1185 (DET0507, analytic AN1398) looks for a process that gains high integrity or special privileges such as SeDebugPrivilege, opens a browser process with write or inject rights, and modifies it with a remote thread or DLL load. The log sources it lists are below.

Source and eventWhat it showsTuning note
Windows Security 4672Special privileges assigned to a new logonCorrelate with a following browser process access, not on its own
Windows Security 4673A privileged service was called (for example SeDebugPrivilege use)Rare on standard user endpoints; high signal there
Windows Security 4624, 4648Logon, and logon with explicit credentialsExplicit-credential logon followed by browser activity to intranet hosts
Sysmon Event ID 10 (ProcessAccess)One process opening another, for example a non-browser process opening chrome.exe or msedge.exeFilter expected access by security and accessibility tools
Sysmon Event ID 8 (CreateRemoteThread)A thread created in another processAny remote thread into a browser from a non-browser image deserves review
Sysmon Event ID 7 (Image loaded)Modules loaded into a process, with hashes and signature dataOff by default and noisy; scope it to browser processes and unsigned modules
Sysmon Event ID 3 and 22Network connections and DNS queries by processEvent ID 3 is off by default; look for browser processes reaching new or rare infrastructure

Add browser-level signals: extension installs and permission changes reported by your browser management console, extensions installed outside the allowlist, developer mode turned on, remote debugging enabled, and changes to the hosts file or system proxy settings. The Browser Forensics Guide covers where these artefacts live after the fact.

Application and fraud signals

  • Behavioural mismatch: a transaction whose amount, payee or timing departs from the user's history, or a new payee added and paid in the same session.
  • Interaction anomalies: form submissions faster than human input, fields changed after the last user interaction, or a page structure on the client that does not match what the server rendered (where you deploy client-side integrity checks).
  • Confirmation mismatch: the user declines an out-of-band confirmation because the amount or payee shown is not what they entered. Treat each decline as a likely compromised endpoint, not as user error.

For payment service providers in the EU and EEA, Article 2 of Commission Delegated Regulation (EU) 2018/389 already requires transaction monitoring that takes account of, among other factors, signs of malware infection in any session of the authentication procedure and known fraud scenarios.

Metrics that show the controls work

  • Percentage of managed browsers enforcing an extension allowlist (blocklist set to all, with named exceptions).
  • Percentage of user endpoints where users hold no local administrator rights.
  • Declined out-of-band confirmations per month, and the proportion traced to a confirmed endpoint infection.
  • Median time from detected browser injection to session revocation across the identity provider and key applications.

Prevention and hardening

Control mapping

CAPEC-662 mitigationHow to apply itFramework anchor
Download software only from legitimate sources, with integrity checksApplication control on endpoints; extension allowlist; block unpacked extensionsNIST SP 800-53 CM-7, CM-11; CSF 2.0 PR.PS-05; ATT&CK M1038
Use anti-malware that detects trojansEDR with injection and credential-theft detections on every endpoint that runs a privileged browserNIST SP 800-53 SI-3, SI-4; CSF 2.0 DE.CM-09
Strong, out-of-band mutual authentication of both endsTransaction confirmation on a separate device that shows amount and payee; signing tied to those valuesNIST SP 800-53 SC-23, IA-11
Limit user permissions to prevent browser pivotingNo standard user local admin; control SeDebugPrivilege; separate admin browsingNIST SP 800-53 AC-6; ATT&CK M1018
Terminate browser sessions regularly and at end of lifeShort session lifetimes for sensitive apps, re-authentication for high-risk actions, user guidance to close sessionsNIST SP 800-53 SC-23, IA-11; ATT&CK M1017

Browser policy settings

Chrome and Edge share the same extension policy names. These are customer-side settings in your management tooling:

  • ExtensionInstallBlocklist set to *: blocks all extensions by default. Blocked extensions already installed are disabled and users cannot re-enable them. In Chrome, all unpacked extensions are blocked under this setting.
  • ExtensionInstallAllowlist: the named exceptions to the blocklist. Review each entry for the hosts and permissions it requests.
  • ExtensionSettings: finer control, including blocked_permissions, runtime_blocked_hosts to stop all extensions touching your banking, payment and admin domains, and installation_mode to block a whole store.
  • ExtensionInstallForcelist: force-installs approved extensions. Note from the Edge documentation that it overrides the blocklist, so treat this list as privileged configuration.
  • RemoteDebuggingAllowed: set to disabled. When unset, users can enable remote debugging through command-line switches, which gives other local code a control channel into the browser.
  • DeveloperToolsAvailability: value 2 blocks DevTools for users who do not need them; value 0 (the default) keeps DevTools away from policy-installed extensions.

For wider baselines see the Browser Extension Security Guide and the Browser Security Hardening Guide.

Application-side controls

  • Dynamic linking of confirmation to content: Article 5 of Regulation (EU) 2018/389 requires that, for remote electronic payments, the payer is made aware of the amount and payee, the authentication code is specific to that amount and payee, and any change to either invalidates the code. Outside the EU this is still the right design: confirmation on a separate device that displays what the server will actually execute.
  • Avoid SMS as the confirmation channel for high-value actions: CAPEC's man in the mobile variant exists specifically to capture SMS codes. Prefer an app-based confirmation or hardware signing that shows the transaction details.
  • Device-bound sessions: Chrome's Device Bound Session Credentials binds a session to a private key held in secure hardware such as a TPM where available, with short-lived cookies refreshed only with proof of possession. It targets cookie export and replay; Google's documentation cautions that malware present at registration may extract the key, and it does not stop malware driving the live browser on the same device.

Where identity fits

An adversary in the browser does not need your password: it borrows the identity already loaded into the browser. That includes SSO session cookies for the identity provider, OAuth tokens held by single-page apps, client certificates, and any API keys or tokens a developer pastes into a web console. A privileged administrator browsing from a general-purpose workstation therefore exposes every system that session can reach. Keep privileged browsing on Privileged Access Workstations with no third-party extensions, keep tokens out of browser storage where you can (see the Browser Storage Security Guide), and make sure your incident runbook revokes sessions at the identity provider and in each downstream app, not just a password reset. The Infostealer Threat Guide covers the overlapping malware families that steal the same material for use elsewhere.

How to implement

  1. Inventory (week 1 to 2): export installed extensions, their permissions and host access from your browser management tooling. Identify users with local admin rights and endpoints without EDR.
  2. Audit mode (weeks 2 to 4): build the allowlist from business-justified extensions. Turn on Sysmon Event IDs 8 and 10 with browser-scoped filters (and Event ID 7 scoped to browser images if volume allows) and baseline what normally touches browser processes.
  3. Pilot ring (weeks 4 to 6): apply ExtensionInstallBlocklist set to *, the allowlist, RemoteDebuggingAllowed disabled and runtime_blocked_hosts for sensitive domains to IT and security staff first, then administrators.
  4. Broad rollout: extend in rings by department. Keep an exception workflow with an owner and review date for each allowlisted extension.
  5. Application controls: add out-of-band confirmation with amount and payee for high-value transactions and admin changes, and feed confirmation declines into fraud and SOC queues.
  6. Respond: on a confirmed injection, isolate the endpoint, revoke sessions at the IdP and key apps, review transactions made during the window and reimage before reissuing credentials. The Malicious Browser Extension Incident Playbook gives the extension-specific steps.
  7. Rollback: if a blocked extension breaks a critical workflow, allowlist it for the affected group with a dated exception rather than removing the global block.

Decision guidance

  • Managed workforce versus customers: for your own staff, extension allowlisting and endpoint controls are the main levers. For customers on unmanaged devices you control nothing on the endpoint, so invest in transaction confirmation, behavioural monitoring and fast response.
  • Small organisations: start with no local admin rights, ExtensionInstallBlocklist set to * with a short allowlist, automatic browser updates and app-based MFA confirmation from your bank. These need no new tooling.
  • Large organisations: add injection analytics in the SIEM, enterprise browser or remote browser isolation for the highest-risk users, and session lifetime policies per application tier.

Common failure patterns

  • Treating passkeys as the end of the problem: phishing-resistant MFA stops proxy phishing, not code already running in the authenticated browser.
  • Confirmation without content: an approve or deny prompt that does not show the amount and payee lets the attacker swap them, because the user approves what the compromised page told them.
  • Open extension stores: no blocklist policy means users can install any extension, including ones that request access to all sites.
  • Password reset as the whole response: resetting a password leaves live sessions, cookies and tokens in place. Revoke sessions everywhere the user was signed in.

Framework mapping

FrameworkReferenceRelevance
MITRE CAPEC 3.9CAPEC-662, parent CAPEC-94, can follow CAPEC-185 and CAPEC-542The attack pattern and its delivery routes
MITRE CWECWE-300, CWE-494Weaknesses CAPEC links to the pattern
MITRE ATT&CK v20T1185, T1176.001, T1055, T1539; mitigations M1018, M1017, M1038Hijacking, extension persistence, injection into the browser and cookie theft
NIST SP 800-53 Rev. 5AC-6, CM-7, CM-11, SC-23, IA-11, SI-3, SI-4Least privilege, software control, session authenticity, re-authentication, malware protection and monitoring
NIST CSF 2.0PR.PS-05, DE.CM-09Preventing unauthorised software and monitoring runtime environments
CIS Controls v8.1Safeguard 9.4Restrict unnecessary or unauthorised browser and email client extensions. See the CIS Control 9 Email and Web Browser Protections Guide

Practitioner checklist

  • Set ExtensionInstallBlocklist to * with a reviewed allowlist on every managed Chrome and Edge browser.
  • Use ExtensionSettings runtime_blocked_hosts to keep extensions off banking, payment, IdP and admin domains.
  • Disable RemoteDebuggingAllowed and restrict DeveloperToolsAvailability for users who do not need it.
  • Remove local administrator rights from standard users and monitor SeDebugPrivilege use.
  • Collect Sysmon Event IDs 8 and 10 for browser processes and alert on non-browser images opening or injecting into them.
  • Require out-of-band confirmation showing amount and payee for high-value transactions, new payees and admin changes.
  • Revoke sessions at the IdP and each downstream app on any confirmed browser compromise, then reimage.

Standards and references

Related NHI Mgmt Group resources: MITRE CAPEC Guide · MITRE ATT&CK T1176 Software Extensions · Session Hijacking and Cookie Theft Guide · Infostealer Logs and Session Token Abuse Guide

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
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 11 November 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org