The vulnerability is a missing authentication and access control issue in the Bagisto installer. The root cause lies in the CanInstall middleware, which failed to properly block access to the installer's API endpoints after the application was successfully installed. Specifically, the middleware only restricted non-AJAX requests, leaving the API (which uses AJAX) exposed. This allowed an unauthenticated attacker to call sensitive functions in the InstallerController. The most critical of these is adminConfigSetup, which could be used to create a new administrator account or, in the vulnerable version, even overwrite the existing administrator's credentials, leading to a full application takeover. The provided patch addresses the issue at its source by fixing the logic in the CanInstall middleware to block all requests to the installer post-installation, and as a defense-in-depth measure, it also changes the database operation in adminConfigSetup from updateOrInsert to insert to prevent overwriting existing users.