Suspending, shadow-banning and cleaning up spam accounts

A spam or compromised Matrix account needs a fast, contained response: stop access, remove its visible footprint and stop re-registration. This page plans how to choose between suspension and shadow-banning and what the cleanup involves.

On this page

Cleaning up spam accounts on a Matrix server: what the work covers

When a spam or compromised account is active on your homeserver, the work is to stop its access first, then deal with what it has already sent and stored, and finally close the door on a new account taking its place. Access comes first: you need to lock the account, end its sessions and devices, and decide whether it is suspended outright or quietly restricted so the operator can watch its behavior. The exact admin endpoints and their effects depend on whether your deployment authenticates through Synapse's own password and SSO settings or through Matrix Authentication Service, so confirm the behavior of each call against the versions you run before relying on it in an incident. Element Server Suite deployments add their own admin tooling on top, which also needs checking.

The second part covers events and media. Redacting a user's events removes message content from rooms, but it does not automatically cover every event type, every room the account joined, or files already uploaded to your media store. Media removal is a separate step, and you should confirm which media admin calls exist in your Synapse version and whether they cover remote copies. Plan for the case where the account has posted into rooms on other servers, because your server can only clean up what it holds and controls. Keep a record of what you removed, since rooms and auditors will ask.

The last part is preventing re-registration. Disabling one account does nothing if registration is open or if an identity provider will create a fresh user for the same person. Check the registration settings, the identity provider rules, and any allow or deny lists that your version supports before you close the incident. Most teams need this response when an account is flooding rooms, sending phishing links, or showing signs of credential theft. Confirm the steps, the order and the rollback limits with your own test environment first, because removing data on a live server cannot be undone.

Suspension, shadow-ban or full cleanup: choosing the response

A confirmed spam account sends unsolicited invitations, direct messages or room joins, and the goal is to stop further activity while keeping the evidence you need. Start by capturing the reported events, the account's room memberships and its registration details, because later clean-up can remove the material you would need to explain the decision. Do not assume Synapse or MAS has a built-in shadow-ban switch. Confirm in the documentation for your exact version whether one exists, and treat any workaround as custom work that your team must test and maintain.

  • Capture evidence first: export the reported events and account details before changing anything.
  • Deactivate the account: use the Synapse Admin API deactivation call so the account can no longer log in, and decide separately whether to erase its profile data.
  • Redact the spam events: remove the spam content from affected rooms with the redaction endpoint, then check those rooms for further messages.
  • Block re-registration: close open registration or enforce identity provider rules so the same identifier cannot return.

Avoid deleting the account record before evidence is captured, and avoid public announcements that name the account. Confirm the outcome by testing that login is refused and that the redactions appear in the affected rooms.

Which account action fits each case

This table compares the account actions available for a spam or compromised Matrix account, showing what each changes, what it leaves in place, and whether it can be undone. Read each row against the situation in front of you, since most incidents need two or three actions in sequence rather than a single one. Exact Admin API calls and parameters are covered in the sibling topics and must be confirmed against the Synapse version you run.

ActionWhat it changes and what it leavesReversibleWhen it fits
Deactivate or suspend accountBlocks login and, in Synapse, can remove the user's devices and access tokens. Room membership, sent events and media usually remain unless removed separately.Usually yes, if the account is reactivated, though the password may need resettingConfirmed takeover or a spam account you want locked out now while you review its history
Password resetReplaces the login credential. Existing sessions may stay active until they are revoked.Yes, with a new passwordA compromised account whose owner still needs access after recovery
Session and device revocationEnds active logins and access tokens. The account remains and can sign in again with valid credentials.Yes, the user can sign in againSuspected token theft, or a stale device still connected after a password change
Event redactionRemoves message content from the timeline. Redacted events remain as stubs so room history stays intact.No, content cannot be restoredSpam messages or abusive content posted by the account in rooms
Media removalDeletes uploaded files and images stored on your server. Copies already fetched by other servers or clients may remain.No, once deleted from your storeSpam images, malware files, or abusive media hosted locally
Registration blockStops new accounts from being created with the same pattern or from the same registration path. Existing accounts are untouched.Yes, by changing the setting backOngoing waves of spam sign-ups from one source or through open registration
Shadow-ban or moderation bot actionHides the account's messages from others on your side without informing it, depending on the tooling you use. Support in your deployed version must be confirmed.Yes, by removing the restrictionLow-confidence cases where you want to observe behavior before a hard action

How to run a spam or compromised account cleanup

This sequence takes a spam or compromised account from detection to a verified state: evidence kept, access cut off, content and media removed, and the account name blocked from returning. It produces an incident record that shows each step was completed and checked.

  1. Preserve evidence before changing the account

    Before anything is locked, the admin on call records the account's user ID, creation and last-seen details, device list, recent room activity and any linked reports, and exports the relevant events. For a compromised account, also capture the session and IP history your logs hold. Store the export in access-restricted storage, since it contains personal data. Ask your legal or compliance contact how long it must be kept. Done when the case record lists what was captured and by whom, and the export opens without errors.

  2. Decide suspension or shadow-ban for each case

    Choose the action based on what the account is doing and whether its owner still controls it. Suspension blocks sign-in and is the enforceable option for a spam account or a compromised one. A shadow-ban hides the account's activity from others while it remains active, which only suits accounts you want to observe. Check whether your Synapse version exposes a shadow-ban flag in its admin API before planning around it. Compromised accounts should be suspended, since the attacker can otherwise keep acting. Done when the case record states the chosen action and the reason for it.

  3. Lock the account and end its sessions

    The steps depend on where authentication lives. If MAS handles authentication, deactivate or lock the user and end their sessions through MAS, then confirm in the MAS documentation for your version that ending sessions there also invalidates the tokens clients hold. If Synapse handles authentication, deactivate the account through the Synapse Admin API and confirm that password login is disabled. Done when a sign-in attempt with the old credentials fails from a client outside your admin session and the account's device list is empty.

  4. Redact events and remove media

    Redact the account's events in the rooms listed in your export, using the redaction tools your Synapse version provides. Then remove media the account uploaded, using the media admin API for your version. Work from the room list so you know exactly which rooms were touched. Redaction removes event content but leaves event stubs and membership history, so confirm that behavior in your version's notes before telling anyone the content is gone. Done when a sample of rooms from the list shows the content removed and the account's media no longer loads.

  5. Block re-registration of the account

    Stop the same identity from returning under a new account. In Synapse, confirm that open registration is off in your configuration. With MAS, control registration in the MAS configuration and in the upstream identity provider, and disable the user there too, otherwise a fresh sign-in may create a new account. For a username pattern used by a spam campaign, check whether your server supports username blocking and confirm the option in the configuration manual. Done when an attempt to register the blocked name fails from a test client.

  6. Verify each step in a test room

    Use a non-production room and a test account that was already a member. Have the suspended account post into the room before the action, then check from the test account after the cleanup. Confirm that the suspended account cannot send messages, sign in or join rooms, that its redacted events show no content, that its media returns errors, and that registration of the blocked name fails. Done when a written checklist records a pass or fail for every step, and any failure reopens the step it belongs to.

  7. Close the case and monitor for returns

    Record the final state in the incident record: action taken, rooms touched, media removed, registration blocks added and who approved each step. Keep the evidence export for the retention period your compliance contact confirmed. Watch the account's user ID and the sign-in method in your logs for a period your team agrees in advance, since the same actor may try again under a new name. Done when the record is signed off and a named owner is responsible for the monitoring.

How the response steps connect across Synapse and MAS

The response starts with a report or alert and first confirms whether the account is spam or compromised. From there the path splits: a suspension stops the account from signing in, while a full cleanup also redacts events, removes media and blocks re-registration. On a deployment with Matrix Authentication Service, sessions and sign-in sit in MAS, while events, media and room state sit in Synapse, so each hand-off needs its own check. Verify each control separately, then record what was done.

Response steps for a spam or compromised account, with the controlling service marked.

Risks in a compromised-account response

A spam or compromised account response touches more than one record. Each risk below is a point where a fast, well-meant action can destroy evidence, leave access open or spread content further than intended. Put one control in front of each risk before the first account is actioned.

Evidence lost to premature redaction

Redacting every event from an account removes the messages that show what the account posted and where. Before redaction, export or preserve the reported events, the room context around them and the account's membership history. Confirm who in your organization decides when redaction is allowed, and record the decision with a ticket reference. Redaction is hard to reverse, so the export has to be complete first.

Compromised account keeps device access

Suspending the account does not by itself end sessions that were already signed in on phones, desktops or bridges. Check the account's device list and end every session, including any device the attacker may have added. Rotate the password or upstream identity login, and confirm that the upstream identity provider no longer issues tokens for that user. Otherwise the attacker can keep reading and posting from an existing session.

Media left reachable after suspension

Images and files uploaded by a spam or compromised account stay on the server after its events are hidden. Media is served by its own URL, so a suspended account's uploads can still be reachable by anyone who holds the link. Identify the account's media through the admin tooling for your Synapse version, quarantine or delete it, and then test a few known media URLs from a logged-out browser to confirm they no longer load.

Federated copies that cannot be recalled

Events sent to remote servers before the response are copies those servers keep. A redaction on your homeserver does not guarantee that remote servers remove their copies, and a shadow-ban does not reach users on other homeservers. Before you act, list the remote servers that share rooms with the account. Tell the reader that redaction is a request to other servers, and plan rooms, bans or federation blocks with that limit in mind.

Admin credentials used during response

Responding to an incident often means using a shared admin token or a privileged account, and those credentials are then written into scripts, shell history and chat threads. Use named admin accounts, keep the admin API off the public network, and record which admin ran each action. Rotate any credential that was pasted into a shared channel during the incident. Confirm that admin access is removed when the response closes.

Questions teams ask before cleaning up spam accounts

How much effort does a spam account cleanup take?

Effort depends on how many accounts are involved, how many rooms they joined, how much media they uploaded, and whether they reached other servers. A single account in a few rooms is a short task. A campaign that registered dozens of accounts and posted into public rooms takes longer, because each account needs its events reviewed, redacted, and its media removed. The main drivers are the number of accounts, the number of rooms and events per account, whether federated servers received the content, and how much evidence you must keep. Ask any partner to size the work from a list of affected accounts and rooms, not from a generic estimate.

Can our own team clean up spam accounts in-house?

Yes, if your team has administrator access to the homeserver and someone comfortable with the Synapse Admin API. The tasks are straightforward individually: deactivating or suspending accounts, redacting events, deleting media, and blocking re-registration. The risk is in sequencing and in scope. Redacting the wrong events, missing media in a room history, or deactivating an account before you have captured evidence can all cause problems. A small team with a clear runbook can handle isolated cases. A coordinated campaign, or a compromised admin account, is a better fit for an experienced partner with a written scope.

What does the cleanup need from our team?

Expect to provide four things before work starts:

  • Administrator access to the Synapse Admin API, or to the MAS admin tools if MAS handles authentication
  • Access to server logs and the database, with retention long enough to trace when the account registered and what it posted
  • A written policy that defines what counts as spam, when a suspension is used instead of a shadow-ban, and who approves redaction
  • A named contact who can confirm which accounts are legitimate and which rooms matter to the business

Without the policy and the approver, decisions stall in the middle of the work.

Does redacting an event remove it from other servers?

Redaction is a request that other servers honor, not a guaranteed deletion everywhere. When your homeserver redacts an event, the redaction is sent through federation, and servers that process it will hide the content. A server that is offline, misconfigured, or not running a compatible implementation may keep the original. Your own server also keeps some records for auditing. Confirm with your federation partners how they handle redactions, and treat redaction as a removal from the normal view rather than as proof that no copy exists. Your retention and erasure policy should say this plainly.

How does blocking re-registration work?

Blocking re-registration stops a spam operator from creating the same kind of account again. On a self-hosted Synapse, the practical controls are to disable open registration, require approval or single sign-on for new accounts, and apply rate limits to registration and sign-in. Where authentication runs through the Matrix Authentication Service, the upstream identity provider controls who can sign in, so the block belongs there as well. Identify the pattern first: a shared email domain, a shared IP range, or a common username format. Test each control against a new account before you rely on it. Confirm the exact setting names in the Synapse configuration manual for your version.

When should we bring in outside help?

Bring in outside help when the case involves a compromised administrator account, a coordinated campaign across many rooms or servers, evidence that may be needed for a legal or regulatory process, or a server that federates widely with no one available to review decisions. Outside help is also useful when you need a documented runbook and a repeatable process. DeployOpen plans and performs these cleanups inside your infrastructure, with the scope agreed in writing before work starts. Ask any provider to confirm what evidence they keep and who approves each action.

What determines the cost of a spam cleanup?

The cost is driven by labor and scope. You pay for review time to decide which accounts and events are spam, for the technical work to suspend, redact, and remove media, and for the controls that block re-registration. Costs rise with the number of accounts, rooms, and federated servers involved, and with any requirement to preserve evidence. Most of the work is one-time, but policy and blocking rules need ongoing review as spam patterns change. When requesting a quote, ask for the cost split between investigation, cleanup, and prevention, and for what is included in a follow-up review.

Limits to confirm in your environment

Suspension, shadow-banning and cleanup depend on which Synapse and MAS versions you run, how federated servers treat your actions, and where media and evidence live. Confirm each limit below with the vendor or with your own test before you write a runbook.

Synapse and MAS versions and endpoints

Admin endpoints change between releases, and some stop working once Matrix Authentication Service takes over account administration. Record the exact Synapse release in use, such as the version reported on the Synapse releases page, and the MAS version. Then confirm which admin endpoints your release exposes for deactivation, redaction and media deletion, and test each one on a staging server. Check the upgrade notes for every release between your current version and the target before you depend on a call.

Synapse upgrade notes

Redaction behavior on federated servers

Redacting events on your homeserver does not guarantee that remote servers remove their copies. Ask the vendor how redactions propagate, then test with a room that includes a remote server you do not control. Record which remote servers honor redactions and which keep cached content, since that determines what you can truthfully tell a complainant or an auditor.

Media storage and purge paths

Spam and compromised accounts often upload files, and those files may sit in local storage, a remote media cache or an object store. Confirm where your deployment keeps media, which admin calls remove local media for a given user, and whether cached copies of remote media are purged with them. Test deletion on a sample account and verify the files are gone from disk or bucket, not just from the API response.

Registration open or gated by SSO

Whether anyone can create an account changes how much re-registration prevention matters. If registration is open, a deactivated spammer can return under a new name unless you add controls. If accounts come only through an identity provider, confirm whether disabling the upstream user blocks login to Synapse and MAS, and whether existing sessions end at the same time. Record the setting and test both paths.

MAS upstream identity providers

Retention rules for abuse evidence

Redacting content can destroy the evidence your legal, trust and safety, or compliance teams need. Before you wipe anything, decide with counsel how long to keep reports, original event content and account metadata, and where. Confirm which retention settings in your Synapse configuration remove events automatically, and whether a redaction clears the original body from the database. Write down the answer, because it governs what you can delete.

Federation allowlists and listener exposure

Federation settings decide how far a spam account can reach. Check whether your server federates openly, uses a domain allowlist, or runs with federation disabled, and whether the federation listener is firewalled as the configuration manual recommends. A suspension on your side does not stop a remote server from relaying content it already holds, so confirm what your federation settings actually block.

Synapse configuration manual

What a managed cleanup review looks like

A managed cleanup review is a fixed-scope piece of work in which DeployOpen works inside your Matrix deployment to scope the affected accounts, review the admin tooling and access used to act on them, agree the response steps in writing, and then test those controls. The point is that every action taken during a spam or compromise incident is traceable to a decision your own team approved, and that the tools used to take those actions behave as expected. DeployOpen does not promise a particular outcome or timeline, because both depend on how many accounts are involved and what your environment looks like.

The scoping step starts with the account set. DeployOpen works with your team to identify which accounts are suspected spam, which are possibly compromised, and which are legitimate users who happen to share a pattern, such as a common registration source or a burst of joins to public rooms. The review then checks which admin paths your team would use: the Synapse Admin API endpoints for deactivation, event redaction and media removal, and, if MAS is in place, the MAS Admin API and CLI, since account administration moves there and some Synapse endpoints stop working. Your team should confirm which of these exist in the exact versions you run before any runbook is written, using the upstream documentation for that release.

The access review covers who holds admin tokens, which accounts are server admins, where admin credentials are stored, and whether registration and rate limit settings could let a cleaned-up account return. DeployOpen then drafts the response steps as a written runbook, with each step, its owner, its approval point and its rollback limit noted. Where a step is irreversible, such as redaction or media deletion, the runbook says so. The runbook is reviewed by your security and operations leads before any live action.

How DeployOpen works on this

DeployOpen scopes spam and compromised account response as written work on your own Matrix server, inside your infrastructure. We set the suspension, shadow-ban, redaction and media cleanup rules first, then test them on your homeserver and hand the runbook to your team.

How we scope

  • Written scope lists which Synapse or MAS admin actions your team will use and which ones stay manual
  • Scope names the identity provider, deactivation source and who approves suspensions
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts
  • Quote follows from the written scope, covering one-time setup and any recurring support

How we build

  • We configure suspension, deactivation and re-registration controls on your Synapse or MAS instance
  • We build scripted or documented steps for redacting a user's events and removing their media
  • We test each procedure against a non-production copy of your server before it goes live
  • Test cases cover a suspended account, a shadow-banned account and a compromised account

How we hand over

  • Runbook covers each action, its admin API call, its effect on rooms and its reversibility
  • We document which steps need a second reviewer and where the audit trail is kept
  • Your administrators receive a walkthrough and the scripts run from your own server host
  • Documentation is written for your operators, so changes can be made without us

How we support

  • Ongoing support and upgrades can run as a retainer after handover
  • Retainers can include retesting moderation procedures after Synapse or MAS upgrades
  • Continuous testing of your homeserver setup is available as a separate retainer
  • Changes to the agreed scope are documented in writing before they are performed

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.