More than 10 million users of the popular Cyanogen build of Android are exposed to man-in-the-middle (MitM) attacks thanks to reuse of vulnerable sample code.
The zero day vulnerability makes it possible to target any browser used on the popular Android distribution.
A security researcher who works for a top-tier vendor, but asked Vulture South not to use his name, said Cyanogenmod developers among many others had taken Oracle's sample code for Java 1.5 for parsing certificates to obtain hostnames - which is vulnerable to an older bug - and implemented it.
"I was looking at HTTP component code and I was thinking I had seen this code before," the researcher said.
"They just copy-pasted the sample code and that's what was vulnerable.
"I checked on GitHub and found out a tonne of others were using it."
The researcher responsibly disclosed the flaw to affected providers but had no luck with Cyanogenmod maintainers and so mentioned the zero-day at the Ruxcon security event in Melbourne.
Cyanogenmod developers have been contacted about the flaw.
The researcher found the flaws, previously disclosed in 2012 and earlier this year in Apache HTTP libraries that lacked SSL hostname verification.
The flaw means attackers can use any hostname they wished on SSL certificates and have it accepted by big certificate bodies, opening avenues for MitM attacks.
"If you go and create a SSL certificate for a domain you own, say evil.com and in an element of the certificate signing request such as the 'organisation name' field you put the 'value,cn=*domain name*, it will be accepted as the valid domain name for the certificate," he said.
"Cyanogenmod uses this implementation for its browsers so you can go now and MitM someone's phone."
He said the fix was fairly simple and said the exposure served as an academic exercise in the perils of code reuse.
"If there's a flaw in [reused] code, you end up with all these unique instances of the vulnerability." ®
Sponsored: Ransomware has gone nuclear