Sandbox bypass for the latest AngularJS version 1.5.8 - XSS with AngularJS 0x4
Skills:
Reading ML Papers90%
Key Takeaways
The video demonstrates a sandbox bypass for AngularJS version 1.5.8, exploiting an incomplete fix for a previously discovered vulnerability, allowing for XSS attacks.
Full Transcript
angularjs fixed descent box bypass from version 1.4 7 but very quickly a new bypass was found the old bypass which overrode the char ed prototype function to screw with angularjs internals got fixed but the fix was incomplete very quickly a new bypass was found that was initially kept private eventually somebody else discovered the bypass 2 and reported it publicly on github so let's try to find the bypass for the incomplete fix ourselves let's start by testing the old bypass no alert and when we look into the console we can see the error assigned to a constructor is disallowed what does that mean let's have a look at what ensure safe assign context is doing so this is a function that takes an object as a parameter and performs a couple of checks on it it basically checks if the object passed to it is some kind of constructor as we have seen with the first bypass constructors are dangerous in that video we use the function constructor to escape the sent box and in the last escape we access the prototype of chart via the string constructor to screw with angularjs internals so it makes sense that these sandbox tries to prevent you to assign something to the constructor well the name assigned context indicates that this is a check used in assignments I set a breakpoint with the debugger keyword here so let's see what kind of objects are passed to this function so the first object path to it is the string a the second object path to it is the string constructor which will obviously then throw the exception now let's check where this is called from in the call stick it's coming from F N and F n is again this dynamically generated JavaScript code representing our expression we can take this generated code here and compare to the generated code from 1.4.7 and you can see that the fix is not super big it only added two function calls to ensure safeassign context anyhow let's try to understand what assigned context means in what cases as angularjs check an object with this function we can do this by using simple expressions so for example one plus one doesn't trigger the breakpoint sono check here that's not surprising we would expect some kind of assignment anyway right so let's do an assignment a equals two one okay this triggers the breakpoint and the object passed to it is the scope object remember from the first video that any variable you use is evaluated against the scope so the kind of makes sense let's look at the function angular generated so we zero variable zero is the one that we want to assign the tool variable to up here is s our scope so it also makes sense so now it here checks if V two is a safe object for assignments and yeah the scope is safe object we assign to it all the time after that you see the assignment happening with v2 dot a so a on the scope gets assigned the number one as you can see it always only checks the left side of an assignment so the object to the right is never checked this means we can still do stuff with the constructor it just can't be on the left side so we can assign it to a variable on the scope just fine but is that enough now that a is the string constructor let's see if we can assign something to the prototype of a first check is the first assignment which is fine but the second check will fail because a is the constructor hmm playing around like this is enough to find the bypass for the incomplete fix so go ahead pause the video and try it yourself head over to the testbed at live overflow comm slash angularjs you can do it in case you didn't get it or you just want me to tell you well here we go so we can use those evil objects on the right side of an assignment so we can assign them to anything we want but they can't be on the left side but the only evil object that can't be on the left side is the constructor so what we could do is we could assign the prototype to a instead and then we use a torch our head in the next step theoretically this should work because a contains now a prototype and not the constructor which means ensure safeassign context will not find a constructor and be happy so let's try it first assignment is on the scope so that is safe and the second check is on this weird object here but that's just the prototype and when we let the code continue we pop an alert that was super easy let's compare our bypass with what iron found on github his exploit is a little bit over complicated but in essence it's the same he assigns the prototype to a property Y of X and then accesses char add via the property same thing we just used a simple variable also this bypass still works in the latest version 1.58 but angularjs has announced that they will remove the angularjs end box in 1.6 this means that we don't need any fancy sandbox bypasses anymore and exploitation will become trivial it sounds counterintuitive but I think that's a good thing but let's discuss this in another video now let you understand angularjs sandbox bypasses I highly recommend you to watch the talk an abusive relationship with angularjs by Mario Heydrich he gives a great overview over the history of angularjs sandbox bypasses I just finished editing the video and I realized I forgot to give my disclaim and the proper credits like I did in the previous videos so here it comes a bit late I did not discover those bypasses myself great researchers like monohydrate iron Heke Gareth Hays and many more are the true brains here I merely tried to explain their hard work in a video so look them up and follow them on Twitter you
Original Description
The current AngularJS version is still vulnerable to this bypass. We just had to modify the latest fixed bypass to break the incomplete fix in 1.5.7
-=[ 🔴 Stuff I use ]=-
→ Microphone:* https://geni.us/ntg3b
→ Graphics tablet:* https://geni.us/wacom-intuos
→ Camera#1 for streaming:* https://geni.us/sony-camera
→ Lens for streaming:* https://geni.us/sony-lense
→ Connect Camera#1 to PC:* https://geni.us/cam-link
→ Keyboard:* https://geni.us/mech-keyboard
→ Old Microphone:* https://geni.us/mic-at2020usb
US Store Front:* https://www.amazon.com/shop/liveoverflow
-=[ ❤️ Support ]=-
→ per Video: https://www.patreon.com/join/liveoverflow
→ per Month: https://www.youtube.com/channel/UClcE-kVhqyiHCcjYwcpfj9w/join
-=[ 🐕 Social ]=-
→ Twitter: https://twitter.com/LiveOverflow/
→ Website: https://liveoverflow.com/
→ Subreddit: https://www.reddit.com/r/LiveOverflow/
→ Facebook: https://www.facebook.com/LiveOverflow/
-=[ 📄 P.S. ]=-
All links with "*" are affiliate links.
LiveOverflow / Security Flag GmbH is part of the Amazon Affiliate Partner Programm.
#WebSecurity #SecurityResearch
Playlist
Uploads from LiveOverflow · LiveOverflow · 42 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
▶
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
LiveOverflow - Trailer
LiveOverflow
Introduction to Linux - Installation and the Terminal - bin 0x01
LiveOverflow
Writing a simple Program in C
LiveOverflow
Writing a simple Program in Python - bin 0x03
LiveOverflow
Live Hacking - Twitch Recording overthewire.org - Vortex 0x01-0x03 (3h)
LiveOverflow
Reversing and Cracking first simple Program - bin 0x05
LiveOverflow
Abusing the exception handler to leak flag - 32C3CTF readme (pwnable 200)
LiveOverflow
ROP with a very small stack - 32C3CTF teufel (pwnable 200)
LiveOverflow
Uncrackable Programs? Key validation with Algorithm and creating a Keygen - Part 1/2 - bin 0x07
LiveOverflow
Uncrackable Program? Finding a Parser Differential in loading ELF - Part 2/2 - bin 0x08
LiveOverflow
Syscalls, Kernel vs. User Mode and Linux Kernel Source Code - bin 0x09
LiveOverflow
Smashing the Stack for Fun and Profit - setuid, ssh and exploit.education - bin 0x0B
LiveOverflow
Live Hacking - EFF-CTF 2016 - Level 0-4 (Enigma Conference)
LiveOverflow
First Stack Buffer Overflow to modify Variable - bin 0x0C
LiveOverflow
First Exploit! Buffer Overflow with Shellcode - bin 0x0E
LiveOverflow
Buffer Overflows can Redirect Program Execution - bin 0x0D
LiveOverflow
Doing ret2libc with a Buffer Overflow because of restricted return pointer - bin 0x0F
LiveOverflow
Reverse engineering C programs (64bit vs 32bit) - bin 0x10
LiveOverflow
pwnable.kr - Levels: fd, collision, bof, flag
LiveOverflow
Reverse Engineering and identifying Bugs - BKPCTF cookbook (pwn 6) part 1
LiveOverflow
Leaking Heap and Libc address - BKPCTF cookbook (pwn 6) part 2
LiveOverflow
Arbitrary write with House of Force (heap exploit) - BKPCTF cookbook (pwn 6) part 3
LiveOverflow
Live Hacking - Internetwache CTF 2016 - web50, web60, web80
LiveOverflow
Live Hacking - Internetwache CTF 2016 - crypto60, crypto70, crypto90
LiveOverflow
A simple Format String exploit example - bin 0x11
LiveOverflow
NEW VIDEOS ARE COMING - loopback 0x00
LiveOverflow
HTML + CSS + JavaScript introduction - web 0x00
LiveOverflow
The HTTP Protocol: GET /test.html - web 0x01
LiveOverflow
Building Poor Man's Logic Analyzer with an Arduino - Reverse Engineering A/C Remote part 1
LiveOverflow
What is PHP and why is XSS so common there? - web 0x02
LiveOverflow
Introducing the AngularJS Javascript Framework - XSS with AngularJS 0x00
LiveOverflow
Sandbox Bypass in Version 1.0.8 - XSS with AngularJS 0x1
LiveOverflow
Capturing & Analyzing Packets with Saleae Logic Pro 8 - Reverse Engineering A/C Remote part 2
LiveOverflow
XSS Contexts and some Chrome XSS Auditor tricks - web 0x03
LiveOverflow
Previous Bypass is now fixed in version 1.4.7 - XSS with AngularJS 0x2
LiveOverflow
New Sandbox Bypass in 1.4.7 - XSS with AngularJS 0x3
LiveOverflow
The Heap: what does malloc() do? - bin 0x14
LiveOverflow
The Heap: How to exploit a Heap Overflow - bin 0x15
LiveOverflow
Reverse Engineering with Binary Ninja and gdb a key checking algorithm - TUMCTF 2016 Zwiebel part 1
LiveOverflow
Scripting radare2 with python for dynamic analysis - TUMCTF 2016 Zwiebel part 2
LiveOverflow
Live Hacking - Internetwache CTF 2016 - exp50, exp70, exp80
LiveOverflow
Sandbox bypass for the latest AngularJS version 1.5.8 - XSS with AngularJS 0x4
LiveOverflow
Channel is growing and Riscure hardware CTF starting soon - loopback 0x01
LiveOverflow
Explaining Dirty COW local root exploit - CVE-2016-5195
LiveOverflow
What is CTF? An introduction to security Capture The Flag competitions
LiveOverflow
The Heap: How do use-after-free exploits work? - bin 0x16
LiveOverflow
The Browser is a very Confused Deputy - web 0x05
LiveOverflow
The Heap: Once upon a free() - bin 0x17
LiveOverflow
Simple reversing challenge and gaming the system - BruCON CTF part 1
LiveOverflow
int0x80 from DualCore lent me his lockpicking set and I'm a horse - BruCON CTF part 2
LiveOverflow
The Heap: dlmalloc unlink() exploit - bin 0x18
LiveOverflow
MD5 Length Extension and Blind SQL Injection - BruCON CTF part 3
LiveOverflow
TCP Protocol introduction - bin 0x1A
LiveOverflow
Socket programming in python and Integer Overflow - bin 0x1B
LiveOverflow
Linux signals and core dumps - bin 0x1C
LiveOverflow
[Live] Remote oldschool dlmalloc Heap exploit - bin 0x1F
LiveOverflow
Riscure Embedded Hardware CTF setup and introduction - rhme2 Soldering
LiveOverflow
Rooting a CTF server to get all the flags with Dirty COW - CVE-2016-5195
LiveOverflow
How to learn hacking? ft. Rubber Ducky
LiveOverflow
Format String to dump binary and gain RCE - 33c3ctf ESPR (pwn 150)
LiveOverflow
More on: Reading ML Papers
View skill →Related Reads
📰
📰
📰
📰
Don’t Read Another 30-Page Paper Until You Try This
Medium · AI
6.5% of the Neuro-Symbolic Literature Can Be Reproduced from Its Published Artifacts, a Six-Stage Audit Framework and First Instantiation
ArXiv cs.AI
Research Publications, Patents & Innovation Output at Quantum University
Medium · Machine Learning
Every Researcher Should Start Managing Research Intelligence Assets™
Medium · AI
🎓
Tutor Explanation
DeepCamp AI