A hacked iPhone with a Chinese ransom note. Palo Alto Networks

One of the largest hacks of any Apple product has left nearly a quarter million iPhones compromised, according to Palo Alto Networks, a network security company.

More than 250,000 "jailbroken" iPhones — phones that people have modified to install apps not available in the App Store — in at least 18 different countries have had their Apple account logins hacked, Palo Alto Networks reports. Some have even had their iPhones remotely locked and held for ransom.

While most people need not worry about a hack like this, it's a scary reminder that the risks of jailbreaking can far exceed the rewards.

Jailbreaking an iPhone or iPad essentially bypasses Apple's security — which is widely considered superior to competing platforms like Android — in iOS, its mobile operating system.

Why would you want to do this? It's usually to get access to Cydia, the jailbreak version of the App Store that lets you make all kinds of modifications to your system. In the early days, for example, jailbreaking was the only way you could multitask or tether your cellular connection on the iPhone to use it as a hot spot.

Nowadays, there just aren't any exciting reasons to jailbreak because many of these features have come to the iPhone's software. The idea of jailbreaking becomes even less enticing when thousands of people get hacked. And this isn't the first report of hacked jailbroken phones.

Yes, it's technically possible for an iPhone to get hacked even if it's not jailbroken, but it's nowhere near as easy. Successful hacks of non-jailbroken iPhones typically occur when hackers have physical access to the device and can plug it into a computer. Jailbreaking allows malware to be remotely installed on iPhones with a level of ease that's unattainable otherwise.

While government-backed hacks of jailbroken iPhones have happened before, the main purpose of this latest hack "was to make it possible for users of two iOS jailbreak tweaks to download applications from the official App Store and make in-app purchases without actually paying," according to Palo Alto Networks.

You should probably think twice before jailbreaking.