Apple's iMessage system has a cryptography flaw that allowed researchers to decrypt a photo stored in iCloud, the Washington Post reported on Sunday.

The researchers, led by cryptography expert Matthew D. Green of Johns Hopkins University, wrote software that mimicked an Apple server and then targeted an encrypted photo stored on iCloud when it was sent as a link in a message, the publication reported.

They were able to obtain the decryption key by repeatedly guessing each of its 64 digits. When a correct digit was guessed, the phone let them know if it was correct. Further technical details were not available.

Apple's iMessage application uses end-to-end encryption, which means the company does not store any encryption keys. A vulnerability in iMessage would mean that attackers would have a way to circumvent that security and view private content.

Storing the encryption keys on the devices rather than central servers is considered a good security practice. But researchers have pointed out weaknesses in Apple's system and how it would, in theory, be possible for the company to send copies of iMessages to another party.

The Washington Post story prompted many comments on Twitter after it was apparently mistakenly posted earlier on Sunday but then withdrawn. The story then ran just after midnight Monday U.S. East Coast time.

Apple is quoted as saying the flaw will be patched in iOS 9.3, which is due for release Monday. Apple officials couldn't immediately be reached.

Ian Miers, a computer science doctoral student at Johns Hopkins, wrote on Twitter on Sunday that a blog post, technical paper and more details will be released after Apple issues a patch.

"And now you have 14 hours to guess what the attack is," Miers wrote in another tweet. "As a hint, no, it's not a bug in how Apple stores or encrypts attachments."

The Post reported that the vulnerability will not help the U.S. government unlock the phone of San Bernardino shooter Syed Rizwan Farook.

Apple is in a legal battle with the government over a court order that requires the company to create a special version of iOS that would allow investigators to try to unlock Farook's phone.

Farook's iPhone 5c in question may have a security feature enabled that will destroy a decryption key for its data if the passcode is entered 10 times incorrectly.

The government wants access to six weeks' worth of data stored only on the device and was not backed up to Farook's iCloud account, which Apple turned over to investigators.

Apple fears creating such software will pose risks to millions of customers if it was obtained by other parties.