Without steps to reproduce issue report is not complete.
Nilay KhatriTitle changed from Security: If you have export permissions in any module, you can export all users to CSV as a regular user. to Security: If you have export permissions in any module, you can export Any data from any module
Title changed from Security: If you have export permissions in any module, you can export all users to CSV as a regular user. to Security: If you have export permissions in any module, you can export Any data from any module
Change the hidden input source_module value to Users, like below:
Click on export
The fact this happens is because in ExportData function the parameter used to decide the module from which data has to be exported is source_module and there is no check for permissions on that.
In the checkpermission function, we check for the "module" parameter, but the module from which data has to be exported is "source_module".
Note: it is not just Users, you can change the source_module to any other module even if the current user does not have permissions for that module. And it will export data for that module.