Latest / CyberCode Academy / Course 38 - Web Security Known Web Attacks | Episode 5: SOP Fundamentals and SOME Attack Exploitation via Flash Callbacks
Transcript
- 0:00Speaker 1: Imagine just for a second that you are sitting at
- 0:04Speaker 1: your computer. You know, you've got your web browser open,
- 0:07Speaker 1: and in one tab you are securely logged into your
- 0:10Speaker 1: bank account. You're checking your balance, maybe paying a few bills,
- 0:13Speaker 1: just feeling totally secure.
- 0:15Speaker 2: Like we all do.
- 0:15Speaker 1: Yeah, yeah, exactly. But now, in another tab, right next
- 0:19Speaker 1: to it, you're browsing some I don't know, totally random,
- 0:22Speaker 1: maybe slightly sketchy website that you stumbled across while looking
- 0:25Speaker 1: for free movie streams or something. Sure, have you ever
- 0:28Speaker 1: stopped to wonder, why doesn't that sketchy website just reach over,
- 0:33Speaker 1: peek into the neighboring tab and steal your banking information?
- 0:37Speaker 2: Well, it is a scenario that sounds genuinely terrifying when
- 0:40Speaker 2: you lay it out exactly.
- 0:41Speaker 1: Like that, right, I mean, they're right there, exactly.
- 0:44Speaker 2: Those two websites. They're sitting right next to each other,
- 0:47Speaker 2: running inside the exact same application on your computer.
- 0:50Speaker 1: They are sharing the same digital roof, and yet they
- 0:53Speaker 1: just can't interact. And that invisible digital border wall dictating
- 0:58Speaker 1: everything you do online. Well, that is exactly what we
- 1:01Speaker 1: are exploring in this deep dive today.
- 1:03Speaker 2: It's a really crucial topic.
- 1:04Speaker 1: It is, so our mission today is basically twofold. First,
- 1:07Speaker 1: we are going to explore the unsung hero of web
- 1:10Speaker 1: security that stops this crosstab thievery from happening in the
- 1:15Speaker 1: first place.
- 1:15Speaker 2: The foundational stuff, right.
- 1:17Speaker 1: And then, because you know, nothing technology is perfect, we
- 1:21Speaker 1: are going to uncover the really clever, almost invisible way
- 1:24Speaker 1: that attackers bypass it, essentially turning your web browser into
- 1:28Speaker 1: their own personal puppet.
- 1:29Speaker 2: It is a fascinating look into the actual foundational architecture
- 1:34Speaker 2: of the web. What we are really talking about here
- 1:37Speaker 2: is a massive tug.
- 1:38Speaker 1: Of war, a tug of war, yeah, between.
- 1:40Speaker 2: Strict security and practical necessity, because the web fundamentally was
- 1:44Speaker 2: built to share information. Of course, if the security walls
- 1:47Speaker 2: are built too high, websites just simply break. As we
- 1:50Speaker 2: will explore today, it is exactly that necessity, you know,
- 1:54Speaker 2: the need for websites to seamlessly share content with one another,
- 1:57Speaker 2: that inevitably creates these loopholes.
- 2:00Speaker 1: And so by the end of this deep dive, you
- 2:02Speaker 1: are going to understand exactly how the web protects you
- 2:04Speaker 1: on a daily basis. But perhaps a little more unsettling,
- 2:07Speaker 1: you'll also understand how hackers can manipulate the very rules
- 2:11Speaker 1: designed to keep you safe.
- 2:12Speaker 2: It's always a cat mouse game, always.
- 2:14Speaker 1: But before we get to the actual break in, we
- 2:17Speaker 1: really need to understand the lock. So what is actually
- 2:20Speaker 1: stopping that sketchy movie site from reaching into my bank tab?
- 2:24Speaker 2: Well, the foundational locking mechanism keeping your bank data safe
- 2:28Speaker 2: is called the same origin policy or SOP.
- 2:30Speaker 1: Same origin policy.
- 2:31Speaker 2: Okay, yeah, it is arguably one of the most critical
- 2:34Speaker 2: concepts in all of web application security. The absolute basic
- 2:38Speaker 2: premise is exactly what you described with the bank. Right.
- 2:41Speaker 2: A site like let's say attacker dot com cannot access
- 2:45Speaker 2: the data, the cookies, the functionality, or even the visual
- 2:48Speaker 2: window content of Google dot com.
- 2:50Speaker 1: So it just keeps the lanes completely separate, exactly.
- 2:53Speaker 2: It forces absolute isolation. Now, a site can access content
- 2:56Speaker 2: on its own.
- 2:57Speaker 1: Domain, okay, so it can talk to itself, right.
- 3:00Speaker 2: Attacker dot com can talk to other pages on attacker
- 3:02Speaker 2: dot com all day long, But the moment it tries
- 3:05Speaker 2: to cross over to another origin, your web browser just
- 3:09Speaker 2: throws up a massive brick wall.
- 3:10Speaker 1: Wow.
- 3:11Speaker 2: But this brings up a technical question, Right, how does
- 3:15Speaker 2: the browser actually define what an origin is?
- 3:18Speaker 1: I mean, I would just assume it's looking at the
- 3:20Speaker 1: name of the website.
- 3:21Speaker 2: No, you'd think so, but it is not just looking
- 3:23Speaker 2: at the domain name. The same origin policy operates on
- 3:26Speaker 2: a very street sort of mathematical like rule of three.
- 3:29Speaker 1: Rule of three.
- 3:30Speaker 2: Okay, Yes, For one URL to access the content of
- 3:33Speaker 2: another URL, three distinct parameters must match perfectly.
- 3:37Speaker 1: Perfectly, All right, break those down for me. What's the
- 3:40Speaker 1: rule of three?
- 3:40Speaker 2: So parameter number one is the protocol the protocol, right,
- 3:43Speaker 2: This is the very beginning of the web address. Usually
- 3:46Speaker 2: it's HGTP or the secure version HGTPS.
- 3:49Speaker 1: Okay, that makes sense.
- 3:50Speaker 2: Parameter number two is the host. This is the domain
- 3:52Speaker 2: name itself, like Google dot com or Star Company dot com.
- 3:56Speaker 1: Got it.
- 3:56Speaker 2: And the third and preimier number three is the port number.
- 3:58Speaker 1: Wait port number like a physical USB port on my computer.
- 4:03Speaker 2: Ah No, not physical. These are digital ports. You can
- 4:08Speaker 2: think of them as specific numerical channels that web traffic
- 4:11Speaker 2: flows through.
- 4:11Speaker 1: Okay, numerical channels right.
- 4:13Speaker 2: For example, standard unencrypted HTTP traffic usually goes through port
- 4:18Speaker 2: eighty by.
- 4:18Speaker 1: Default Port eighty, and.
- 4:20Speaker 2: Secure HCTPS traffic goes through port four forty three. So
- 4:24Speaker 2: for the browser to consider two web pages as coming
- 4:26Speaker 2: from the exact same origin. The protocol, the host, and
- 4:30Speaker 2: the port must all be absolutely identical.
- 4:34Speaker 1: I love a good analogy, so let me just try
- 4:35Speaker 1: to visualize this.
- 4:36Speaker 2: Go for it.
- 4:37Speaker 1: It's it's like trying to get a package delivered to
- 4:40Speaker 1: an executive and a massive corporate skyscraper.
- 4:43Speaker 2: Okay with you.
- 4:44Speaker 1: So the protocol that HGTP or HTTPS part is the
- 4:49Speaker 1: security checkpoint at the front door. It checks if you
- 4:51Speaker 1: have the right ID badge to even be allowed in
- 4:53Speaker 1: the building.
- 4:54Speaker 2: Perfect.
- 4:55Speaker 1: Then the host, the domain name is the physical street
- 4:57Speaker 1: address of the skyscraper itself. You have to arrive at
- 4:59Speaker 1: the right building exactly. And then the port that's the
- 5:02Speaker 1: specific service desk you are trying to reach once you're inside.
- 5:05Speaker 2: That is actually a really great way to mack it out.
- 5:07Speaker 1: So if you shake up at the right building, the host,
- 5:10Speaker 1: and you pass the security ID check the protocol, but
- 5:13Speaker 1: then you try to drop off a sensitive corporate package
- 5:16Speaker 1: at like the eightieth floor shipping desk instead of the
- 5:19Speaker 1: four hundred and forty third floor executive desk.
- 5:22Speaker 2: You're denied, completely denial.
- 5:23Speaker 1: Security guard basically kicks you out because the port doesn't match.
- 5:26Speaker 2: That is highly accurate. Let's actually run a quick mental
- 5:29Speaker 2: simulation just to see how strict your security guard really is. Okay,
- 5:32Speaker 2: let's do it. Imagine you are logged into a system
- 5:34Speaker 2: at a base url. Let's say http colon slash slash
- 5:39Speaker 2: Star Company dot Com on port.
- 5:42Speaker 1: Eighty okay, unencrypted port eighty right.
- 5:45Speaker 2: If another page on HTDP colon slash slash Star Company
- 5:48Speaker 2: dot Com on port eighty tries to access your session,
- 5:51Speaker 2: the guard lets them in. Protocol, host and port all
- 5:54Speaker 2: match perfectly.
- 5:55Speaker 1: Easy enough, They're in the same building, they pass the
- 5:57Speaker 1: same ID check, and they're at the same desk exactly.
- 6:00Speaker 2: But what if the requesting URL is h GDPs colon
- 6:03Speaker 2: slash slash Star Company dot Com.
- 6:05Speaker 1: Ah, I see it has that as at the end
- 6:07Speaker 1: of HTTP yep, so the protocol changed from unencrypted to encrypted. Basically,
- 6:12Speaker 1: the ID badge is wrong. So the guard says.
- 6:14Speaker 2: No, correct, it is a failure. What if the protocol
- 6:18Speaker 2: and host match, but the port is eighty eighty instead of.
- 6:21Speaker 1: Eighty failure, wrong desk exactly.
- 6:24Speaker 2: What if the protocol and port match perfectly, but the
- 6:28Speaker 2: host is Newscompany dot Com instead of Star Company dot Com.
- 6:33Speaker 1: Complete failure, wrong building, entirely right.
- 6:36Speaker 2: Your browser enforces this ruthlessly in the background, literally a thousand.
- 6:39Speaker 1: Times a day, which is fantastic news from my bank account, honestly.
- 6:43Speaker 1: But here's where I'm getting a little confused.
- 6:45Speaker 2: Okay, what's the hang up?
- 6:46Speaker 1: Well, if this rule is an absolute, impenetrable brick wall,
- 6:50Speaker 1: I feel like the Internet should be broken.
- 6:52Speaker 2: What do you mean.
- 6:54Speaker 1: Just think about a modern news website. You go to
- 6:56Speaker 1: read an article and the page is pulling in a
- 6:58Speaker 1: YouTube video player from one domain right right, and a
- 7:01Speaker 1: custom font from some design server, and advertising banners from
- 7:04Speaker 1: three different marketing sites. If the same origin policy blocks
- 7:08Speaker 1: everything that doesn't perfectly match that rule of three, none
- 7:12Speaker 1: of that media should load.
- 7:13Speaker 2: Well, You've just hit on the absolute core paradox of
- 7:16Speaker 2: web development.
- 7:17Speaker 1: Oh really, Yeah?
- 7:18Speaker 2: If the same origin policy had zero exceptions, the modern
- 7:22Speaker 2: web as we know it would essentially cease to function.
- 7:24Speaker 1: It'd be super boring.
- 7:25Speaker 2: It would just be a collection of isolated, static text pages.
- 7:29Speaker 2: Because developers have a functional, everyday requirement to access third
- 7:32Speaker 2: party content, the creators of these web standards had to
- 7:35Speaker 2: intentionally build exceptions into that brick wall.
- 7:39Speaker 1: I see.
- 7:39Speaker 2: We refer to these as soft exclusions.
- 7:41Speaker 1: Okay, so we have this Titanium security door, but we
- 7:43Speaker 1: basically installed doggy doors at the bottom.
- 7:47Speaker 2: That is a brilliant visual. Actually, yes, there are specific
- 7:51Speaker 2: HTML tags and methods that are officially allowed to bypass
- 7:55Speaker 2: the same origin policy to load external resources like what well.
- 7:59Speaker 2: For example, when a developer uses a script tag to
- 8:02Speaker 2: load JavaScript from a third party server, that is an exclusion. Okay,
- 8:06Speaker 2: when you use a link tag to load CSS style sheets,
- 8:09Speaker 2: you know, to make the page look pretty, that's an exclusion. Images,
- 8:12Speaker 2: audio tags, video tags, custom fonts. These are all permitted
- 8:16Speaker 2: to cross the boundary.
- 8:17Speaker 1: So the browser basically says, I won't let you read
- 8:20Speaker 1: this user's private cookies, but I will let you display
- 8:23Speaker 1: that third party image on your lawn.
- 8:25Speaker 2: Right. Even loading an entirely different website inside your own
- 8:29Speaker 2: page using an eeframe is an exclusion, though there are
- 8:32Speaker 2: strict limits on how your page can actually interact with
- 8:36Speaker 2: the site inside that EE frame.
- 8:37Speaker 1: Sure, but if there are doggy doors, I mean even
- 8:40Speaker 1: small ones designed just for images and scripts, someone is
- 8:43Speaker 1: eventually going to try and sneak a hand through them
- 8:46Speaker 1: to unlock the main door.
- 8:47Speaker 2: That is the history of hacking in a nutshell, right.
- 8:50Speaker 1: Which brings us to the vulnerability we're focusing on today.
- 8:54Speaker 1: If the same origin policy is the lock how are
- 8:57Speaker 1: hackers picking it?
- 8:58Speaker 2: The lock pick we're examining is a highly clever type.
- 9:01Speaker 1: Of attack known as some soome. What does that stand for?
- 9:05Speaker 2: It stands for same origin method execution.
- 9:07Speaker 1: Same origin method execution. Got it?
- 9:10Speaker 2: And to understand how it sneaks through those doggy doors,
- 9:13Speaker 2: we really have to talk about how websites communicate in
- 9:15Speaker 2: the background, using something called callbacks. All back yeah, And
- 9:19Speaker 2: specifically we need to look at an old friend, or
- 9:23Speaker 2: perhaps an old enemy of web security. Adobe Flash.
- 9:27Speaker 1: Wait, hold on Flash, Yes, isn't that totally dead? Like
- 9:30Speaker 1: didn't browsers kill that off years ago? Why are we
- 9:33Speaker 1: worried about some ancient web relic.
- 9:35Speaker 2: It is true that modern consumer browsers block flash by
- 9:38Speaker 2: default now. However, legacy code casts a remarkably long shadow.
- 9:43Speaker 1: Meaning it's still out there, oh everywhere.
- 9:46Speaker 2: Many massive enterprise applications, older internal corporate tools, and even
- 9:50Speaker 2: legacy content management systems still harbor SWF files. That's shockwave
- 9:55Speaker 2: flash files deep in their architecture.
- 9:57Speaker 1: Just because it's too expensive to fix exactly.
- 10:00Speaker 2: Businesses do not want to spend millions rebuilding tools that
- 10:03Speaker 2: technically still function.
- 10:05Speaker 1: So somewhere deep in a corporate server, a forgotten flash
- 10:08Speaker 1: file is just still ticking away.
- 10:09Speaker 2: Yes, But honestly, more importantly, the mechanics of this attack,
- 10:13Speaker 2: how it actually manipulates trust and input validation. It perfectly
- 10:17Speaker 2: illustrates a much broader category of vulnerabilities involving weak callbacks.
- 10:22Speaker 1: Oh, I see, so it's not just about Flash.
- 10:24Speaker 2: Not at all. The concepts we are about to unpack
- 10:27Speaker 2: apply just as heavily to modern APIs and modern JavaScript
- 10:30Speaker 2: frameworks as they do to flash. Flash just gives us
- 10:33Speaker 2: the clearest, most dramatic window into the exploit.
- 10:36Speaker 1: Okay, I'll buy that the underlying flaw is timeless. So
- 10:41Speaker 1: how does this some attack actually use flash or a
- 10:44Speaker 1: weak callback to break the rules?
- 10:47Speaker 2: It relies on a specific function within Flash called external
- 10:51Speaker 2: interface dot.
- 10:52Speaker 1: Call External interface dot call right.
- 10:55Speaker 2: Think of this function as a bridge. It was built
- 10:57Speaker 2: to allow the flash environment to reach out and talk
- 11:00Speaker 2: directly to the web page's JavaScript environment.
- 11:03Speaker 1: Hmm, I think I need an analogy for a callback. Actually,
- 11:06Speaker 1: is it kind of like giving a delivery driver your
- 11:08Speaker 1: phone number?
- 11:09Speaker 2: Hot?
- 11:09Speaker 1: Do you mean, like instead of you constantly checking the
- 11:11Speaker 1: front door over and over you just tell them, hey,
- 11:13Speaker 1: call this specific number when you arrive and I'll come
- 11:15Speaker 1: open the door.
- 11:15Speaker 2: That is a perfect analogy. In programming, a callback is
- 11:18Speaker 2: simply a function passed into another function as an argument,
- 11:22Speaker 2: which is then invoked inside the outer function. So a
- 11:25Speaker 2: developer might write code in Flash that needs to trigger
- 11:28Speaker 2: a pop up on the main web page. They use
- 11:31Speaker 2: external interface dot call, provide the name of the JavaScript function.
- 11:35Speaker 2: Let's say they named it trigger pop up, and Flash
- 11:38Speaker 2: calls out across the bridge.
- 11:39Speaker 1: And the web page answers.
- 11:41Speaker 2: Right, the webpage runs trigger pop up and everyone is happy.
- 11:45Speaker 2: It was designed to be a helpful, seamless connection.
- 11:48Speaker 1: Oh wait, let me think this through logically. Sure, if
- 11:51Speaker 1: I'm building a secure website and I know hackers are
- 11:53Speaker 1: always trying to inject malicious JavaScript code like a cross
- 11:57Speaker 1: site scripting attack, I'm going to filter what they can
- 12:00Speaker 1: type into my site as you should. Because to run
- 12:03Speaker 1: a command in JavaScript, you physically need brackets or parentheses. Right,
- 12:07Speaker 1: if you want to run an alert, you type alert
- 12:09Speaker 1: and then open parentheses, close princes.
- 12:11Speaker 2: Yeah, that's the syntax.
- 12:12Speaker 1: So could I just build a filter that bans all brackets, parentheses,
- 12:16Speaker 1: and quote marks. If they can't type the punctuation needed
- 12:19Speaker 1: to make the code actually run. They can't hack me.
- 12:21Speaker 2: That is the exact logical assumption that literally thousands of
- 12:25Speaker 2: developers made, and it is the exact assumption that the
- 12:28Speaker 2: some attack exploits. You are entirely correct that a traditional
- 12:33Speaker 2: security filter would strip out those brackets.
- 12:35Speaker 1: Okay, so where's the flaw.
- 12:37Speaker 2: Here is the massive hidden secret of external interface dot call.
- 12:42Speaker 2: It provides the brackets automatically in the background.
- 12:45Speaker 1: Hold up, it adds the brackets for you.
- 12:47Speaker 2: It does.
- 12:48Speaker 1: Why would Adobe designed to do that?
- 12:50Speaker 2: Because back in the day, Flash was trying to be
- 12:52Speaker 2: incredibly accommodating to older, more fragile JavaScript engines. The designers
- 12:58Speaker 2: basically assume developers on of the strings they were passing
- 13:01Speaker 2: over the bridge to be evaluated as active commands immediately.
- 13:04Speaker 1: Wow.
- 13:05Speaker 2: So to make the developer's life easier, Flash healthfully tacked
- 13:09Speaker 2: on the execution brackets in the background to make the
- 13:11Speaker 2: code run smoother.
- 13:13Speaker 1: Oh wow. So if a hacker figures this out, Yes.
- 13:15Speaker 2: If an attacker passes a malicious payload that is nothing
- 13:18Speaker 2: but a chain of normal words separated by dots, just
- 13:21Speaker 2: alpha numeric characters and dots, it completely bypasses those strict security.
- 13:25Speaker 1: Filters because there's no punctuation to flag exactly Yeah.
- 13:28Speaker 2: To the website's defense system, it just looks like a harmless,
- 13:31Speaker 2: meaningless string of text. There are no brackets, no weapons then,
- 13:36Speaker 2: But when Flash receives that text on the other side
- 13:38Speaker 2: of the bridge, it's helpful nature kicks in. It adds
- 13:41Speaker 2: the brackets and suddenly turns that harmless string into a live,
- 13:45Speaker 2: executable weapon.
- 13:47Speaker 1: That is absolutely wild. It's like the security filter is
- 13:50Speaker 1: frantically searching everyone's bags for a weapon, and the attacker
- 13:54Speaker 1: just walks right through security carrying a paper blueprint, knowing
- 13:58Speaker 1: the system on the other side will just build the
- 13:59Speaker 1: way for them.
- 14:00Speaker 2: That's a great way to picture it.
- 14:02Speaker 1: Let's make this concrete. I want to walk through a
- 14:04Speaker 1: real world scenario so we can see what this looks
- 14:06Speaker 1: like in practice. Set the stage for us.
- 14:08Speaker 2: Okay, let's step into the attacker's shoes and look at
- 14:10Speaker 2: the screen. Our target is a very standard WordPress website.
- 14:14Speaker 2: We'll just call it some dot.
- 14:15Speaker 1: Com dot com.
- 14:16Speaker 2: Okay, deepen the folders of this website. There is an
- 14:19Speaker 2: old vulnerable flash file called videojs dot two swift. This
- 14:25Speaker 2: file contains a weak callback parameter called ready function.
- 14:29Speaker 1: And just to be clear, the developers of this site
- 14:31Speaker 1: actually tried to be secure, right they put a filter
- 14:33Speaker 1: on that ready function.
- 14:34Speaker 2: Yes, they implemented a very strict filter. If you try
- 14:37Speaker 2: to pass it traditional malicious code with any special characters,
- 14:41Speaker 2: the server scrubs it completely clean.
- 14:43Speaker 1: So no brackets allowed, none.
- 14:46Speaker 2: The filter only allows alphanumeric characters, underscores, and dots. That
- 14:50Speaker 2: is it. So a traditional cross site scripting attack is
- 14:54Speaker 2: completely dead in the water. The wall is holding.
- 14:56Speaker 1: But because it allows dots and letters, it is vulnerable.
- 15:00Speaker 2: To some attack precisely.
- 15:03Speaker 1: So how do we spring the trap?
- 15:04Speaker 2: Well, the attacker starts by identifying a victim who's currently
- 15:07Speaker 2: logged into this WordPress site. That is a crucial requirement. Why,
- 15:12Speaker 2: because the victim needs to have an active session cookie
- 15:15Speaker 2: in their browser. That cookie prove they are a trusted
- 15:18Speaker 2: user like an administrator.
- 15:19Speaker 1: Ah okay.
- 15:20Speaker 2: The attacker then crafts a malicious link and sends it
- 15:23Speaker 2: to the victim, maybe hidden in a forum post or
- 15:26Speaker 2: a deceptive email.
- 15:28Speaker 1: So I'm the victim, I'm logged into my word Press
- 15:30Speaker 1: site managing my blog. I get this email and I
- 15:34Speaker 1: click the link. Does a virus immediately download to my computer.
- 15:37Speaker 2: No, and that is what makes this so insidious. Yeah,
- 15:39Speaker 2: it relies purely on the browser's normal behavior. What happens
- 15:43Speaker 2: when you click that link, your browser opens a brand
- 15:46Speaker 2: new tab to load the attacker's page. But simultaneously, the
- 15:50Speaker 2: original tab, the one you just clicked away from, suddenly redirects.
- 15:54Speaker 2: Redirects where it navigates away from your blog post and
- 15:57Speaker 2: goes directly to the WordPress plugins dashboard.
- 15:59Speaker 1: Wait, they can hijack the tab I left behind.
- 16:02Speaker 2: Yes, using basic HTML commands, the new tab can actually
- 16:05Speaker 2: tell the parent tab to navigate to a new page.
- 16:08Speaker 1: Okay, so I'm looking at my screen. My active tab
- 16:11Speaker 1: is whatever sketchy side I just clicked loading in the foreground,
- 16:14Speaker 1: but hidden right behind it, my original tab has quietly
- 16:17Speaker 1: navigated to my sensitive plugins page. That's right, What is
- 16:21Speaker 1: happening in that foreground tab.
- 16:23Speaker 2: That new foreground tab is the engine of the attack.
- 16:26Speaker 2: It is programmed with a slight delay, let's say five seconds.
- 16:30Speaker 2: It waits to ensure the parent tab in the background
- 16:32Speaker 2: has fully loaded the plugins page.
- 16:34Speaker 1: Okay, ticking down right after.
- 16:35Speaker 2: Those five seconds, the new tab automatically redirects itself to
- 16:39Speaker 2: that vulnerable flash file hosted on the word Press site,
- 16:42Speaker 2: the videojs dot swaff and as it loads that file,
- 16:47Speaker 2: it passes our malicious payload into that ready function parameter.
- 16:50Speaker 1: And because this new tab is loading a file from
- 16:52Speaker 1: the same origin, the same word Press domain, the same
- 16:55Speaker 1: origin policy looks at it sees the rule of three
- 16:58Speaker 1: matches perfectly, and so yep, you're allowed to talk to
- 17:01Speaker 1: the parent tab. It respects the policy exactly.
- 17:05Speaker 2: The doggy door is open.
- 17:06Speaker 1: But here is the missing piece for me. If we
- 17:09Speaker 1: are banned from using brackets and we can only use
- 17:12Speaker 1: letters and dots, how on earth are we attacking the
- 17:15Speaker 1: plugins page.
- 17:16Speaker 2: This is where the attacker begins to literally puppeteer the
- 17:20Speaker 2: browser because we are limited to words and dots. Our
- 17:23Speaker 2: payload isn't traditional code. It is a set of precise
- 17:27Speaker 2: navigational directions for the document object model or the dom.
- 17:31Speaker 1: The dom. Can you visualize that for me?
- 17:33Speaker 2: Think of the document object model as a massive, invisible
- 17:36Speaker 2: family tree that the browser builds for every single web page,
- 17:40Speaker 2: every single button, every text box, every image, every paragraph.
- 17:45Speaker 2: They're all a node on that tree. They all have parents, children,
- 17:49Speaker 2: and siblings based on exactly how they are nested in
- 17:52Speaker 2: the layout.
- 17:52Speaker 1: Okay, I am picturing a giant organizational chart of the
- 17:56Speaker 1: web page's layout.
- 17:57Speaker 2: That's it.
- 17:58Speaker 1: But why use a map? Why not just write a
- 18:00Speaker 1: payload that says, find the button called to activate and
- 18:03Speaker 1: click it.
- 18:03Speaker 2: Well, because security filters often block direct references to specific IDs,
- 18:09Speaker 2: and more importantly, modern web pages are dynamic layouts, shift buttons,
- 18:14Speaker 2: change name.
- 18:15Speaker 1: Oh, that makes sense.
- 18:16Speaker 2: Using a relative path navigating from one element to the
- 18:18Speaker 2: next bypasses simple keyword filters and dynamically hunts down the
- 18:23Speaker 2: target no matter how the page renders.
- 18:24Speaker 1: So give me the directions. How does the payload actually read?
- 18:27Speaker 2: The payload stream looks like this. It starts with window
- 18:30Speaker 2: dot opener.
- 18:31Speaker 1: Window dot opener that tells the browsers start by looking
- 18:33Speaker 1: back at the parent tab that opened.
- 18:35Speaker 2: You exactly, then a dot, then first element child.
- 18:38Speaker 1: Go to the very first item on that.
- 18:40Speaker 2: Page right, then another dot.
- 18:41Speaker 1: Next sibling move over to the element sitting right next
- 18:44Speaker 1: to it.
- 18:44Speaker 2: Yep, then a dot, last element child.
- 18:48Speaker 1: Go down to the bottom of that specific section. It
- 18:50Speaker 1: literally reads like a treasure map. Take a left at
- 18:53Speaker 1: the old oak tree, walked ten paces to the river,
- 18:55Speaker 1: dig down three feet.
- 18:56Speaker 2: It is exactly like a map, and it looks like,
- 18:59Speaker 2: you know, a kismet first elementchild dot next sibling dot
- 19:02Speaker 2: last element child dot first child. Wow. The attacker has
- 19:06Speaker 2: spent hours studying the exact layout of the word Press
- 19:10Speaker 2: plugins page. They have mapped the precise path through that
- 19:14Speaker 2: dom family tree to land directly on the HTML code
- 19:18Speaker 2: for the activate button of a specific plug in, let's
- 19:21Speaker 2: say the echism anti spam plug in.
- 19:24Speaker 1: And then the final word in the payload string dot click,
- 19:27Speaker 1: dot click. And because that flash external interface is so
- 19:30Speaker 1: incredibly helpful, it receives that long string of directions and
- 19:33Speaker 1: automatically adds the invisible brackets at the very end catch us.
- 19:36Speaker 1: So the browser interprets that entire treasure map not just
- 19:39Speaker 1: as a location, but as an active command click open parentheses,
- 19:43Speaker 1: close parenthesis exactly.
- 19:44Speaker 2: The browser physically simulates the victim clicking their mouths on
- 19:48Speaker 2: the activate button.
- 19:49Speaker 1: But they didn't do anything right.
- 19:51Speaker 2: The victim didn't move your hand, they didn't consent to it.
- 19:54Speaker 2: They're looking at a different tab entirely.
- 19:56Speaker 1: That's crazy.
- 19:57Speaker 2: But because the command came from a trusted, same origin
- 20:00Speaker 2: flash file, and because the victim has an active session
- 20:03Speaker 2: cookie proving they are an administrator, The browser executes the
- 20:07Speaker 2: command without.
- 20:08Speaker 1: Hesitation, the plug in is activated.
- 20:10Speaker 2: The plug in is activated, the attacker has successfully performed
- 20:14Speaker 2: a state changing action on the user's behalf.
- 20:17Speaker 1: That is stackering. The attacker used the browser's own helpful features,
- 20:22Speaker 1: the DOM navigation, the automatic brackets, and the flashbridge. The
- 20:26Speaker 1: session cookies completely against itself. It's invisible puppetry.
- 20:30Speaker 2: It really is.
- 20:30Speaker 1: But let me push the boundaries on this a bit.
- 20:32Speaker 1: Activating a plug in is just a single click. What
- 20:35Speaker 1: if an attacker wants to do something truly destructive that
- 20:38Speaker 1: requires multiple steps, Like what say they want to completely
- 20:42Speaker 1: delete a critical plug in or change an admin bassword.
- 20:45Speaker 1: Usually when you click delete, the site throws up a
- 20:48Speaker 1: warning pop up. Right, are you sure you want to
- 20:49Speaker 1: delete these files? Yes? Or no?
- 20:51Speaker 2: Yes? A confirmation dialogue?
- 20:54Speaker 1: Right? If a some attack payload is just one long
- 20:57Speaker 1: string ending in a single dot click, how does it
- 20:59Speaker 1: now negate a two step process.
- 21:01Speaker 2: Well, if an attacker has the ability to click one button,
- 21:04Speaker 2: they have the ability to click one hundred. They just
- 21:06Speaker 2: need to scale the attack. Oh, some attacks are not
- 21:09Speaker 2: limited to a single action, and they are certainly not
- 21:12Speaker 2: limited to a single tab to bypass a confirmation dialogue.
- 21:16Speaker 2: The attacker relies on a technique called chained tabs.
- 21:19Speaker 1: Chained tabs walk me through that workflow.
- 21:22Speaker 2: So instead of the malicious link opening just one new tab,
- 21:25Speaker 2: the JavaScript in that initial click silently opens multiple tabs
- 21:28Speaker 2: in the background. Let's say it opens tab B in
- 21:31Speaker 2: tab C. Okay, the parent tab redirects to the plugins
- 21:34Speaker 2: page just like before. Cab B waits its five seconds,
- 21:37Speaker 2: navigates the dom tree, and fires its payload. A dot
- 21:41Speaker 2: click on the delete plugin button, and the.
- 21:43Speaker 1: Word press site behaves normally. It brings up the confirmation
- 21:45Speaker 1: prompt are you sure right now?
- 21:47Speaker 2: Tab C, which has been waiting patiently in the background
- 21:50Speaker 2: with a longer delay, perhaps ten seconds, fires its payloads.
- 21:53Speaker 1: Oh, I see where this is going.
- 21:54Speaker 2: It navigates the updated dom of that newly generated confirmation prompt,
- 21:59Speaker 2: finds the yes delete these files button, and executes its
- 22:03Speaker 2: dot click.
- 22:04Speaker 1: So they are orchestrating a hidden symphony of browser tabs,
- 22:07Speaker 1: each perfectly timed to execute the next step of a
- 22:11Speaker 1: complex workflow.
- 22:12Speaker 2: Yes. By opening multiple new tabs or windows and staggering
- 22:16Speaker 2: their execution times, an attacker can effectively puppeteer an entire
- 22:20Speaker 2: complex user session.
- 22:22Speaker 1: That's terrifying.
- 22:23Speaker 2: They could transfer funds, alter account settings, grant themselves, admin privileges, honestly,
- 22:29Speaker 2: anything that relies on predictable clicks, all while the victim
- 22:32Speaker 2: is just sitting there wondering why their browser tabs are flickering.
- 22:35Speaker 1: It is a profound reminder that the web browser is
- 22:37Speaker 1: doing so much heavy lifting behind the scenes. We just
- 22:40Speaker 1: trust it to render the text and the images and
- 22:42Speaker 1: play the videos, but it's constantly interpreting and executing commands
- 22:46Speaker 1: based on a massive, intricate web of trust.
- 22:49Speaker 2: Which brings us back to the core lesson of the architecture.
- 22:52Speaker 2: The same origin policy is the bedrock of that trust.
- 22:55Speaker 2: It is the rule that keeps the chaos at bay.
- 22:57Speaker 1: But trust is a fragile thing'ally fragile.
- 23:01Speaker 2: When developers implement weak callbacks, when they assume input is
- 23:05Speaker 2: safe just because it lacks punctuation, or when they leave
- 23:08Speaker 2: legacy code lying around deep in corporate servers, they are
- 23:12Speaker 2: inadvertently creating massive back doors in that foundational wall.
- 23:16Speaker 1: So, bringing it all back to that image we started with,
- 23:19Speaker 1: You've got your bank open in one tab and that
- 23:21Speaker 1: sketchy streaming site open in another. Yeah, you now know
- 23:24Speaker 1: that the same origin policy, with its strict rule of
- 23:27Speaker 1: three is the silent guardian standing between them. As long
- 23:31Speaker 1: as the lock holds your money is safe, that's the hope.
- 23:35Speaker 1: But you also know that if your bank happens to
- 23:37Speaker 1: have a misplaced, vulnerable callback function buried deep in its code,
- 23:41Speaker 1: that sketchy site might not need to break down.
- 23:43Speaker 2: The wall at all, not at all.
- 23:44Speaker 1: It might just hand the browser a map, a set
- 23:46Speaker 1: of relative directions, and let your own trusted browser do
- 23:49Speaker 1: the clicking for it.
- 23:50Speaker 2: It really leaves us with a final provocative thought experiment.
- 23:54Speaker 2: But before that, let's do a quick review exercise for
- 23:56Speaker 2: everyone listening, just to reinforce the core concept.
- 23:59Speaker 1: I love a pop quick hit us.
- 24:00Speaker 2: Okay, So, if you're visiting a secure site at HTPPS
- 24:04Speaker 2: colon slash slash Star Company dot com on port four
- 24:07Speaker 2: four three, and a script tries to access data from
- 24:10Speaker 2: http colon slash slash Star Company dot Com on court eighty,
- 24:15Speaker 2: will the same origin policy allow it? Think about the
- 24:18Speaker 2: rule of three.
- 24:19Speaker 1: The answer is no, because the protocol and port are different.
- 24:22Speaker 2: Exactly You've got it, But to leave you with that
- 24:25Speaker 2: final thought to ponder next time you are browsing the web,
- 24:29Speaker 2: and you have those twenty tabs open simultaneously, consider the
- 24:33Speaker 2: hidden interactions.
- 24:34Speaker 1: Yeah, think about what's running in the background.
- 24:36Speaker 2: We spend millions of dollars in countless hours worrying about
- 24:39Speaker 2: hackers breaking into our servers from the outside with brute force,
- 24:42Speaker 2: But attacks like some demonstrate that sometimes the most dangerous
- 24:46Speaker 2: weapon in an attacker's arsenal is the browser's own helpfulness.
- 24:49Speaker 1: It's doing exactly what it was told to do.
- 24:51Speaker 2: Exactly so when trust is misplaced in seemingly innocent third
- 24:54Speaker 2: party files or outdated callbacks, you really have to ask
- 24:57Speaker 2: yourself as you sit there looking at your screen, who
- 25:01Speaker 2: is actually driving your browser.
- 25:02Speaker 1: It's an unsettling but absolutely necessary question to keep in mind.
- 25:06Speaker 1: Keep your systems updated, understand the legacy code hiding in
- 25:09Speaker 1: your networks, and always be mindful of the digital doors
- 25:12Speaker 1: you leave open. Thanks for joining us on this exploration
- 25:15Speaker 1: of the hidden mechanics of the web. We'll see you
- 25:17Speaker 1: on the next deep dive.