Cookie hijacking: how stolen cookies let attackers act as you, and what to do
Cookie hijacking means someone copies the session cookie your browser keeps after you log in, then uses it to act as you without typing a password. Stealer malware on a Mac collects browser data, cookies and session tokens, and with them an attacker can take over your online accounts. If you think it happened, clean the Mac first, then change every password that was stored on it and turn on multi-factor authentication, doing both from another device you trust. Then sign out of every active session and revoke developer tokens.
You log in once, and the site hands your browser a small piece of data that says "this is still the same person". That data is the session cookie. Whoever holds a copy is treated as you, which is the idea behind cookie hijacking.
01What cookie hijacking means
A session is the stretch of time a site agrees you are logged in. Stolen tokens and cookies can be used to impersonate the victim and reach everything the victim could reach.
That matters because multi-factor authentication (MFA, a second proof at login such as a code on your phone) protects the login moment, and a copied session skips that moment. As MFA became more common, real attacks involving cookie and token theft and replay appeared.
The damage does not stay on the Mac. Stolen credentials and session material can let attackers take over online accounts and reach cloud and enterprise resources, and they can act without persistence on the original machine. So deleting the malware does not by itself end a stolen session. The idea in general terms is on session hijacking.
02How a stealer gets onto a Mac
What a stealer is lives on infostealers. The Mac campaigns of late 2025 and 2026 arrive through ClickFix prompts and malicious DMG downloads. ClickFix is a trick where a web page tells you to paste a command into Terminal "to fix" something. A DMG is a disk image used to install Mac software.
These campaigns need you to start them. DigitStealer, MacSync and AMOS all rely on pushing users to mount unsigned DMGs or paste Terminal commands. One AMOS infection began with a Google search for "clear disk space on macOS" that led to poisoned ChatGPT and Grok conversations ending in a Terminal command. A fake job interview can also lead a developer to run a repository that pulls in a backdoor searching the filesystem for secrets; that case has its own page, fake job interview malware.
03What stealers take from the browser
The browser is the main target, but not the only one. The table shows what is listed for three families.
| Stealer | Browser data it targets | Other things it takes |
|---|---|---|
| AMOS | Credentials and sessions from Chrome, Edge, Safari and Firefox | Keychains, Apple Notes, documents |
| MacSync | Chrome and Firefox stores | Keychains, SSH keys, AWS credentials, Kubernetes config, shell history |
| Banshee | Browser credentials and wallet extensions | An authenticator extension |
Keychain is the macOS store for saved passwords. SSH keys and cloud credentials are what developers use to reach servers. A stealer that reads the browser usually goes for those too, so a session theft can be one part of a larger loss. Early versions of AMOS already took autofill data, passwords, cookies, wallets and cards from several browsers. If you work with code, leaked API keys have their own steps. The families are described one by one on infostealers on Mac and Atomic Stealer.
Stealers are not hand-made one-offs. Atomic Stealer, also called AMOS, was discovered in April 2023 and is sold as malware as a service, which means its authors rent it to other criminals on forums and Telegram.
04How the cookies leave the Mac
In one AMOS case the stolen data was staged in a temporary folder under /tmp, compressed with the built-in ditto tool into a zip file, and sent out with HTTP POST requests. The data it collects includes Keychain files and browser session data, including Safari's cookie file.
05How to tell if your session was taken
You can rarely see it from the Mac itself. A stolen session lets attackers act without persistence on the original machine, so there may be nothing left to find. These are the signs that exist:
- A password prompt that did not belong. During one AMOS infection the Mac asked for the account password before the infection went on. Cthulhu showed a fake update dialog that asked for the system password, then a MetaMask password.
- Persistence on the Mac. Look for login items, LaunchAgents and LaunchDaemons you do not recognize. AMOS keeps its files in hidden dot-folders such as .com.apple.accountsd in Application Support.
- A Terminal command you pasted from a web page. If you remember one, treat it as the likely cause. AMOS went from first user interaction to persistent command and control within minutes.
Most of this checking is about the Mac and not about the browser, because the stolen copy is gone and only the program that took it can still be found. Checking the Mac step by step is on how to check for an infostealer.
06What to do after cookie hijacking
Do these in order, and do the password and token steps from another device you trust, not from the Mac that may be infected.
- Clean the Mac. Remove login items, LaunchAgents and LaunchDaemons you do not recognize, and if any sign of a backdoor remains, consider a full clean reinstall of macOS. How to check for an infostealer walks through it.
- Change the passwords that were stored on the Mac and turn on MFA for your important accounts. Use the other device. If you have none, finish step 1 first.
- Sign out of all active sessions in each important account, from the clean device, because a changed password does not by itself end a copied session. On GitHub, click your profile picture, then Settings; in the "Access" section of the sidebar click Sessions, and under "Web sessions" click Revoke session on every one you do not recognize. For Google, Apple, your email and other services, open the account's security settings and look for the list of devices or sessions; the exact clicks differ by service, so use the service's own help page.
- Revoke developer tokens. If you installed npm packages recently, first check for the background program described on GitHub account hacked: it fires when a token is revoked. On GitHub you delete personal access tokens under Settings, Developer settings, Personal access tokens; the one-step "revoke all credentials" option for a compromised account is only available for some enterprise accounts. A revoked token cannot be restored, so you create a new one. Before you revoke anything, read the first step on GitHub account hacked: on some infected Macs a background process reacts to a revoked token by deleting files.
- Check wallets. If you hold crypto on that Mac, go to crypto wallet drained. Banshee and early AMOS both target wallets.
For accounts that an organization manages, a token protection policy in Microsoft Entra gives cryptographic protection against replay of stolen tokens. That is an administrator setting, so ask whoever runs your work accounts.
07How to lower the odds
- Do not run commands copied from websites, emails or messages unless you trust the source and understand what they do. That includes curl-to-bash combinations.
- Treat Script Editor prompts as high-risk.
- Avoid unsigned DMGs and unofficial "terminal fix" utilities.
- On macOS Tahoe 26.4, Terminal can show "Possible malware, Paste blocked" for some pasted commands. It helps only if you do not click "Paste Anyway" too quickly.
- Prefer short-lived credentials and vaults over long-lived tokens in environment files.
The first line of defense against token theft is protecting the device itself with endpoint protection, device management, phishing-resistant MFA and antimalware.
08Cookie hijacking: what to remember
A copied session looks like you, and the cookies leave your Mac when a stealer runs, which happens because you started it. Clean the Mac, change passwords and add MFA from a clean device, sign out of all sessions, then revoke developer tokens.
Cookies leave the Mac only after a stealer starts; Artificial Immunity's free, open-source core watches program starts and reports what it finds.
FAQ
How to stop cookie hijacking?
Stop the program that steals the cookies. These stealers rely on you starting them, usually through a fake installer or a pasted Terminal command, so do not run commands copied from websites, emails or messages unless you trust the source and understand them.
What does cookie theft mean?
Malware copies the browser's session data and cookies, and an attacker uses them to impersonate you and reach what you could reach.
How can I tell if someone is hijacking my browser?
Often you cannot tell from the Mac, because a stolen session lets attackers act without persistence on the original machine. What you can check is the Mac itself: login items, LaunchAgents and LaunchDaemons you do not recognize.
How to prevent session cookies from being stolen?
Keep the malware off the Mac: avoid unsigned DMGs and unofficial fix-it utilities, and never run copy-pasted commands from random pages or forums. Protecting the device itself comes first.
How does a session token get stolen?
Mostly by malware that reads the browser's stores on your Mac. AMOS, for example, harvested browser credentials and sessions from Chrome, Edge, Safari and Firefox, and sends them out with an HTTP POST.
Are session cookies safe?
Yes, until malware copies them. Since MFA became common, attackers have stolen and replayed cookies and tokens, because a stolen cookie can be used to impersonate you.
What is a cookie stealer?
A cookie stealer is malware that collects browser cookies and sessions, usually together with saved passwords and wallets. AMOS is one example, sold as a service.
Related guides
Sources
- Microsoft Defender Experts, hunting infostealers on macOS
- Microsoft Entra, token theft
- Malwarebytes, poisoned AI chats and AMOS
- Malwarebytes, Terminal paste warning in macOS 26.4
- Jamf Threat Labs, ClickFix and Script Editor
- Unit 42, macOS stealers
- Unit 42, AMOS activity
- Check Point, Banshee stealer
- Cyble via SecurityAffairs, Atomic macOS Stealer
- GitHub docs, token expiration and revocation
- Artificial Immunity
- Cursor security notice, rotate from a trusted system
- GitHub docs, managing personal access tokens
- GitHub docs, revoking your credentials