Update: Apple has now released iOS 4.0.2 for the iPhone and iOS 3.2.2 for the iPad, which addresses the exploit of remote jailbreaking.
Original story below
Apple has completed work on a patch for a potentially disastrous security flaw that allows its iOS operating system to be remotely hacked.
Jailbreaking an iPhone or iPad means hacking into the iOS to download apps not approved by Apple. Last month a US judge ruled that jailbreaking was not illegal.
According to a report on USA Today the flaw makes it possible to remotely jailbreak iOS, the operating system for Apple devices such as iPhones, iPads and iPod Touch.
If successful an attacker could get "fairly complete control of affected devices" says security experts.
An Apple spokeswoman confirmed that the patch was complete but was unable to give a release date for its launch.
"We'll do everything we can to make sure this is not an issue for our customers," the spokeswoman said.