The largest-scale attack of its kind on Apple Macs, phones and tablets – and believed the first to maliciously target non-jailbroken iPhones – has been detected. And it's hit thousands and thousands of devices in the wild.

WireLurker infects OS X computers, and lies in wait for USB connections to Apple iPads and iPhones. It then installs malicious software on the iOS devices – software signed with a legit cryptographic certificate, so it's trusted by the gadget.

Victims have been told to warn friends who have plugged their devices into their diseased boxes – WireLurker gets into the Macs if the user runs dodgy programs from an unofficial app store.

Palo Alto Networks Networks researcher Claud Xiao reckons WireLurker "heralds a new era" in Apple malware and was a "new brand of threat."

"WireLurker was used to trojanise (infect) 467 OS X applications on the Maiyadi App Store, a third-party Mac application store in China," Xiao said.

"In the past six months, these 467 infected applications were downloaded over 356,104 times and may have impacted hundreds of thousands of users."

Other strains of Mac malware, which are rare compared to the number targeting Windows, have used WireLurker's tricks before – but never in concert. The LBTM adware threat of 2010 and FindAndCallWorm of 2012 were the only two to have affected non-jailbroken Apple devices.

It applied 2013 research by Mathieu Renard, and work by Billy Lau, with research by Tao Wei in September into mitigations for Apple's rather comprehensive strategy for enterprise provisioning that bypasses Apple's review process.

Armed with this, the malware invoked real-world attacks that worked by infecting a Mac before monitoring for USB-connected iOS devices and then installing apps repacked with infected code.

In a bid to ensure jailbroken phone victims opened apps, WireLurker backed up those already installed on before inserting malicious code into it via the Apple backup service.

The malware was complex, and contained obfuscated code and extensible components. It was regularly updated by command and control protected by custom-made crypto and used this channel to ferry information off about whether a targeted iPhone was jailbroken. Upon infection, it would steal contacts and Apple ID information.

The author, whose intentions were unclear, made an apparent gaffe by embarking on a noisy spree uploading 467 repacked infected Mac apps to the Chinese store. That represented all uploads over a six-week period to 11 June this year.

WireLurker-infected game The Sims 3 was downloaded 42,110 times, close to twice the downloads of International Snooker 2012, which claimed 22,353 victims.

A research paper by Palo Alto Networks is here: WireLurker: A new era in iOS and OS X malware [PDF]. ®