I am a former worker of Suzhou Oriental Tower Co., Ltd., and I don't even know whether it is legal to detain me for three months' social security.

Enterprises should buy social security for employees according to law, otherwise they will be punished. I don't know why you ask this question. Social security is absolutely beneficial to you personally, especially medical insurance, which can really play a big role when you are really in trouble. So as long as the company doesn't buy less and deduct more, I don't think there is any illegal situation.