Dynamic attribute access via getattr()
Low
- Category
- Dangerous Code Execution
- Content
if filters: for key, value in filters.items(): query = query.filter(getattr(self.__model__, key) == value) if offset: query = query.offset(offset)- Confidence
- 83% confidence
- Finding
- Here getattr(self.__model__, key) uses keys taken from the caller-provided filters dictionary. An attacker who controls filter names can trigger access to unintended model attributes, cause exceptions for invalid names, and in some ORM configurations influence query construction in ways the developer did not intend, making this a mass-assignment/query-surface issue rather than classic SQL injection.
