Am I doing my thing now? Yes? Wow. It's an R&B in here. Hi, my name is Stök. Oh, no. Hi, my name is Fredrik Alexandersson, but most people actually know me more by my hackle hand as Stök. And I'm going to welcome all of you to my talk, Weaponizing Plain Text, Unseen Escape Sequences as a Forensic Nightmare. And leading up to this talk, I was kind of told that you need to have this table of content that explains things that are going to happen, because otherwise people get bored and really sad. But I figured that we got 281 slides to go through, so screw that other thing and just head straight into it. Thank you. So, I spent a good time of digging into this vulnerability class CB150 that's been dormant for the last two decades or so. And that was real fun, and that's what this talk is all about. But I used to travel the world to all these live hacking events and create educational videos on YouTube. But nowadays I fight cybercrime over at TruSec, and I also do shitloads of incident response. So, I realized that I'm really passionate about getting log files, because that's kind of the whole part of creating a good timeline. So, I figured that maybe I'm the only one, maybe some other people like log files, too. So, I went on the application formerly known as Twitter and asked, are log files important? And I got a bunch of really good answers coming back. And the short answer is kind of like, yes. Log files are important, because logs are a vital component for maintaining application reliability, performance, and security. But it also seems like the common idea is that logs don't lie, people do. And even though your log files might just not lie to you, do you still trust them? And what happens if you don't? Because, imagine this for a second. You are now the incident response lead of Twitter. Of a global logistics corporation. It's four o'clock in the morning, and you're sound asleep in your bed. Dreaming about boats, or maybe containers into Docker and stuff. When you get this rude awakening call from your manager that's pissed because you got breached. And since you are the incident response lead, it's your responsibility to call up all those tired people that work in the incident response team and get those starting with collecting all the logs that you need. And be able to create a timeline. You're a manager, so you don't do grunt work, so you log into your big data app for a thousand. And since you're a professional, you log shipped stuff already. So you export the data, save it into a local file called everything.log. You're happy. But just to verify that you got any data in there, you decided that maybe I should just cat the file and see what's in there. In the beginning, everything looks just great. It contains the things that you wanted. But then suddenly, out of nowhere, boom. You're getting an ad for a restoring service. And they're nice enough to provide you with a calculator so you can do the math for how much it's going to cost you. And that's kind of the situation where you're starting to realize that, shit. And the reason for all this is that it has to do with ANSI escape sequences. And what got me all into this is this CVE here. And I was just going to read this straight out from my monitor because I didn't remember it all. Effective versions of this package are vulnerable to arbitrary code injection. There we are interested, right? This is a possible shell escape sequence injection vulnerability in racks and lint and common logger components. Carefully crafted requests can cause shell escape sequences. To be written to the terminal via racks, lint, middleware, and common logger. Middleware. Okay. These escape sequences can be leveraged to possibly execute commands in the victim's terminal. What do you got here with me? Excuse me, tiny sterk. What do you mean possibly? Either you can or you cannot run arbitrary commands, right? Yeah. Thank you for that, giant sterk. For pitching in and helping out here in the presentation. Well, you're actually right. It depends. But it apparently depends on the terminal that you're using. And there's a shitload of different terminals out there today. And some of them come built into the software that you're using like VS Code and Docker. Then you have like third-party stuff like iTerm, Kitty, and other ones and stuff that people build on their own. Then you have the ones that get shipped within your operational system like Windows Terminal. Terminal.app, GNOME, VTE, and other stuff. And then you've got old stuff like Xterm. So we also got this when we were in the cloud. Maybe you don't know this, but if you're going to try to use like a digital ocean to connect to your droplet or you're going to do some recovery console stuff, that is actually like an Xterm thingy connecting to that over TTY. You were able to interact with it. It's a terminal. And I wasn't really interested in the possibly part. I wanted to execute commands in the victim terminals. But I had no idea where to begin. It sounded cool. So I did everything that every self-respecting researcher do. I googled what ANSI escape codes were. I had no idea. And I quickly realized that people actually like to customize their terminals in the weirdest kind of ways, especially if you're using Arc. And this is the thing that just got me interested. They're like, oh, cool. You can change colors and stuff. But I also realized that in 1978, the Yildstrand boys dropped their banger album, We're Gonna Have Some Fun Tonight. But even though it would release the same year, the VT100 terminal, and connecting that using serial cables to a big VAX system is probably not what those guys thought would be fun to do on a Saturday night. Even though I personally would think that would be kind of cool. But I also realized that ANSI escape sequences are the shit that puts stuff on your terminal that you look at. And it can do stuff like you can move the cursor around. You can remap the keys using these. And you can actually print stuff. Ding. Interesting. But you can also build whole UIs. Like all this UI here is built in ANSI escape codes. Positioning of stuff, colors and output and all that, refreshing, clearing screens. All that is part of something called the control sequences standard. This is the standard for Xterm and it's vast and it's super hard to understand. I know you're all super smart. I wasn't. So I'm going to go through the basics with you. And the first I started looking through the documentation, it said CSI PM character attribute something something. No idea what that meant. But it's this. So all it actually is is printing out something that turns into green. Cool. And the reason why this works is due to this funny thing here called the escape character. That's important to remember. And it's also non-visible escape character. And it comes in many shapes and forms. Because the reason why they didn't print out exactly the command is because it depends if you're using octal, hex, unicode, decimal or ASCII. All of these are the same sequence. There's different kind of ways to portrait it. And I also realized that. Bash likes octal. Python likes hex. Java and JavaScript likes unicode. And PowerShell likes decimal for some reason. And this escape character here is the one that starts the whole sequence. It needs to start with that. Then we have this control sequence introducer which tells the terminal to do shit. Next one is the parameter of the number. So we'll go with 32 which is green here. M is to change whatever continuous output. Turning that into green. Which is the string we have here. And then we're just going to close it off with another escape character. Another control sequence introducer. And this is the important part. Here we do 0, M. And that means we're resetting the terminal back. And then, because if you don't do that, apparently this is going to happen. The rest of your shit is going to be all green. Hulk smash. But we need to terminate this. Using a ST or string terminator or bell character. And if you're like me and you accidentally kind of like grepped something. You know, money say. And then your terminal starts like ding, ding, ding, ding, ding. That is it being interpreted as the bell character. So we got escape secrets that's been shoved in there. So I thought, okay, cool. That's fun. I can put colors on my screen. Fancy. What happens if I put that in something called a bad log and see what happens. And then interact with it. Well, if I'm using vim, it's going to show the exact what the escape character is. It's this one here. And that's cool because it's not rendering. It just shows it. Same for nano. If you're using that, you're cool. And if you're using a browser, instead it's going to show it as Unicode. So that's also interesting to know. It's get interpreted differently depending on the system you're using. But if you kept it. Color's going to get displayed. Grip. Tail. Orchid. The same thing. And even if you curl it, boom. Fun stuff's going to happen. Because all these systems interpret the sequence that renders it. And at this stage when I ran this through curl, I'm like, shit. What just happened? What just happened? And I started thinking, where can I stuff this? Where that would interact with other people's stuff. So I figured. Why not do it in a text record? Because DNS is always the source for all evil. So I put it in there. And I ran Endless Lookup on it on OS X. Nothing happened. And you can see here, the extra slash in front of it means that it's escaped. It's beautifully escaped. This is a real good thing. If you're doing that on Windows, though, it's a different kind of story. So it depends on what kind of OS you're using. And big ups to David for showing that. That was real cool. So I was starting to ask myself, OK, cool. That's fine. But is this even a security issue? Seriously? So this kind of feels like this self XXX thing where you're like, OK, I can put colors on my terminal fun times. I need to figure out, who would this be an issue for? Where would this be an issue? How would this be an issue? And what would be the consequences of this? Well, the where wasn't that hard to figure out. Apparently, since we had the common logger thing, log injection would be the way to go. And who would it affect? I reckon DevOps, sysadmin, IR forensic people, or anyone that interacts with the log files using a terminal. And we can take a quick break here. How many of you have ever catted, grepped, or jq'd a file that you parsed from some other software? I love you. To do this, as the scientists, we are researchers. We're professionals. Log injection vulnerabilities occur according to OWASP when data enters an application from an untrusted source. Yes. The data is written to an application or a system log file. Cool. I needed to adapt that, because this is kind of written to do XSS stuff. So I figured that, OK, to successfully have this as a measurement, I needed to be able to inject new log files or events by forging a log. I needed to be able to inject an escape sequence. And I needed to, in some way or form, make that run in someone's terminal emulator. And I also needed that injection to execute some kind of stuff. And I figured, which would be the best test bench for this, huh? And Docker, obviously. Because it loves to send whatever logs to standard out. It has this real log that's running through. There are actually terminal rendering stuff. And it comes with a really nifty, getting started kind of app. Good stuff. I'll go for that. And also, a way for you, if you want to attach your work with Docker, you would use Docker attach inside a terminal, connect to it. Or Docker logs to do like a tail and see whatever happens inside your container. I'm like, mm-mm, seems tasty enough for me. But I also realized that I couldn't just take this print F thing and stuff it in a browser. Because, hey, shit. I can't do that. No, no, no. So I needed to URL encode it. And for good measure, we added a new line in there. Because everyone knows that if you're triaging some kind of bugs, new lines are very important to show that it's actually able to inject some kind of false log entries. So I figured, let's see what happens if I curl this and you send that straight in. And I was really excited when I realized that, oh, nothing came back. So I started looking at the log. And over here, it's like, oh, ho. Nothing comes in return in the response. But new line has been entered. The color has been rendered inside the log that's being displayed in real time. Which means, like, on the first try, more or less, we checked all the boxes to prove a successful log injection. Because we're injecting new lines, we are enabled to run escape sequences that will be viewed in a terminal emulator. In this case, Docker. And I'm able to inject commands that the terminal emulator could execute. In this case, we're changing the color. Because remember, even though that was the only line that I put in, we can create this. Because it's all about the limitations and creativity of whoever decides to design this. And even though I'm like, fuck yeah, confirmed. The Yildstrand boys weren't that impressed. They wanted me to provide more impact. So I'm like, OK. I can do that. I started, once again, Googling stuff. And then I stumbled upon this great research from 2003 by H.D. Moore. And he found a really, really interesting, cool way to just misuse the terminal and use it against them in a way. So what happens here is that they were able to use something called OSC2 sequence. Where you will actually put this on a command line. And that would change the time. The title of the terminal you're in. And if you're currently using a terminal, you're changing directories and stuff. And it just updates there inside the title. I've seen that. We're connecting to a shell. It's changing it. That is actually the sequence doing that. But that wasn't enough. They digged into the deeper parts of the whole documentation. And realized that in this CSI code here, 21T. You were actually able to report back whatever was put inside the title. And push that to the command line. That could only mean trouble. Because even if this stuff were put on the command line. And in this case, you needed to have a social interaction with the user. The user needs to be fooled into pressing enter. It's still a cool way to just push something in the title. Read it back. And then boom. Shit happens. But that's been fixed for ages. 2003, if you want to feel old, is like two decades ago. So, I started searching some more. And I found this really nice write-up from Evil Alive, Jekyll and ASCII. That did some cool research on all these different web servers back in 2010. Where they're using the same kind of sequence here. But we know that's been fixed. So, can't do much with that. But then in 2022, Evitar Gursey released some sort of code. Sorry for crashing the name. Don't know how to pronounce it. A cool way to create a DOS sequence. When they were able to read a bunch of stuff into the title. And just creating crashes. And I'm just tasting buffer overflows here for the future to come. But that's been fixed too. So, here I am. Feeling like an epic fail. Can't do the arbitrary command injection. That seems so cool that the person talked about in the CBE. So, I did the thing. I think the end is the only thing you do. You reach out to the original poster and ask them. Can I ask the RC Epoch? And the answer back. I didn't write any. I used this paper as a reference. And that sucks because we know that's fixed. So, here I am. Super excited. But oh, I got old stuff. And speaking about old stuff. This is what I looked like in the 80s. No, I'm kidding. I'm probably more like this badass here. And if you look at the angle of the arm here. That's very important. Because it's exactly the same angle as this gentleman here in this band poster. That's pretty fucking darn cool. Because he was one of the first people to sell Diab and Unix computers in Sweden. And not only that. He's my dad. So, I'm very grateful to him to put stuff and give me access to computers at an early age. Thank you. But I'm starting to look at this picture. I'm starting to realize that I'm actually. Maybe I'm looking more like Lasse. That was on the same tour as my dad when he met my mom. Anyway, the standard is vast. And it's deep. And it takes a lot of things to go through. But that wasn't enough for the fine developers and users of terminal jobs today. No. They wanted more. Because all these different terminals have different kind of functionality. And, you know, with more features, we need more stuff. So, they invited something called proprietary escape codes. Which is a local edition of the standard. And it works in certain terminals. Not all of them. Some of them are being shared internally. And some work over the whole bar. And what that does is gives you the opportunity to, you know, make a fun twirly thing. Maybe in your title. Get notifications. And all these other cool stuff that's in there. Maybe even change your background. Fancy stuff. But some thought that it was a great idea to always run some processes with arguments. Why not? Using escape sequences. I mean, that's a really bad idea. But luckily enough, it's rare to find stuff that runs a really bad idea, too, nowadays. Because it's old and it's been fixed. So, I needed to find something that was, like, adapted by everyone. Everybody loved it and trusted it. And they thought it was nice. That we could weaponize. Why not? Because we are tricksy hobbitses. And I found OSC 8. I'm like, cool. If you ever run PowerShell and you mess that up, you'll get this prompt coming back that says, you suck. Click this link and somebody's going to tell you how to do it. I'm like, cool. That seems doable. And the reason why that works is because you have this ANSI escape sequence that gives you the HTTP thing. And then it has the title of whatever you want to print out. And then you close it off and it turns into this link inside your terminal. And that's great. Initially, that was only allowed to use URI like HTTP and HTTPS. But recently, the fine people over at Windows Terminal decided that we should allow file, too. That's even a great idea. Because what could even happen if you typed in CMD there and clicked it? I wonder. Fun things popping inside user space. And even though this is kind of filtered in a way where you can start CMD but you can't use any parameters, I'm willing to guess that some smart person in here is going to figure out how to bypass that, put a link in, and pop shells. It's definitely doable. And the fun thing with OSC 8. Is if you don't terminate it correctly. You remember what we did with the green when it all went hulk everywhere? If we don't terminate it correctly, the rest of the output starting from that injection is going to be one big link. Everything is going to be a link. And if you click that, some terminals will be very nice for you and just block that out with a warning. And I figured out, okay, that's cool. I wonder if I can inject this somewhere. Because obviously me putting links on my own shit would be boring. So what happens if I put that inside Docker? Well, everything is going to turn into one big link there too. And that one has a protection in. But it's not everywhere this turns into a protection. Because injections can be put in different places. And then suddenly you can click links and you can just imagine how fun this could be. But that wasn't enough for people. Because, you know, text is cool. But inline image support? That's definitely something we need in text space. So the Windows terminal people, they decided to adapt the inline support for it in the recent build where you're able to do, you have 6L and inline support inside the terminal. And that's great. I see no problem with that. I think that's great. I just wonder what's going to be inside this log file. So can I get a raise of hands if any of you wants to see what's in that log file? I love you. And it's not what you thought it would be. Shame on you! Then we have OC52, which is great. If you ever used T-marks or anything and back in the days you weren't able to copy-paste between shells, sucked. Now you can. The reason is OC52. And what it does is that it takes this sequence. If you have something base 64 coded, it's going to put that inside user space clipboard. Super sweet. Great. I wonder what happens if we do open a something calculator app and a new line on the end because we need that new line. If you put that into CS Edge and paste it, this is what's going to happen. It requires the users to do something. And you press that, boom, okay, it pops calc. But if you do the same thing in Bash, Bash honors the new line. So if you just paste it straight in there, it fires it directly. There are room for improvement here though. So I figured I wonder how can I test this in different spaces. I did this kind of basic four string with these commands in it and said I'm curious what's going to happen. And I started to paste that in different places. Docker, that fired directly. That was nice. VSCode, it did it differently depending on what kind of shell you're using. And even in some cases gave you this warning, which is super good. Of course, with your own people. Terminal.app honors it. It runs it directly. And even, you know, you will get inside Windows Terminal. You will get even this preview of showing things that are bad. And the reason for that is that if you wanted to run this command, 10 lines, into whom, Windows Terminal is going to be nice of you to show the first lines and tell you, yeah, you've got your shit going on here. So why not just add seven lines of nothing and then see what happens? Well, there's nothing in there. And everybody knows that nobody is going to scroll down. And what happens if you add 400 lines in there? Nobody is ever going to scroll down. Or you can even, in this, add some kind of those EULA things. Then people just press OK. So with that in there, it's going to be OK if you're just running it. I think that's pretty cool. It's a decent thing. So I think, OK, so I have this sort of thing for Windows Terminal. I've got one for Bash. Let's create a polyglot and see what happens. So I figured that why not have a little bit of an SVG in there. You stop that one off with a good old hash mark at the end. Do a curl command, obviously. You want this to run locally and not fuck around on the interwebs. And then we do a PowerShell kind of mix where we're using CMD that calls PowerShell and stuff because they want it to work in whatever kind of environment you end up in. And we want to exfiltrate stuff to know what's happening. So here's the hash that's important. And then eventually this last one here. Encode that into one big basic support thing and just send that to bad log, cat bad log, and then start pasting it in places. Well, it obviously worked there. This removed all the info in the beginning. It's going to pop here, too. And if you go to the browser and you paste that in, you have some JavaScript running, which is great. Then you can just refresh it here, and you'll see that, OK, it's running who am I and then different other kind of stuff in there that's just exfiltrating stuff for you inside the request. And this is just being dormant in some poor bastard's clipboard by just interacting with the file. Because you can sit there and work. You catch something, and then you decide to paste, and then boom, it's on you. It's not limited there. Obviously, you can exfiltrate stuff like sending things out and do reverse shells and all that. I didn't go through that in this demo. You are smart people. You know what to do. But if we're doing this, we might just want to hide our tracks or just mess things up because we can. And there's different ways to do this. You can use everything from just moving the cursor to a certain position. You can clear the screen. You can erase stuff or clear the scroll-up buffer. And to showcase this, I'm just putting like 50 lines here on the screen for you. And then we're just going to run the command, and it's empty. And that's perfect to have a proof of concept myself. But what happens if we run that inside, let's say, this Docker instance and we send in the reset screen and just go back? Well, this is what's going to happen. It empties the log file for you. And every time you load it, all the way up to that's getting rendered. It's going to clean it anyway for you. So you need to sanitize and clean that out. Fun. And that is somewhat annoying. For anyone that's using that, that's really annoying. But it's not annoying enough. We need to do some brick stuff to really be annoying. And why not use the standard? Like we have this print screen functionality. We gave ourselves the opportunity if we're typing that one in, it will send in a printer prompt for you. Imagine getting that every minute or so. It could be annoying. But you can also do this cool thing. Instead of doing the 0i, you can do 5i. Because back in the days, we used to have matrix printers next to our computers that were like, eh, eh, eh, having a paper copy of said log. We don't have those anymore. So we can't send anything out to this buffer that doesn't exist, which means, as you can see here, if you send it in, all the commands are going to send it to Vivian. And it's still going to render, but you can't see shit. So that's really annoying. And the only way to get rid of that is to close the browser. But it's not annoying enough. No, we need to be really annoying. And one way to do that is to use the mouse tracking functionality. It was great. If you ever installed some kind of, I don't know, Slackware or something or whatever, Debian, and you're in that CLI mode and suddenly you realize my mouse works and I can click on stuff, that's cool. That is the reason because somebody is tracking what kind of where your mouse are in that space. And if you run that on the terminal and move your mouse around, it's going to report all that stuff all the time. And if you click, it's going to execute whatever kind of happened there. And what's really interesting when doing this is that imagine you're sneaking some other shit in there and somebody clicks stuff and then it's going to pop it. Fun. And if you combine those, you see where I'm going, a bunch of chains here. You can just combine those things together and just create a lot of interesting stuff. But then I stumbled upon this one here. It looks so sweet. And it's perfect. Repeat the preceding graphic character X amount of times. And that is perfect. You want to measure, like, how big a terminal screen are. And so in this case, let's see that we wanted to repeat this ten times. It's going to do it ten times for us in the output of the terminal. But one simply wonders. A billion times is a lot of fucking piece. And since this is not a single character. This is Unicode. You get five characters for the price of one. And my recommendation to you is to do not run this in prod. Things will break. Like, I can't open this Docker container again without it crashing. And when it crashes, it kills Docker desktops. I need to start it all over again. It can be somewhat annoying. Thank you. So it breaks most terminal. And some terminals, even like the one I have on my phone here, you know, it crashes that one. So it's just, once again, I'm starting to think, like, okay, that's cool. I wonder what happens. What can I do to weaponize this? Maybe if I put it in my service signature on a host. And then request a let's encrypt certificate. I wonder if the bots will come running. I'm betting you there's a bunch of fucking automation scripts that's going to scrape and look for the kind of version I'm running. That's going to get dosed out whenever somebody decides to look at that entry. Real fun. Okay, you got a question, scary-looking kid? No RC? No. I know. I wasn't able to do any kind of arbitrary command injection. Sucks. I got malicious stuff, but not really bad stuff. So these were dark times in the middle of my research. The light came in the shape of David Leadbeater. And his amazing fucking talk, sorry, pardon my French, at Blue Hat 2023 called Houdini in the Terminal, where he doesn't provide just one. No. He brings on six. Six remote code executions in Terminals that are live today. I'm like, mmm, tasty. David knows stuff. And he's doing that, but using kind of the same thing that H.D. Moore back in the days with this CRLF injection. But he's using something called device control request string. I'm not going to try to pronounce that. If you want to check out his Git repo, it's really, really good. He's got a lot of cool stuff there. And he's speaking tomorrow. Here. So please go visit that talk. I'm going to be there. And the Yieldstrand voice is definitely going to be there because he's going to release some banger stuff. And you don't want to miss that. So this is all David's work, but I'm going to show it now because, hey, why not? So I figured that he had this thing provided. I needed to put that in a way that I could infiltrate others. So I basic for this string here. More or less this is kind of what it does. It sends in a bunch of control sequences. I'm not going to bore you with that. But more or less what it does, it asks you what kind of color you have on the screen. But we're feeding that with other stuff instead and then adding new lines and voila, bub, fun stuff. So if you're using version 3.17 of iTerm, which is not the newest one. It's been patched now. And you're interacting with the logs using this docker. What's going to happen if I paste that inside your terminal and you're running that live tail? I'm going to pop tag for you. Why not? Super simple way to just make sure that things break. So update your iTerms, people, if you're playing around with that. And the reason why this is working, and I love this, is simply because what David figured out is that he could sneak in X03 here, which is control C kind of thing or control X. So you're escaping out of whatever thing that's running. And imagine what happens if you're trying to, like, escape out. You're escaping out of a docker attach sequence. It's going to shut down the docker. And after that, we're adding whatever command that we want to run. And then simply, we're going back again and it tells the system, could you please report back for us whatever kind of color that we're running? But we already tainted that with other stuff, so it's just going to boom, which is great. And for me, David was this kind of Mike Metzger moment for me when he did that stuff. Because what Mike did for the motocross circuit was that, just before he did the first backflip in competition, it was, like, rumors and shit, and nobody thought it was even remotely possible. But as soon as he did that, today, if you're not doing, like, a double flip, can-can, woohoo, fucking dang, you suck. So that was kind of the opener. So I started to look at this OSC 5113, which I thought was like, mm, Kitty has this proprietary skill. It has this scape code. I wonder what that does. And what I figured out real fast is that test here reflects back in the flow. So I'm starting to think, what happens if we add a new line and open a bit of Calculate there and send that away? Well, let's see what happens. What's going to happen first is it's going to give you a request. Are you really sure you want to do this? He said, no, but you got a calculator. Because he's adding new lines, and he's honoring them. Time is running out. Thanks, babe. The other one here, and I know you said, yeah, but you pressed no. What happens if you press yes? Well, I figured out it's the same. No escaping here. Yield time, boys. Fuck yeah. I thought that was sweet. So now I'm getting hyped, and I'm all happy about it. And this shows the whole proof of concept. Is it actually possible to add a new line? Execute commands in the victim terminal. And the short answer to this is yes. But whose fault is it? This conversation has been going on for like the last 10, 20 years. Because every 10 years or so, somebody's going to poke around at this stuff. And the terminal developers are going to say, it is the developer's fault. They need to do their shit. The app people say, no, it's the terminal people. They need to stop using escape sequences at all. It's terrible. It's a terrible idea. But we all use them all the time. And then there's the third part. It's these super angry old developers that are sitting in the back. I see you. That thinks that everyone with a brain knows that you can't just cut a file or click on an email link. But that's simply not true. Because we are cybersecurity professionals. Some more malicious ones. And we need to protect our users, especially our shell users. Because they also are privileged users using these systems on a daily basis. And they should be able to grep cat or jq whatever shit that's running inside the terminal without any issues. Especially if they're downloading files from a third party that took care of them. And the only way to do that is that we need to sanitize our input and escape our output. And if we don't do that, it's going to be consequences. And I figured it would be kind of cool. What happens if I took this web page and stuck a bunch of different kind of escape sequences in there and see what happens? So I created this evil.terminalinjection.com site. So if you curl that inside your terminal, any of them, you can see what happens. It's not going to do anything bad stuff for you. It's going to pop a calc if you're vulnerable. But I'm not exfiltrating your data. You can just right click the source and see what's in there. It's cool. And if you run that. On some systems, it's going to be all right. On other systems, when you do it, it's not going to be as such all right. So it's kind of trusted things, but it will break stuff. So if we're doing black box testing on this, the whole game if you're hunting for bugs is going to 400, 500 errors. Because 200 errors usually ends up in access logs. And those are well sanitized and nice and all. So the easiest way to do this, to break stuff, is to take whatever kind of thing you have here. This is an API request. You have a key and some value stuff. And just append shit on the end. And see what happens. Sometimes it will break and you will get some information coming back. And if it does contain something like unescaped stuff, because this one here is a big chance that it actually ended up in the error log. This one here, though, is properly escaped. So it's a good job on the devs. Fuck yeah. But sometimes, you know, you put that stuff in and it's going to sanitize with a backslash. So why not put some invisible characters and hex in there? The results can be really interesting because then it might just render anyway. Because you're bypassing the whole backslash scenario. Okay, this is very prone to false positives. So sometimes the developers are really good at just filtering the kind of output comes out. They're stripping the error message. And they're even not displaying any data. We saw that in the beginning. It was an error, but nothing happened. But it smashed the log. Boom. So even though, you know, you need to take that into consideration. And even though if you see like 400 errors, they're rarely logged. So 500 errors is what you're going to be looking for. But this seems to be everywhere. Everywhere I looked, it just pops and scrambles. And before you create this nuclei template and go all brrrr all over the Internet hoping that it's going to end up in somebody's log somewhere. To verify this, you will need to have access to the access. And just dig into that. Because otherwise it would be a false positive. Because if I wrote the logging system and I didn't log in the output, you can say that it renders, but it's not. So time's running out. Let's recap real fast on this. People forget. The old is the new new. There's way more things that's going to come in this area. And I hope you are intrigued now to start poking in this. And let's create a community around this and see whatever fun stuff we can do. And it's true. It's like everywhere. Like I told you, I created this nuclei template. And when I ran it, it rendered in there. That can be problematic. So if something's like meh today, it can easily turn into oh crap by tomorrow if somebody decides to put a bunch of creativity in it. That means your log files, do you still trust them? I'm at all social media. Thank you for attending my talk.