Of course, it's illegal. Although it's your school's regulation, there are problems with the way they collect it. You can say that they are robbing. Even if they give it to the school, you should have the right to know whether your finances are in good condition. Besides, the school has no right to seize private property. Even if the school says that it will temporarily keep it for your own good, it should ensure that the property is not damaged by anyone. Therefore, I think the way the school collects it is very excessive and unreasonable and should be stopped or completely changed.