Skip to content

Lack of media type verification of Activity Streams objects allows impersonation and takeover of remote accounts

High
syuilo published GHSA-qqrm-9grj-6v32 Feb 17, 2024

Package

Misskey

Affected versions

< 2024.2.0

Patched versions

2024.2.0

Description

Summary

When fetching remote Activity Streams objects, Misskey doesn't check that the response from the remote server has a Content-Type header value of the Activity Streams media type, which allows a threat actor to upload a crafted Activity Streams document to a remote server and make a Misskey instance fetch it, if the remote server accepts arbitrary user uploads.

Details

ApResolverService.prototype.resolve doesn't check that the response from the remote server has a Content-Type header value of the Activity Streams media type (i.e. application/ld+json with a profile value of https://www.w3.org/ns/activitystreams, or application/activity+json). This implies that a Misskey instance can fetch a user-uploaded document on a remote server (including a document on Drive of another Misskey instance) and accept it as an Activity Streams object unless it's otherwise malformed.

The ap/show API endpoint refetches the id of the top-level node of the fetched JSON-LD document when it doesn't match the original request URL, which should have increased complexity of the exploit as the threat actor would need an ability to predict the URI of the uploaded documents before uploading them or to edit the uploaded documents without changing the URI. Misskey itself uses UUIDs in the URIs of uploaded documents, so it should have been hard to impersonate accounts on a Misskey instance via ap/show.

However, that check is not performed by ApNoteService.prototype.createNote, so it can be bypassed by creating an intermediary Note object that references the URL of the uploaded document and make a Misskey instance fetch the intermediary object.

The vulnerability can be exploited in the following ways:

Spoofing the attributedTo property for impersonation

A threat actor can impersonate a remote account by uploading documents with a crafted attributedTo property which equals the Activity Streams actor URI of the victim account.

Creating fake accounts and takeover of remote accounts

An threat actor can create fake (pseudo) accounts by uploading crafted actor objects to a remote server.

The id of the fake actor can be the URI of another legitimate actor on the remote server, if the Misskey instance hasn't fetched that actor before. So the exploit enables a takeover of the inbox of an existing remote account and interception of activities (including private ones) local users send to the remote account.

Impact

The vulnerability allows a threat actor to impersonate and take over an account on a remote server that satisfies all of the following properties:

  1. Allows the threat actor to register an account
  2. Accepts arbitrary user-uploaded documents and places them on the same domain as legitimate Activity Streams actors
  3. Serves user-uploaded document in response to requests with an Accept header value of the Activity Streams media type

The vulnerability may also affect accounts on server implementations that don't normally serve arbitrary user-uploaded documents, in combination with a vulnerability of the other implementation like GHSA-9928-3cp5-93fm which can make the server serve arbitrary document.

Timeline

Date and time Event
2020-07-15T06:02:24Z A same kind of issue was reported to Pleroma: https://git.pleroma.social/pleroma/pleroma/-/issues/1948#note_67278
2023-09 Independently from Pleroma's issue, the reporter (@tesaguri) discovered the same kind of issue in Kitsune, an alpha-stage server implementation, and they reported it to the author of the implementation via GitHub's security advisory feature. At this time, the reporter was only regarding the issue as a phishing vector (creating fake actors on hosting services like GitHub, rather than on ActivityPub servers) and wasn't expecting that it can be exploited for impersonation and takeover of existing actors in practice.
2023-10-28T15:59:49Z A security advisory on the vulnerability in Kitsune was published: GHSA-xmw2-875x-rq88.
2024-02-07+0900 The reporter filed this report with Misskey Project.

The important point is that same kind of issues have been publicly revealed at least twice, and that anyone familiar with implementations like Misskey may have conceived the exploit more easily. It's strongly advised to update existing deployments to the patched version as soon as possible.

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
High
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:N

CVE ID

CVE-2024-25636

Weaknesses

No CWEs

Credits