There is a new API in town! HTML5 will (soon) let you make the user’s device vibrate. What fun! Obviously, it’s useful for triggering alerts, improved immersivness during gameplay, and all sorts of other fun things like sending Morse Code messages via vibration.

At the moment, Chrome (and other Android browsers) ask for permission before accessing features such as geo-location, camera, address book etc. This is a security measure to prevent your private information leaving your hands without your knowledge.

At the moment, accessing the HTML5 Vibrate API doesn’t trigger an on-screen warning. Its use is seen as pretty innocuous. Because, realistically, the worst it can do is prematurely drain your battery. Right?

I’m not so sure.

Evil Thoughts

We’ve all seen those scummy adverts designed to look like Windows pop-ups. They usually pose as a legitimate system request – “Update Java” or similar.

Suppose a malicious web page pops up a fake system notification and vibrates at the same time. How confident would you be of telling the difference between a legitimate pop-up and a .png on the web page you’re viewing. After all, the phone buzzed – so it must be genuine.



Are you really receiving an “AirDrop” – or is this page trying to trick you?

Autoplaying sound on adverts in annoying – auto-vibration could be just as irritating. Imagine searching through tabs until you found the single advert which was pulsing away trying to get you to buy new insurance.

For now, the intensity of the vibration cannot be controlled – only the duration. It is not impossible to conceive of malicious code being able to exploit an unpatched browser flaw and overdrive the motor to destruction.

Faking Telephone Calls

When combined with HTML5 Audio, it would be possible to create a fairly realistic “Incoming Call” screen which vibrated and played a ringtone. Once “answered”, the page could play some audio which says “Hi, can you call me back urgently – my number is [premium rate line]” and then, perhaps, automatically open up the dialer using the tel: URI.



Could you tell if the above was a real phone call? If you looked closely, probably, but when the browser is playing your phone’s default ringtone and the handset is vibrating, it would be pretty easy to be confused. Combine it with a WebRTC call and you’re looking at a very convincing scam.

Video Demo

Source Code

Here’s a basic example which you can try on your own phone – demo site.

<body> <script type="text/javascript"> navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate; navigator.vibrate([1000, 500, 1000, 500, 1000, 500, 1000, 500, 1000, 500, 1000, 500, 1000, 500]); </script> <img width="100%" src="phone.png" onclick="window.location.href='tel:09098790815';" /> <audio autoplay="autoplay"> <source src="ring.mp3" /> </audio> </body>

At the moment, the auto-vibrate and auto-ring only work on Firefox for Android. But no doubt other browsers will follow suite soon.

Warnings

Firefox was the only browser I found which supported Vibrate – on Android, neither Samsung’s browser, Chrome, or Opera did – iPhone also doesn’t yet support it. No one cares about Windows Phone or BlackBerry – so I didn’t test them*.

Firefox doesn’t currently ask for permission when a page requests access to vibrate.

Do you think browsers should warn before a page vibrates – or is the risk too low? I guess we’ll have to see if the scammers take advantage of it – and whether there is a user backlash.