Remote user impersonation and takeover via cache poisoning in Mastodon
Mastodon did not properly validate manually fetched ActivityPub objects, allowing an attacker to inject posts attributed to any remote user, overwrite their profile, and replace their public key. This enabled impersonation and interception of direct messages.
arcanican.is
Published on arcanican.is
The original report (and initial emails sent) submitted can be viewed here.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the server trusted manually fetched ActivityPub objects without verifying HTTP Signatures or otherwise authenticating the source.
Impact
An attacker could impersonate any remote user, inject posts, overwrite profiles, and receive direct messages intended for the victim; the text notes this affected any remote user from the perspective of a vulnerable Mastodon instance.
What the attacker needed
Attacker controls a web server; victim uses a vulnerable Mastodon instance; victim interacts with attacker-supplied URL or sends a…
The fix
Mastodon fixed the issue by properly validating fetched ActivityPub objects, as indicated by the patch release and security advisory.
How it was found
- Create a fake ActivityPub Note or Actor object claiming to belong to a remote user.
- Serve the object from a web server with the correct media type.
- Query the object's URL in Mastodon.
- Observe that the fake post appears under the victim's profile and persists.
- Modify the actor's inbox and sharedInbox endpoints to attacker-controlled addresses.
- Send a direct message to the victim and see it delivered to the attacker's inbox.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Mastodon servers talk to each other using a protocol called ActivityPub. When one server fetches a post or profile from another, it should verify that the data really came from the claimed user. Here, it did not, so an attacker could host fake data on their own site and make Mastodon believe it belonged to someone else.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.