HTML5 Security Facts Developers Should Keep in Mind
Application security pros say HTML5 brings with it a new set of security concerns for developers.
The war on the words between Apple and Adobe Systems has prompted plenty of speculation about the fate of HTML5. But while HTML5 remains a work in progress, the one thing that is certain is developers who adopt HTML5 will have a new set of features to consider as part of the application security development life cycle. So how will HTML5 impact the attack surface you have to cover? eWEEK spoke to some security experts and got feedback on a few key areas.Client-side storage
Cross-domain communication While other versions of HTML would only allow JavaScript to make XML HTTP request calls back to the original server, HTML5 has relaxed this restriction so that XML HTTP requests can be made to any server that allows them. This of course poses a security risk if the server is untrusted.
"For example, I could be building a mashup that pulls in sports scores from a third-party site via JSON [JavaScript Object Notation]," Cornell said. "This site could potentially send malicious data back to my application that could run in my users' browsers. As with many aspects of HTML5, this allows for new types of applications to be built, but if developers start using these capabilities without understanding the security implications they may build applications that open their users up to security risks." It's important that developers writing applications that rely on PostMessage() carefully check to ensure that messages originate from their own sites, because otherwise malicious code from other sites could spoof rogue messages, Wysopal added. The functionality itself, however, isn't inherently insecure, and developers have used various DOM (Document Object Model)/browser capabilities to emulate cross-domain messaging for some time now, he said. A related issue is that the World Wide Web Consortium's current draft for cross-origin resource sharing provides a way to circumvent the same-origin policy using a mechanism similar to the cross-domain, Wysopal continued. "Even more confusing, IE [Internet Explorer] implements the feature differently from Firefox, Chrome and Safari," he noted. "Developers need to be sure they understand the dangers of creating an overly permissive access control list, particularly since some of the available documentation on the topic contains reference code that is blatantly insecure."Iframe security There is good news about HTML5 from a security perspective, such as plans to support a sandbox attribute for iframes.
"This attribute will allow a developer to choose how data should be interpreted," Wysopal said. "Unfortunately, this design, like much of HTML, has a pretty high chance of being misunderstood by developers and may easily be disabled for the sake of convenience. If done properly, it could help protect against malicious third-party ads or anywhere else that accepts untrusted content to be redisplayed."








