#64782 closed defect (bug) (fixed)
Real-time collaboration awareness state can be mutated by another authorized user
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 7.0 | Priority: | normal |
| Severity: | normal | Version: | trunk |
| Component: | Editor | Keywords: | has-patch has-unit-tests |
| Focuses: | rest-api | Cc: |
Description
During collaborative sessions, awareness state is set by each participating client. Awareness state includes general information such as the user's display name and avatar URL. It also includes presence information such as their current cursor position. This state, once shared with other clients, is used to render indicators that show their presence and activity in the session.
Using the built-in HTTP polling sync server, awareness state is accepted and stored after the user is authorized. This state is keyed against their sync client ID, which is randomly generated.
However, nothing prevents a user from spoofing another client's client ID, which is discoverable by inspecting network responses. By replaying a sync request with a different client ID, they could temporarily overwrite another client's awareness state. I say "temporarily" because the spoofed client will soon send another awareness update that will restore it.
Attachments (1)
Change History (6)
This ticket was mentioned in PR #11120 on WordPress/wordpress-develop by @czarate.
6 weeks ago
#1
#2
@
6 weeks ago
- Owner set to ellatrix
- Resolution set to fixed
- Status changed from new to closed
In 61838:
#3
follow-up:
↓ 4
@
6 weeks ago
- Resolution fixed deleted
- Status changed from closed to reopened
I'm seeing this warning being triggered on WordPress.org thousands of times per 5 minutes:
E_WARNING: Undefined array key “wp_user_id” in wp-includes/collaboration/class-wp-http-polling-sync-server.php:194
It looks like $entry is:
array ( 'client_id' => 1583...., 'state' => array ( ), 'updated_at' => 1772759838, )
or
array (
'client_id' => 6209....,
'state' =>
array (
'collaboratorInfo' =>
array (
'avatar_urls' =>
array (
24 => 'https://secure.gravatar.com/...',
48 => 'https://secure.gravatar.com/...,
96 => 'https://secure.gravatar.com/...',
),
'browserType' => 'Chrome',
'enteredAt' => 1772748369812,
'id' => 227158,
'name' => 'User Name',
'slug' => 'userlogin',
),
),
'updated_at' => 1772759838,
)
Edit: This is likely only due to running the previous version of the code in production. If this can't be reproduced by others, then please re-close this ticket as fixed. Do not add extra workarounds for it.
#4
in reply to:
↑ 3
@
6 weeks ago
- Resolution set to fixed
- Status changed from reopened to closed
Replying to dd32:
I'm seeing this warning being triggered on WordPress.org thousands of times per 5 minutes:
E_WARNING: Undefined array key “wp_user_id” in wp-includes/collaboration/class-wp-http-polling-sync-server.php:194
...
Edit: This is likely only due to running the previous version of the code in production. If this can't be reproduced by others, then please re-close this ticket as fixed. Do not add extra workarounds for it.
It is indeed due to running a previous beta in production.
I was only able to reproduce it wit the following steps:
- Checkout Beta 2
- Start and save a post, leaving the editor open after saving.
- Checkout Beta 3
- Error occurs and frequently. A dialog is shown in the editor that the user is disconnected.
If I closed the editor in step two, and reopened it after upgrading I did not receive any errors. For WordPress.org the errors should settle down once authors return to the post editors they've left open and close them due to the error message.
I'll re-close this as fixed as it doesn't warrant a workaround.
Trac ticket: https://core.trac.wordpress.org/ticket/64782
Using the built-in HTTP polling sync server, awareness state is accepted and stored after the user is authorized. This state is keyed against their sync client ID, which is randomly generated.
However, nothing prevents a user from spoofing another client's client ID, which is discoverable by inspecting network responses. By replaying a sync request with a different client ID, they could temporarily overwrite another client's awareness state.
This change prevents this spoofing by storing and checking the user's WordPress user ID to ensure it matches the initial update.
Backport of https://github.com/WordPress/gutenberg/pull/76056