Skip to content

Destroying OAuth Applications doesn't notify Streaming of Access Tokens being destroyed

Low
renchap published GHSA-7w3c-p9j8-mq3x Feb 14, 2024

Package

Mastodon

Affected versions

all

Patched versions

4.2.6, 4.1.14, 4.0.14, 3.5.18

Description

Summary

When an OAuth Application is destroyed, the streaming server wasn't being informed that the Access Tokens had also been destroyed, this could have posed security risks to users by allowing an application to continue listening to streaming after the application had been destroyed.

Details

Essentially this comes down to the fact that when Doorkeeper sets up the relationship between Applications and Access Tokens, it uses a dependent: delete_all configuration, which means the after_commit callback setup on AccessTokenExtension didn't actually fire, since delete_all doesn't trigger ActiveRecord callbacks.

To mitigate, we need to add a before_destroy callback to ApplicationExtension which announces to streaming that all the Application's Access Tokens are being "killed".

PoC

This vulnerability was only possible to exploit through a user created application on their own account (that's why I noticed it whilst testing the implementation for client credentials for streaming)

Impact

Impact should be negligible given the application had to be owned by the user.

Severity

Low
3.1
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
High
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
None
Availability
None
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N

CVE ID

CVE-2024-25619

Credits