Hackers can target phones that are not using the latest iOS on the app.

Researchers said they wrote software that copies an Apple server.

Matthew D. Green, a computer science professor at Johns Hopkins University, said students worked to guess the 64-digit key that encrypts a photo stored in the iCloud. Each correct digit was accepted by the phone.

"And we kept doing that," Green told The Washington Post, "until we had the key."

Having the key allows hackers to get a photo or video from Apple's server without the user knowing about it.

Green said a modified version could also work on newer operating systems, but it would call for a much bigger group of hackers.

"Apple works hard to make our software more secure with every release," the company said in a statement. "We appreciate the team of researchers that identified this bug and brought it to our attention so we could patch the vulnerability. Security requires constant dedication, and we’re grateful to have a community of developers and researchers who help us stay ahead."

Apple released a complete fix for the bug in its latest release, iOS 9.3, after the company's event on Monday.