The vulnerability is a classic Cross-Site Request Forgery (CSRF) in the AVideo platform, specifically in the LoginControl plugin. The endpoint plugin/LoginControl/set.json.php allows changing the Two-Factor Authentication (2FA) setting for a logged-in user. The core of the issue is the absence of any CSRF protection mechanism, such as a token validation (forbidIfIsUntrustedRequest() in AVideo's case), before performing the sensitive action of disabling 2FA.
The analysis of the provided information, including the vulnerable code snippet and the suggested patch, confirms this. The vulnerable file plugin/LoginControl/set.json.php directly calls LoginControl::setUser2FA() based on the user-provided type and value from the POST request, without verifying if the request originated from a trusted source. An attacker can create a malicious webpage with a hidden form that sends a POST request to this endpoint. If a logged-in AVideo user visits this page, their browser will automatically include their session cookie, and the request will be processed, disabling their 2FA without their knowledge or consent.
The vulnerable functions identified are:
plugin/LoginControl/set.json.php: This script is the entry point of the attack. It receives the malicious request and fails to implement CSRF protection.
LoginControl::setUser2FA: This function is the one that actually performs the state-changing operation of disabling the 2FA. It is called by the vulnerable script.
During an exploit, a runtime profiler would show the execution starting from plugin/LoginControl/set.json.php and then a call to LoginControl::setUser2FA. Therefore, both are included as vulnerable functions.