Exactly. It is legal until declared as illegal. Although some countries may see it as the other way around (like Germany), most of the world is quite flexible about this. And the beauty of bitcoin is that no one will ever know that you have it unless you make it obvious that you have it.
So practice safety. Don't sign up for an exchange that requires ID verification if that could be a risk for you back home. Keep your bitcoin in a cold wallet where no one will ever know that you have it. Keep your keys somewhere where no one will ever find them. Bitcoin can only exist in your mind if you are quiet about it.
Technically speaking, it is neither a stock nor a bank account. So worst case scenario, you do get caught, you still have a way out. It's beyond borders.