The vulnerability exists within the MySQLSelectTool class, designed for read-only SQL operations, but susceptible to file-writing attacks. The core of the issue is an inadequate blocklist of prohibited SQL keywords. The validateReadOnly function, which is supposed to ensure read-only access, checks the input query against this list. However, it failed to include dangerous keywords like INTO OUTFILE, which can be appended to a SELECT statement to write data to a file on the server.
The fix, seen in commit ea49f8c4f35bffb56021a2ea2c9b07817fcc31b6, addresses this by expanding the $forbiddenStatements array to include INTO, OUTFILE, DUMPFILE, and LOAD_FILE.
The function Neuron\AI\Tools\Toolkits\MySQL\MySQLSelectTool::validateReadOnly is identified as the primary vulnerable function due to its flawed validation logic. The entry point for an exploit is the Neuron\AI\Tools\Toolkits\MySQL\MySQLSelectTool::__invoke method, as it accepts the user-provided SQL query and triggers the vulnerable validation. Consequently, both of these functions would likely appear in a runtime profile during an exploitation attempt.