A computer security researcher released code Thursday that could be used to attack some versions of Google's Android phones over the Internet.

The attack targets the browser in older, Android 2.1-and-earlier versions of the phones. It was disclosed Thursday at the HouSecCon conference in Houston by M.J. Keith, a security researcher with Alert Logic. Keith says he has written code that allows him to run a simple command line shell in Android when the victim visits a Web site that contains his attack code.

The bug used in Keith's attack lies in the WebKit browser engine used by Android.

Google said it knows about the vulnerability. "We're aware of an issue in WebKit that could potentially impact only old versions of the Android browser," Google spokesman Jay Nancarrow confirmed in an e-mail. "The issue does not affect Android 2.2 or later versions."

Version 2.2 runs on 36.2% of Android phones, Google says. Older phones such as the G1 and HTC Droid Eris, which may not get the updated software, could be at risk from this attack. Android 2.2 is found on phones such as the Droid and the HTC EVO 4.

Because Android walls off different components of the operating system from each other, Keith's browser exploit does not give him full, root access to a hacked phone. But he can access anything that the browser can read.

That means that Keith's attack probably couldn't be used to read or send SMS messages or make calls, but it could snatch photographs from the phone or snoop on someone's browsing history. "You have full control of the SD [Secure Digital memory] card, so anything on the SD card is fair game," he said in an interview. "If they use their browser to access anything, you'd be able to get ahold of that stuff."

WebKit is open-source software that's used by the Safari and Chrome browsers, and many other products. The WebKit flaw that Keith exploits had already been publicly disclosed, but Keith has now leveraged it to attack Android.

Keith has submitted the attack to the Exploit Database Web site.

It's well understood by security professionals that there are many such unpatched bugs in mobile-phone components, but only lately have smartphones started to attract the kind of serious scrutiny that's already been focused on Windows operating systems and programs. That means that more of these issues are becoming a matter of public knowledge.

In 2008, security researcher Charlie Miller won a $10,000 hacking contest, exploiting a bug in the PCRE (Perl Compatible Regular Expressions) library that ships with WebKit on the Mac. A few months later Miller demonstrated an Android attack that also leveraged the very same flaw. It had been patched in WebKit by that time, but not in Android's operating system, Miller said in an e-mail interview.

Last week, Coverity did a security audit of the source code of Android's Linux operating system kernel and found a lot of potential problems. In total, the analysis turned up 359 potential defects. About a quarter of them were high-risk defects that could lead to attacks similar to Keith's.

Keith's attack illustrates a bigger problem with Android's diverse ecosystem of phone makers and service providers. If the iPhone or BlackBerry needs a security fix, Apple or Research in Motion can push it out directly to their users. Not so with Android. Software updates for Google's smartphones come from device makers or network operators. And not all of them are planning to update their phones to the latest 2.2 release.

"Right now the problem with Android is that people don't patch immediately,' said Robert Graham, CEO of Errata Security.

He expects to see more WebKit-type attacks in the future.

Robert McMillan covers computer security and general technology breaking news for The IDG News Service. Follow Robert on Twitter at @bobmcmillan. Robert's e-mail address is robert_mcmillan@idg.com