r/angularjs • u/LiveOverflow • Sep 30 '16
XSS in AngularJS video series (walkthrough) - explaining some AngularJS sandbox bypasses, which resulted in the removal of the sandbox in 1.6
On 8. September the Angular Team announced that the the Angular expression sandbox will be removed with version 1.6.
TL;DR: In this video playlist I try to explain why {{'a'.constructor.prototype.charAt=[].join;$eval('x=alert(1)');}} results in arbitrary javascript execution
Contrary to the best-practices and warnings (do not mix server and client-side templating), in the real world countless of websites extended their old apps with AngularJS. A webapp that escapes output properly to prevent Cross-Site-Scripting (XSS) makes itself vulnerable, by allowing attackers to control {{ }} in an angular app context.
Security researchers noticed this weakness and utilised it to craft expressions that result in arbitrary javascript execution (-> XSS) in many many websites. An arms race started between the angular team trying to build a sandbox to prevent these injections, and hackers that find new creative ways to bypass them. For every version of AngularJS exist public (and private) sandbox bypasses and an excellent blog article describes it in a bit more detail.
I got fascinated with those bypasses and tried to understand how some of them work. And I have created videos explaining the first expression injection in 1.0.8 which started it all, and one of the latest bypasses from version 1.4.7.
All episodes:
Covering some basics: Introducing the AngularJS Javascript Framework - XSS in AngularJS 0x00 (7:50) <-- probably skippable for most of you
The first expression injection that started it all: Sandbox Bypass in Version 1.0.8 - XSS with AngularJS 0x1 (8:00)
Explaining how the sandbox prevents the old bypass: Previous Bypass is now fixed in version 1.4.7 - XSS with AngularJS 0x2 (6:00)
How the 1.4.7 bypass works: New Sandbox Bypass in 1.4.7 - XSS in AngularJS 0x3 (11:40)
The angular team has decided to remove the sandbox entirely, because it has been shown that they can't protect from expression injections. With this decision they take a strong stance towards proper angular app implementations by developers.
I hope you get excited seeing the creativity of those security researchers like I did - I think their work is just marvellous! ❤️
2
u/koto1sa Oct 05 '16
That's the best explanation videos for a security subject I've seen in a long time. Keep up the good work!
4
u/PUSH_AX Sep 30 '16
These are really good videos, I've read about the sandbox escapes before but never fully understood them from the writeups, this made it really clear. Thanks!