The vulnerability is a Server-Side Template Injection (SSTI) located in the reporting module of the Bagisto admin panel. The analysis of the provided patch commit 3f294b4837595929107d9c1bbd6d5b1222ef9fea reveals that the root cause is the unsafe use of user-controlled input to dynamically determine method calls.
The functions stats, viewStats, and export within the Webkul\Admin\Http\Controllers\Reporting\Controller class all used the type query parameter directly from the HTTP request (request()->query('type')) to look up a method name in the $this->typeFunctions array and then invoke it. There was no validation to ensure that the type parameter corresponded to an expected, safe value.
An attacker could exploit this by crafting a request where the type parameter contains a malicious template payload (e.g., {{7*7}}). When the application processes this input to generate a response, the template engine would execute the payload, leading to arbitrary code execution on the server. The patch rectifies this by introducing a new resolveTypeFunction method that validates the type parameter against a strict allowlist of known, safe function names before it is used, thus preventing the injection of malicious code.