The vulnerability is a SQL injection in the ormar library, specifically within the min() and max() aggregate functions of the QuerySet class. The root cause is the lack of input validation for the column names passed to these functions. The user-provided column name, which can be a malicious SQL subquery, is passed down to the _query_aggr_function. This function, prior to the patch, did not validate the column name for min and max operations. The unvalidated input is then used in SelectAction.get_text_clause to construct a sqlalchemy.text object, which treats the input as literal SQL, leading to the injection. The patch, committed in a03bae14fe01358d3eaf7e319fcd5db2e4956b16, addresses this by adding a validation step in _query_aggr_function to ensure that the provided column name exists as a field on the model, effectively preventing arbitrary SQL from being executed.