Via several ways.Trick or Treat Ransomware infects computers by being sent via phishing emails, containing virus attachment.
This attachment is usually masked as an important document, like an invoice, bank document or even a plane ticket and it looks very convincing to users.
After you download and execute this attachment, a drive-by download occurs and your computer is infected with the ransomware virus.
Another way you may become a victim of Trick or Treat is if you download a fake installer, crack or patch from a low reputation website or if you click on a virus link. Many users report getting a ransomware infection by downloading torrents.