Technically shares represent ownership of a part (often very small) of the company. Depending upon the class of shares you might have a certain number of votes in the running of the company.
As long as you are recorded as owning those shares "fully paid up", they cannot be taken away from you. That would be considered to be theft.
It has nothing to do with any contract. Shares are transacted as if they were physical objects or title deeds to property, etc.
If you didn't actually pay for those shares and you have no share certificates, then things can get murky. As a shareholder, you are entitled to access the share register and verify the entries.
The above is based upon my practical experience, but I'm not a lawyer, nor accountant. As others have suggested if there is significant money involved then you need qualified legal representation.