We consider a modified GPT (Gabidulin-Paramonov-Tretiakov) cryptosystem and analyze its security. There are techniques to attack the original GPT and some versions of it. To prevent the attacks we use specially designed countermeasures and careful choice of parameters of the system. We estimated the complexity of structural and decoding attacks, and showed that there are variants of the GPT cryptosystem that can be made secure against known and future attacks.