Apple's App Store can be stocked with malware-infected apps by exploiting a bug in iOS, a noted security researcher said Monday.

Charlie Miller, a principal research consultant for Denver-based security consultant Accuvant -- and the only four-time winner at the annual Pwn2Own hacking contest -- used an unknown flaw in Apple's mobile operating system to create an app that "phoned home" to his own server.

Miller built a fake stock ticker app, dubbed "Instastock," as a proof-of-concept, then submitted it to Apple, who approved and placed it in the App Store in September.

Instastock exploited the bug Miller discovered to ping a server at his home and request to download another file. While Miller did not stock his server with such a file -- except briefly for demonstration and testing purposes -- it proved the app could secretly download rogue code. Such "malware" could conceivably issue commands to an iPhone or iPad, stealing contacts and photos, turning on the device's camera or microphone, or sending text messages.

"The bug I found lets programs signed by Apple download more code," said Miller in an interview Monday.

Until now, it was assumed that Apple's code signing protected users from dangerous apps being distributed through the App Store

Apple digitally signs all apps admitted to its e-mart, and iOS refuses to run any code that is not signed. But with iOS 4.3, which debuted last March, Apple made an exception to that rule for Safari, the browser bundled with the operating system, so that it could speed up JavaScript execution.

Essentially, Miller tricked iOS into thinking that his app was Safari, and thus exempt from the code-signing restriction.

"They left out one little thing," said Miller of the end-around he discovered. "A cleverly-written app can pretend it's mobile Safari."

All versions of iOS since 4.3, including the new iOS 5, contain the bug, said Miller.

Miller's find puts iOS -- at least until Apple patches the bug -- in the same boat as Google's Android, which has been plagued by malware-infected apps this year, including some snuck into the official Android Market.

Last year, Jon Oberheide, co-founder and CTO of Duo Security, a developer of two-factor authentication software, built a bogus app that could control Android devices, then added it to Google's download center. Since then, Oberheide has discovered other vulnerabilities that let him force Android phones to download and install malicious software.