Details
Option A: Restrict unserialize() (recommended)
// src/Models/OAuth2.php — checkTokens() and getAccessToken()
$access_token = $this->access_token
? unserialize($this->access_token, ['allowed_classes' => [AccessToken::class]])
: null;
Option B: Use safe serialization
Replace serialize()/unserialize() with json_encode()/json_decode() for storing OAuth2 tokens.
Option C: Authenticate oauth2.php
Remove $skip_permissions = true and require authentication for the OAuth2 callback endpoint, or validate the state parameter against a value stored in the user's session.
Credits
Omar Ramirez