Latest / CyberCode Academy / Course 38 - Web Security Known Web Attacks | Episode 2: RCE Filter Bypassing and JSON Hijacking
Transcript
- 0:00Speaker 1: So imagine locking every single door and window.
- 0:02Speaker 2: In your house, right, like, totally battening down the hatches exactly.
- 0:06Speaker 1: You set this state of the art alarm system, you
- 0:08Speaker 1: double check the dead bolts, and you go to sleep
- 0:10Speaker 1: feeling completely secure, only to wake up and realize a
- 0:14Speaker 1: burglar just walked right in. Oh wow, Yeah, they bypassed
- 0:17Speaker 1: the alarm, emptied your safe, and they did it all
- 0:20Speaker 1: because you actually handed them the blueprint without even realizing it.
- 0:23Speaker 2: That is, I mean, that's a terrifying realization.
- 0:27Speaker 1: It really is. And you did it simply because you know,
- 0:29Speaker 1: you wanted your smart thermostat to automatically adjust the temperature
- 0:32Speaker 1: when you walked into a room.
- 0:34Speaker 2: Yeah, we spend so much time building walls, we kind
- 0:36Speaker 2: of forget that the mechanisms we design for our own convenience,
- 0:40Speaker 2: they're usually the exact things an attacker will leverage against us.
- 0:44Speaker 1: Which brings us to what we're doing today. Welcome to
- 0:46Speaker 1: the deep dive everyone. We have a really fascinating stack
- 0:49Speaker 1: of materials to explore today.
- 0:51Speaker 2: Yeah, a real mix of stuff, right.
- 0:53Speaker 1: We've got raw technical notes, network architecture diagrams, and some
- 0:57Speaker 1: pretty infamous cybersecurity case studies, and our mission here is
- 1:01Speaker 1: to take these highly technical logs and you know, translate
- 1:05Speaker 1: them so we can get inside the incredibly lateral mind
- 1:08Speaker 1: of a hacker.
- 1:09Speaker 2: It's all about how they think exactly.
- 1:11Speaker 1: We're going to look to two distinct methods of attack. First,
- 1:14Speaker 1: how they manipulate the language a server expects so they
- 1:17Speaker 1: can sneak malicious commands past the defenses. And second, how
- 1:20Speaker 1: they can actually weaponize the helpful features built into your
- 1:24Speaker 1: own web browser.
- 1:25Speaker 2: The overarching theme you'll notice in these case studies, and
- 1:27Speaker 2: it's a fundamental truth in digital security, is that in
- 1:31Speaker 2: any complex system, a feature and a flaw are often
- 1:34Speaker 2: the exact same thing, right. It depends entirely on who
- 1:37Speaker 2: is interacting with that system, and you know what their
- 1:40Speaker 2: ultimate intentions are.
- 1:41Speaker 1: So true, let's start with the server side of things.
- 1:43Speaker 1: Our technical notes walk through a pretty devastating concept called
- 1:46Speaker 1: remote command execution or RCEE.
- 1:49Speaker 2: Ah yes, RCEE yeah.
- 1:51Speaker 1: And for anyone who might need a quick refresher on
- 1:53Speaker 1: the stakes here, ORCEE is essentially the worst case scenario
- 1:57Speaker 1: for a developer.
- 1:58Speaker 2: It really is the nightmare scenario.
- 2:00Speaker 1: Right, because it happens when an application takes user input
- 2:03Speaker 1: like a search bar, or maybe an IP address testing
- 2:06Speaker 1: tool and accidentally passes that input straight to the server's
- 2:10Speaker 1: underlying operating system terminal to run as a command.
- 2:13Speaker 2: It's basically the equivalent of handing a total stranger the
- 2:16Speaker 2: master keys to the building and saying, hey, feel free
- 2:19Speaker 2: to look around.
- 2:19Speaker 1: Yeah, make yourself at home.
- 2:21Speaker 2: Exactly, because the terminal is the bare metal of the machine.
- 2:24Speaker 2: I mean, if an attacker can execute commands there, they
- 2:27Speaker 2: can read sensitive files, they can delete entire databases, or
- 2:30Speaker 2: even download brand new malicious software right onto.
- 2:34Speaker 1: Your server, which is terrifying. Yeah, and developers obviously know
- 2:38Speaker 1: this is a massive risk, right, so they build defenses
- 2:40Speaker 1: they try to yeah, right, And in the first scenario
- 2:43Speaker 1: we're analyzing today, the developers implemented a specific filter to
- 2:47Speaker 1: stop attackers from cheating commands together. Because in a Linux terminal,
- 2:51Speaker 1: if you want to run multiple commands back to back,
- 2:54Speaker 1: you typically use a semi colon. Right, you run command A,
- 2:57Speaker 1: you tag a semi colon, and then your own command B.
- 3:01Speaker 2: Yeah. The semicolon basically acts as a structural delimiter. It
- 3:04Speaker 2: tells the operating system, you know, stop reading the first
- 3:08Speaker 2: thought and prepare for a brand new instruction.
- 3:11Speaker 1: Okay, So to stop an attacker from adding their own
- 3:13Speaker 1: malicious instructions, the developer writes a script that inspects all
- 3:17Speaker 1: user input, and if the script spots a semicolon, it
- 3:21Speaker 1: immediately rejects the request. It just drops it, exactly. It
- 3:25Speaker 1: flags it as a detected RCE attack. Now, let's think
- 3:29Speaker 1: about this mechanically. If the defense mechanism is, say, an
- 3:32Speaker 1: automated mail sorting machine.
- 3:34Speaker 2: Right, okay, I like this analogy.
- 3:36Speaker 1: Thanks, So the machine is programmed to instantly incinerate any
- 3:40Speaker 1: envelope that has a red semi colon stamped on it. Right,
- 3:43Speaker 1: how does an attacker get their package through? I mean,
- 3:45Speaker 1: the machine knows exactly what to look for.
- 3:47Speaker 2: Well, you simply use a different color of ink. Oh, yeah,
- 3:50Speaker 2: you use one. The machine hasn't been programmed to detack.
- 3:52Speaker 2: The attacker realizes that, hey, the semicolon is not the
- 3:56Speaker 2: only way to chain commands together in a terminal right,
- 3:58Speaker 2: of course, programming language which as an operating systems, they
- 4:01Speaker 2: rely really heavily on logical operator. Specifically, you can use
- 4:05Speaker 2: the A and D operator, which is represented by two
- 4:08Speaker 2: ampersands side by side.
- 4:09Speaker 1: So just an a day exactly, So, the attacker takes
- 4:13Speaker 1: their payload, they swap out the semicolon for two ampersands,
- 4:16Speaker 1: and they just send it on its way. Yep, And
- 4:18Speaker 1: the mail sorting machine is scanning specifically for semicolons, sees
- 4:23Speaker 1: nothing that ampersands, assumes the package is harmless and just
- 4:27Speaker 1: passes it through to the operating system.
- 4:29Speaker 2: That is the theory, Yes, but our notes actually highlight
- 4:33Speaker 2: a really fascinating technical hurdle that the attacker runs into
- 4:36Speaker 2: at this exact step.
- 4:38Speaker 1: Wait, there's a hurdle.
- 4:39Speaker 2: Yeah. If the attacker simply types those two ampersands into
- 4:43Speaker 2: a web request. So for example, if they type anadel's
- 4:46Speaker 2: to list the files on the server, the attack actually fails.
- 4:50Speaker 2: Really yeah, the underlying server never executes the second command.
- 4:53Speaker 1: Wait, why would it fail if the mail sorting machine
- 4:55Speaker 1: didn't catch the amber sands. What's stopping the command from running?
- 4:59Speaker 2: So to understand the failure, we really have to look
- 5:01Speaker 2: at the entire journey of a web request. We have
- 5:04Speaker 2: to look at the HTTP protocol itself. When you send
- 5:07Speaker 2: data in a web address, you are interacting with a
- 5:11Speaker 2: web server, you know, software like apatche or ninchinks before
- 5:14Speaker 2: you ever interact with the actual application code. That the
- 5:18Speaker 2: developer wrote.
- 5:18Speaker 1: Ah, right, there's a middleman.
- 5:20Speaker 2: Exactly, and to that web server, certain characters have structural
- 5:24Speaker 2: special meanings, like the ampersan. Precisely, in a URL, the
- 5:28Speaker 2: ampersan is the designated character for separating different data parameter.
- 5:32Speaker 1: Oh right, Like if you fill out a form online.
- 5:34Speaker 2: Exactly, the URL might look something like name John in
- 5:38Speaker 2: age thirty. The web server sees that ampersan and uses
- 5:42Speaker 2: it to just chop the data into neat little variables
- 5:44Speaker 2: for the application to use.
- 5:45Speaker 1: Oh wow, okay, I see the problem. Now, the web
- 5:48Speaker 1: server is basically intercepting the attacker's weapon by accident. Yep, yeah,
- 5:51Speaker 1: the attacker tax areas that the webserver thinks, Ah, here's
- 5:54Speaker 1: a new data parameter. Yeah, so it just choose up
- 5:56Speaker 1: the ampersands during its own parsing process, which means the
- 5:59Speaker 1: mali which his command never actually reaches the terminal in
- 6:02Speaker 1: the right format. Right, the server inadvertently saves itself, It
- 6:06Speaker 1: really does.
- 6:07Speaker 2: But you know, attackers are nothing if not adaptable.
- 6:09Speaker 1: Oh I'm sure.
- 6:10Speaker 2: Yeah, So to get around the webserver's helpful parsing, the
- 6:13Speaker 2: attacker uses a technique called URL encoding. Okay, they need
- 6:18Speaker 2: to essentially disguise the ampersands, so the webserver ignores them,
- 6:22Speaker 2: but the underlying application still receives them.
- 6:25Speaker 1: How does that disguise work? Is it essentially like invisible ink.
- 6:29Speaker 2: It's more of a translation process. In URL encoding, you
- 6:33Speaker 2: convert special characters into a format that the webserver just
- 6:36Speaker 2: treats as raw harmless texts.
- 6:39Speaker 1: Okay.
- 6:39Speaker 2: The standard way to do this is by taking the
- 6:42Speaker 2: character's ask y value and converting it into hext decimal,
- 6:45Speaker 2: and you put a percent sign in front of it.
- 6:46Speaker 1: Got it.
- 6:47Speaker 2: So the hexedesimal code for an ampersand is twenty six.
- 6:50Speaker 2: So the attacker converts their ending into percent twenty six
- 6:53Speaker 2: percent twenty six.
- 6:54Speaker 1: Okay, let me trace the path of this attack. Then,
- 6:56Speaker 1: just to make sure I have it, the attacker types
- 6:58Speaker 1: twenty six percent twenty six, and then they're malicious command.
- 7:01Speaker 1: The webserver looks at the request, sees the percent science
- 7:04Speaker 1: and thinks, oh, this is just raw text. I don't
- 7:06Speaker 1: need to parse this for parameters, so it passes the
- 7:09Speaker 1: raw text to the back end application. The back end application,
- 7:13Speaker 1: knowing it just received a web request, decodes it back
- 7:16Speaker 1: into its original form, which is in in an or
- 7:19Speaker 1: spot on. Then the application security filter checks it. The
- 7:24Speaker 1: filter says, I am only looking for Semicolon's I don't
- 7:27Speaker 1: see any here. Finally, the payload hits the terminal the
- 7:30Speaker 1: en and tells the operating system to run the attackers code,
- 7:33Speaker 1: and bam, the system is compromised.
- 7:35Speaker 2: It's a perfect chain of events. They completely bypass the
- 7:38Speaker 2: developer's block list just by understanding the sequence of how
- 7:41Speaker 2: data is handled across different layers.
- 7:43Speaker 1: That is such a brilliant piece of lateral thinking. But
- 7:46Speaker 1: looking further into the logs here, there's another logical operator
- 7:49Speaker 1: use that seems completely counterintuitive to me. Which one the
- 7:52Speaker 1: ORR condition? Yeah, you know, represented by those two vertical
- 7:55Speaker 1: pipe characters. Oh right, I'm looking at a log where
- 7:59Speaker 1: an attacker uses the ORE operator, but they deliberately feed
- 8:02Speaker 1: the application of broken invalid IP address first. Yes, if
- 8:07Speaker 1: your goal is to quietly run a malicious script, why
- 8:10Speaker 1: would you intentionally start by asking the server to ping
- 8:13Speaker 1: a garbage address and throw an error. Doesn't crashing a
- 8:16Speaker 1: process just draw unnecessary attention.
- 8:19Speaker 2: It totally seems counterproductive, I know, yeah, but it relies
- 8:22Speaker 2: on a really elegant concept called short circuit evaluation.
- 8:26Speaker 1: Short circuit evaluation.
- 8:28Speaker 2: Yeah, it all comes down to how computers handle logical efficiency.
- 8:32Speaker 2: If I ask a computer to evaluate the statement do
- 8:35Speaker 2: task A or do task B, the computer wants to
- 8:39Speaker 2: do the absolute least amount of work possible to fulfill
- 8:42Speaker 2: that statement.
- 8:43Speaker 1: Okay, so if task A succeeds.
- 8:45Speaker 2: If task A succeeds, the entire r R condition is
- 8:48Speaker 2: already satisfied.
- 8:49Speaker 1: Oh, I see right.
- 8:50Speaker 2: The computer says, great, the first thing works, so I
- 8:52Speaker 2: don't even need to bother looking at the second thing.
- 8:53Speaker 2: At short circuits, it stops processing immediately.
- 8:56Speaker 1: Wow. Okay. So if the attacker chains a malicious command
- 8:59Speaker 1: using or and the first legitimate command works perfectly fine,
- 9:03Speaker 1: the malicious command never even gets looked at. The computer
- 9:06Speaker 1: just skips it entirely.
- 9:08Speaker 2: Precisely, for the second half of an ore statement to run,
- 9:11Speaker 2: the first half absolutely must fail. The computer has to say, well,
- 9:15Speaker 2: task A failed, therefore I am forced to attempt tasks
- 9:18Speaker 2: B to satisfy the.
- 9:19Speaker 1: Condition that explains the garbage IP address. Yes, the attacker
- 9:23Speaker 1: is intentionally forcing the application to fail. They ask the
- 9:27Speaker 1: ping tool to connect to a domain that doesn't exist.
- 9:31Speaker 1: The ping fails, the system throws an internal error, and
- 9:34Speaker 1: because it's an r statement. The computer logically moves on
- 9:37Speaker 1: and executes the hidden malicious payload.
- 9:39Speaker 2: We call it weaponized failure.
- 9:42Speaker 1: Weaponized failure, I love that.
- 9:43Speaker 2: Yeah, the attacker understands the CPU's desire for efficiency better
- 9:47Speaker 2: than the developer did, and they turn that efficiency into
- 9:50Speaker 2: a trigger mechanism.
- 9:51Speaker 1: That completely flips the script on how you think about
- 9:54Speaker 1: defending a system. I mean, we've spent this entire time
- 9:56Speaker 1: dissecting how an attacker slips past a server's security filters.
- 10:00Speaker 1: But let's look at a totally different avenue of attack
- 10:02Speaker 1: from our case studies. What if the server is bulletproof.
- 10:05Speaker 1: Let's say the developer build a perfect filter, no semicolons,
- 10:09Speaker 1: no amper sands, no vertical pipes. The server is locked
- 10:13Speaker 1: down tight a rare thing.
- 10:14Speaker 2: But let's imagine.
- 10:15Speaker 1: Right, Well, our notes show that attackers simply pivot their
- 10:19Speaker 1: focus to the other end of the connection, the user's
- 10:22Speaker 1: web browser.
- 10:22Speaker 2: Yes, this is where we get into the mechanics of
- 10:24Speaker 2: Jason hijacking. Right if, bypassing the RCE filter was finding
- 10:28Speaker 2: a clever way to pick a really complex lock, Jason
- 10:32Speaker 2: hijacking is an entirely different philosophy. It's figuring out a
- 10:36Speaker 2: way to trick the homeowner into willingly walking outside and
- 10:39Speaker 2: handing you their most valuable possession.
- 10:41Speaker 1: Yeah, okay, let's lay the groundwork for this starting with
- 10:44Speaker 1: JASON itself. Yeah, because it shows up constantly in these
- 10:47Speaker 1: technical notes. What exactly is it structurally?
- 10:49Speaker 2: So, JASON stands for JavaScript Object Notation, and you can
- 10:53Speaker 2: think of it as the universal language for moving data
- 10:55Speaker 2: around the web. When a server needs to send information
- 10:58Speaker 2: to your browser. It doesn't send a messy, complex database file.
- 11:03Speaker 2: It packages the information up in JSON.
- 11:06Speaker 1: And what does that look like structurally?
- 11:08Speaker 2: It's just simple text organized into key value pairs.
- 11:12Speaker 1: Key value pairs.
- 11:13Speaker 2: Yeah. For example, the key might be username and the
- 11:16Speaker 2: value is admin. The key is account balance and the
- 11:20Speaker 2: value is five thousand. It's incredibly lightweight, which is why
- 11:24Speaker 2: it completely replaced older, bulkier formats like XML.
- 11:28Speaker 1: Okay, so it's really just a structured list of data
- 11:30Speaker 1: being passed back and forth exactly now to scal that data.
- 11:33Speaker 1: Our case studies link JSON hijacking to a broader vulnerability
- 11:37Speaker 1: called CSRF, or cross site request forgery. Right, and this
- 11:41Speaker 1: revolves around cookies.
- 11:42Speaker 2: Right, Yes, it centers on the fundamental problem of the
- 11:45Speaker 2: HTTP protocol, which is basically amnesia amnesia. Yeah, HTTP is
- 11:51Speaker 2: a stateless protocol. It has no memory of what just happened.
- 11:54Speaker 2: If you log into your bank account and then click
- 11:56Speaker 2: a link to view your profile, the banks server technically
- 12:00Speaker 2: has no idea who you are on that second click.
- 12:03Speaker 1: Wow. So without a workaround, you'd have to type your
- 12:06Speaker 1: password on every single page.
- 12:07Speaker 2: You visit, which would be miserable.
- 12:09Speaker 1: Yeah, nobody wants to do that.
- 12:10Speaker 2: So the workaround they invented is the session cookie. Ah. Okay,
- 12:13Speaker 2: When you log in successfully, the bank hands your browser
- 12:17Speaker 2: a tiny file a session cookie. Think of it like
- 12:22Speaker 2: a vip RFID wristband at a club.
- 12:25Speaker 1: Okay, I can picture that.
- 12:26Speaker 2: Once you have it on, every time you walk up
- 12:28Speaker 2: to a restricted door inside the club, a sensor automatically
- 12:32Speaker 2: scans your wristband and opens the door. You don't have
- 12:34Speaker 2: to pull out your ID again, right. Your browser is
- 12:37Speaker 2: programmed to automatically attach that cookie to any future request
- 12:40Speaker 2: you make to the bank.
- 12:41Speaker 1: I love that wristband metaphor because it highlights the vulnerability perfectly.
- 12:45Speaker 1: The automatic sensor doesn't care why my arm is near
- 12:48Speaker 1: the door. Yep, it just reads the wristband. Yeah. So
- 12:50Speaker 1: In a CSRF attack, an attacker builds a malicious website,
- 12:54Speaker 1: and if I am logged into my bank in one
- 12:56Speaker 1: tab and I open a new tab and visit the
- 12:59Speaker 1: attacker's website, the attacker can hide a script that says, hey, browser,
- 13:02Speaker 1: send a request to the bank to transfer money exactly,
- 13:05Speaker 1: And my browser reaches out to the bank, and because
- 13:08Speaker 1: it's designed to be helpful, it automatically waves my VIP
- 13:11Speaker 1: wristband at the censor.
- 13:12Speaker 2: It sure does.
- 13:13Speaker 1: The bank sees the valid cookie, assumes I wanted to
- 13:16Speaker 1: transfer the money, and executes the command.
- 13:19Speaker 2: The browser's automatic helpful nature is the exact mechanism being
- 13:23Speaker 2: exploited there.
- 13:24Speaker 1: But here is where the mechanics kind of lose me. Okay,
- 13:27Speaker 1: I completely understand how an attacker's website could force my
- 13:32Speaker 1: browser to send a command like transferring money, right, But
- 13:35Speaker 1: Jason hijacking is about stealing data. It's about pulling information
- 13:40Speaker 1: from the bank and reading.
- 13:41Speaker 2: It, yes, pulling it back.
- 13:43Speaker 1: So if I have my Chase Bank account open in
- 13:46Speaker 1: one tab and a sketchy recipe blog open in a
- 13:48Speaker 1: second tab, why would my browser ever allow the recipe
- 13:52Speaker 1: blog to reach over grab the Jason data from my
- 13:54Speaker 1: bank tab and read it. Doesn't the browser have strict
- 13:57Speaker 1: walls up to prevent exactly that kind of cross amination.
- 14:00Speaker 2: It absolutely does. What you're describing is called the same
- 14:03Speaker 2: Origin policy or SOP SOP. It is the absolute bedrock
- 14:07Speaker 2: of web security. It strictly dictates that a script running
- 14:10Speaker 2: on site A cannot read data from site B.
- 14:12Speaker 1: Right, that makes sense.
- 14:13Speaker 2: It is an impenetrable wall designed specifically to keep your
- 14:16Speaker 2: bank tab totally isolated from your recipe blog tab.
- 14:19Speaker 1: Okay, but if the wall is impenetrable, how does the
- 14:22Speaker 1: attacker pull the Jason data?
- 14:24Speaker 2: Because the architects of the web deliberately poked a massive
- 14:27Speaker 2: hole in that wall.
- 14:28Speaker 1: Wait, really, why would they do that.
- 14:30Speaker 2: Well, to build a fast modern Internet, developers realized they
- 14:34Speaker 2: needed to share resources. They didn't want to host every
- 14:37Speaker 2: single font, image or code library on their own servers.
- 14:41Speaker 1: Oh, that would be incredibly slow, right.
- 14:43Speaker 2: They wanted to pull resources from centralized content delivery networks
- 14:47Speaker 2: or CDNs. So they created an exception to the same
- 14:51Speaker 2: Origin policy, and that exception is the HTML script tag.
- 14:55Speaker 1: The script tag is allowed to cross the boundary just
- 14:57Speaker 1: like that.
- 14:58Speaker 2: It is entirely exempt. The script is designed specifically to
- 15:01Speaker 2: reach out across the internet, grab an external file from
- 15:04Speaker 2: a completely different domain, and execute it locally inside your
- 15:08Speaker 2: current web page.
- 15:09Speaker 1: That seems like an enormous blind spot.
- 15:11Speaker 2: It is a very powerful feature that comes with enormous risks.
- 15:15Speaker 1: Okay, let's put all these pieces together and walk step
- 15:18Speaker 1: by step through the case study of the heist itself.
- 15:20Speaker 1: Let's really visualize.
- 15:21Speaker 2: This, Okay, let's do it.
- 15:23Speaker 1: Let's say I am the victim. I log into a
- 15:25Speaker 1: secure web application. I type my username and password. The
- 15:28Speaker 1: server validates me and hands my browser a session cookie
- 15:31Speaker 1: that says log it in troue.
- 15:33Speaker 2: So you have your VIP wristband.
- 15:35Speaker 1: I have my VIP risk band, and because I have
- 15:38Speaker 1: that riskband, I have access to a hidden endpoint on
- 15:41Speaker 1: the server. We'll call it secret.
- 15:42Speaker 2: Okay.
- 15:43Speaker 1: If I navigate to that endpoint, the server reads my
- 15:45Speaker 1: cookie and sends back a JSON file containing a key
- 15:48Speaker 1: value pair. Let's say the key is super secret token
- 15:52Speaker 1: and the value is thirteen thirty seven.
- 15:54Speaker 2: Nice.
- 15:55Speaker 1: If an unauthenticated user tries to visit that endpoint, the server.
- 15:58Speaker 2: Just rejects them exactly because they don't have the wristband.
- 16:01Speaker 1: Right now, I am the attacker, I want that thirteen
- 16:03Speaker 1: thirty seven token, but I don't have the password, So
- 16:06Speaker 1: I build a trap. I create a malicious web page
- 16:09Speaker 1: and host it on my own server. Inside the code
- 16:11Speaker 1: of my page, I drop an HTML script tag, but
- 16:14Speaker 1: instead of pointing it to a normal code library, I
- 16:17Speaker 1: set the source URL to point directly at the victim's
- 16:20Speaker 1: secret endpoint.
- 16:20Speaker 2: Okay, the trap is set.
- 16:22Speaker 1: Then I trick the logged in victim into visiting my
- 16:25Speaker 1: trap page.
- 16:25Speaker 2: What happens next, So the victim clicks the link, their
- 16:29Speaker 2: browser begins rendering your malicious page. It hits the script
- 16:33Speaker 2: tag and says, oh, I need to fetch an external
- 16:35Speaker 2: resource from the secret URL.
- 16:37Speaker 1: Right.
- 16:37Speaker 2: It makes the request, and because the victim still has
- 16:40Speaker 2: an active session with the secure application.
- 16:43Speaker 1: The browser automatically weighs the VIP wristband.
- 16:46Speaker 2: It sure does.
- 16:46Speaker 1: It attaches the logged in true cookie to the request
- 16:50Speaker 1: completely bypassing those servers authentication checksp The server sees the
- 16:54Speaker 1: valid cookie and happily hands over the JSON file containing
- 16:58Speaker 1: the thirteen thirty seven tote.
- 17:00Speaker 2: The data crosses the Internet and arrives right at your
- 17:03Speaker 2: malicious web page. But here the attacker faces a major
- 17:06Speaker 2: JavaScript hurdle.
- 17:07Speaker 1: Another hurdle.
- 17:07Speaker 2: Yeah, the script tag pulled the data in, right, But
- 17:11Speaker 2: Jason is just a text file. It is a list
- 17:13Speaker 2: of data, not executable code.
- 17:15Speaker 1: Right, It's just key value pairs.
- 17:16Speaker 2: Exactly. When the browser looks at the Jason, it realizes
- 17:19Speaker 2: there are no functions to run. It simply evaluates the data, shrugs,
- 17:23Speaker 2: and discards it.
- 17:24Speaker 1: Wait, it just throws it away.
- 17:26Speaker 2: Yeah, the token is sitting right there, but the attacker's
- 17:29Speaker 2: page can actually extract it or read it.
- 17:31Speaker 1: That is maddening. The vault door is open, the gold
- 17:34Speaker 1: is on the table, but you can't touch it exactly,
- 17:37Speaker 1: So how does the attacker solve this? Our notes point
- 17:40Speaker 1: to a very specific, obscure JavaScript property called object dot
- 17:45Speaker 1: prototype dot defined setter.
- 17:47Speaker 2: Ah, yes, the setter.
- 17:49Speaker 1: What exactly is a setter and how does it let
- 17:51Speaker 1: the attacker grab the data?
- 17:53Speaker 2: To understand a setter, we have to look under the
- 17:55Speaker 2: hood at how JavaScript manages data. JavaScript uses a prototype
- 17:59Speaker 2: based structure. Sure, you can think of it like a
- 18:01Speaker 2: massive inherited dictionary, the dictionary. Okay, When the browser receives
- 18:06Speaker 2: that Jason response, it wants to process it by creating
- 18:09Speaker 2: new entries in its internal dictionary. It wants to create
- 18:12Speaker 2: an entry for super secret token and assign it the
- 18:15Speaker 2: definition of thirteen thirty seven.
- 18:17Speaker 1: Okay, that makes perfect sense for data organization right now.
- 18:19Speaker 2: A setter is a special function that acts like an
- 18:22Speaker 2: alarm bell. It triggers automatically whenever a specific property is
- 18:25Speaker 2: assigned of value. What makes object prototype dot defined setter
- 18:30Speaker 2: so devastating is that it targets the absolute root level
- 18:33Speaker 2: of that dictionary. It allows a developer or an attacker
- 18:37Speaker 2: to override the default behavior of the entire JavaScript environment
- 18:41Speaker 2: for a specific word, infecting every single object created after
- 18:45Speaker 2: that point.
- 18:45Speaker 1: Wow, let me try to translate this wiretab go for it.
- 18:49Speaker 1: If I am the attacker, I embed this setter into
- 18:51Speaker 1: my malicious page before the script tag even fires, I'm
- 18:55Speaker 1: essentially whispering to the victim's browser. Hey, listen carefully. In
- 18:59Speaker 1: a moment, you're going to see a dictionary entry named
- 19:02Speaker 1: super secret token being created. When you see that exact phrase,
- 19:05Speaker 1: do not just quietly store the data in memory? Yes, Instead,
- 19:09Speaker 1: ring the alarm bell and immediately run this custom piece
- 19:12Speaker 1: of JavaScript code I wrote for you.
- 19:14Speaker 2: That is exactly it. You've completely hijacked the fundamental data
- 19:17Speaker 2: processing mechanism of the browser itself.
- 19:19Speaker 1: That is wild. Let's run the climax of this heist.
- 19:22Speaker 1: Then the data arrives in the server. The browser sees
- 19:24Speaker 1: the JSON and attempts to create the property supersecret token
- 19:28Speaker 1: and assign it the value thirteen thirty seven.
- 19:30Speaker 2: But the browser's dictionary has been compromised, right the overridden
- 19:34Speaker 2: center intercepts that exact moment of assignment. Instead of just
- 19:37Speaker 2: storing the data, your custom JavaScript code triggers grabbing the
- 19:42Speaker 2: thirteen thirty seven value in real time.
- 19:45Speaker 1: Okay, so I have the token in the browser's memory.
- 19:49Speaker 1: How do I get it out of the victim's machine
- 19:50Speaker 1: and back to my own server.
- 19:52Speaker 2: You use a background data fetch. Your custom code essentially
- 19:55Speaker 2: initiates a silent whisper from the victim's browser back to
- 19:59Speaker 2: the attack server, passing along the stolen token as a.
- 20:03Speaker 1: URL parameter, and the victim sees what.
- 20:06Speaker 2: To the victim, absolutely nothing happens, nothing at all. Nope,
- 20:09Speaker 2: their web page doesn't reload, the screen doesn't flicker, there's
- 20:13Speaker 2: no loading spinner. They might just be reading an article
- 20:15Speaker 2: on your trap site, but in the background, their highly
- 20:18Speaker 2: sensitive token has just been quietly slipped out the back door.
- 20:22Speaker 1: The heist is flawless. I mean, the server has no
- 20:24Speaker 1: idea It was robbed because it saw a valid cookie
- 20:27Speaker 1: and thought the legitimate user was just requesting their own data, right,
- 20:30Speaker 1: And the user has no idea they were robbed because
- 20:32Speaker 1: their screen ever changed.
- 20:34Speaker 2: It is a stunning exploitation of trust. Now, for the
- 20:37Speaker 2: sake of accuracy, I do need to provide some historical
- 20:40Speaker 2: context here. Sure, this specific flavor of Jason hijacking, you know,
- 20:44Speaker 2: using the defined setter method, it relied heavily on architectural
- 20:48Speaker 2: quirks in older web browsers. It was famously effective in
- 20:52Speaker 2: browsers like Firefox three.
- 20:53Speaker 1: Okay it's a bit older.
- 20:55Speaker 2: Yeah, modern browsers have evolved. They patched this specific mechanism
- 20:59Speaker 2: by strictly enforcing how top level Jason arrays are parsed
- 21:03Speaker 2: in external scripts, basically breaking the execution chain before the
- 21:07Speaker 2: setter can even fire.
- 21:08Speaker 1: So if I try to write this exact wiretap today,
- 21:11Speaker 1: a modern browser will block it.
- 21:12Speaker 2: Most likely, Yes, But the underlying lesson remains profoundly relevant
- 21:17Speaker 2: to anyone studying technology.
- 21:18Speaker 1: Today because the core issue is still there exactly.
- 21:21Speaker 2: The patch fixed the symptom, but the architectural flaw the
- 21:25Speaker 2: danger of mixed contexts remains. This KIG study perfectly illustrates
- 21:29Speaker 2: what happens when legacy browser behaviors like automatically waving session
- 21:33Speaker 2: cookies and allowing script tags to completely bypass security walls
- 21:37Speaker 2: collide with modern web APIs that handle highly sensitive data.
- 21:41Speaker 2: The specific lines of code will change, but the philosophy
- 21:44Speaker 2: of weaponizing a browser's convenience features is timeless.
- 21:47Speaker 1: It really changes how you view the entire ecosystem. True
- 21:51Speaker 1: security clearly requires thinking like an attacker across the entire
- 21:55Speaker 1: technology stack.
- 21:56Speaker 2: It really does.
- 21:57Speaker 1: A secure server back end means absolutely no, not if
- 22:00Speaker 1: the client's browser is leaving the window wide open. On
- 22:03Speaker 1: the front end. It's all deeply connected. So to reinforce
- 22:07Speaker 1: the mechanics we've unpacked today, I want to pose a
- 22:08Speaker 1: direct challenge to you, the listener. Let's look back at
- 22:12Speaker 1: the RCE bypass. In the first half of our deep dive,
- 22:15Speaker 1: we saw how an attacker used URL encoding to slip
- 22:18Speaker 1: logical operators past a filter looking for semicolons.
- 22:21Speaker 2: Yep, right.
- 22:23Speaker 1: So, if you are a developer tasked with defending that server,
- 22:26Speaker 1: what is a fundamentally safer way to handle user input
- 22:30Speaker 1: than trying to build a filter that blocks bad characters.
- 22:32Speaker 1: Think about it logically. Instead of trying to guess and
- 22:35Speaker 1: block every single malicious input, an attacker might creatively invent.
- 22:39Speaker 1: What if your system only allowed very specific, pre approved
- 22:42Speaker 1: commands and instantly rejected absolutely everything else.
- 22:46Speaker 2: That paradigm shift, moving from blocklisting known threats to allow
- 22:51Speaker 2: listing only trusted inputs is the absolute cornerstone of modern
- 22:55Speaker 2: defensive programming.
- 22:56Speaker 1: It changes the game entirely.
- 22:58Speaker 2: It does, and to leave you with one final lingering
- 23:01Speaker 2: idea to moll over. In our second case study, we
- 23:04Speaker 2: saw how the HTML's script tag was turned into a weapon.
- 23:07Speaker 2: Simply because early web architects wanted to make loading external
- 23:11Speaker 2: fonts and libraries convenient for developers.
- 23:13Speaker 1: A feature became a massive vulnerability exactly so.
- 23:17Speaker 2: It makes you wonder, as you use the Internet today,
- 23:19Speaker 2: what other helpful features build deep into the architecture of
- 23:22Speaker 2: the browser you're using right now, are just waiting for
- 23:25Speaker 2: a creative hacker to exploit them.
- 23:27Speaker 1: Just because the front door has a heavy dead bolt
- 23:29Speaker 1: doesn't mean someone isn't already inside, enjoying the breeze from
- 23:33Speaker 1: an open window. Thanks for joining us on this deep
- 23:36Speaker 1: dive