start	end	text
0	5100	Hey guys, uh, so we're gonna talk about SSH. And this has been probably the most exciting
5100	12200	year in SSH since x2.cd got leaked, x2.cd got leaked by Teso. So, um, uh, props to anyone who
12200	17340	used that. Uh, so, uh, SSH for folks who aren't aware, um, you probably, probably should be
17340	21140	here if you don't know what SSH is, but, um, SSH, secure shell, port 22, the thing we've
21140	25440	been using to admin the internet for many years, like almost 30 years. Um, there's really
25440	29900	two flavors of SSH that we use the most. There's open SSH, which is like 80 something
29900	33880	percent of all SSH installations. And then there's DropBear, which is like another like
33880	38120	five to eight percent. And then this long tail of random weird stuff out there. So we
38120	42360	decided to do some research into first looking into the XC backdoor. And then part of that,
42360	46640	we just accidentally found a couple tens of thousands of shells and we're like, well, let's
46640	49840	go figure out what all these random things, all these free shells were. Uh, and that led
49840	53480	to this giant pile of work and this open source tool. Um, so if you want to play with the
53480	58520	toolkit, you can get it right now. It's this, the shamble.com S S H A M B L E. And that
58520	61640	goes to GitHub and you can go grab the stuff and play with it. And it's a big hot mess, but
61640	65100	we're making it better. And it should be a lot of fun as we start cranking on, make polishing
65100	70940	up, making it cool. Um, so with that, we'll go ahead and get started. Um, fortunately, we're
70940	76960	only doing 67 slides in 45 minutes, not 100. So we had a little breathing room this time. Um,
76960	80800	so I'm sure we're all very much aware of the XCUTLs backdoor. Well, step back a little bit.
80800	84100	So there's, you know, four major events this year in SSH that were really important.
84100	89600	Obviously, XCUTLs backdoor targeted SSH using the system vpatches and Debian and, uh, Red Hat
89600	94700	builds of OpenSH. We also had the really cool Terrapin vulnerability, which affected pretty
94700	99040	much everything because of the truncation attack. Um, we also had, uh, the regression
99040	102960	vulnerabilities, the really fantastic work by the Qualys Threat Research Unit. Um, and then
102960	107220	the other regression bug found by SolarDesigner that only affected Red Hat. And regression
107220	112180	was amazing. It's a signal re-entrance bug that gets you remote route in OpenSH by default.
112180	117140	It just takes six hours on a 32-bit machine or weeks or months on a 64-bit to compromise. So,
117140	120880	but it's been a really cool year. Um, one of my favorite SSH bugs this year kind of flew under
120880	125120	the radar. Um, the guys at Watchtower Labs did a really cool analysis of the move-it
125120	129540	vulnerability that uses the SFTP server. And so they found a vulnerability where any public
129540	133440	key being sent to the service, um, would be treated like a file path. Like the binary
133440	136800	blog gets treated like a file path. And it just opened random UNC URLs and all kinds of fun
136800	140080	stuff. They threaded like a million little needles to be able to get a shell remotely and
140080	143680	boot it. But the really cool thing about that bug is it affected every other vendor also using
143680	148300	IPWorks as the underlying library. So, they actually uncovered like a supply chain bug, if
148300	153100	you will, which is really neat. So, going kind of back on topic again, um, the XEUtils
153100	158980	vulnerability or backdoor was amazing. It was like its own little Netflix docu-series, right?
158980	163720	We're going to see like the true crime of XEUtils for years. But like who is Gia Chan? Like
163720	167600	it's going to, it's the most dramatic thing to happen to InfoSec in a very long time. Um, so
167600	171300	the, this is a multi-year campaign where this person, um, contributed to open source for a long
171300	175540	time, then eventually kind of twisted the knife and tried to backdoor the world. And I got
175540	179900	caught at the very last minute by, uh, Anders Frond, who says, hey, my SSH is taking slightly
179900	183380	too much longer than it should, and then unraveled the whole thing right before it got put
183380	187580	into the stable distributions. So, we got really close to the whole internet being backdoored.
187740	191320	Uh, but what was really important about that backdoor that it was a nobody but us backdoor,
191320	194540	which is normally, you know, normally the US government is famous for those. But in this
194540	198840	case, who knows who it was. Um, in fact, it was a encryption key controlled by the attacker
198840	202780	that only people with a private key had access could abuse the backdoor. That was really a
202780	207200	neat thing about it. So, we thought it'd be fun to go figure out who this Gia Chan person
207200	210200	was. And we're like, hey, you know, everyone's looking for Gia Chan, we're going to go find
210200	214940	some Gia Chan. Uh, and we're very happy, Alfredo, if you're out here, thank you so much for
214940	220460	designing your graphics, they're amazing. Um, so we decided to go hunting. And, you know,
220460	223880	before we go hunting for Gia specifically, we want to talk a little bit about SH protocol.
223880	229860	So, uh, Gia Chan targeted SH, uh, with ex- with ex-utils backdoor. So, we're going to target
229860	235700	Gia Chan using SH. But before we go there, we need to talk about how SH public key
235700	239680	authentication works. So, SH public key authentication is two-stage. The first thing you do
239680	243540	is say, hey server, would you accept this public key for this username on your machine? And
243540	247320	it says, yeah, sure. And then you have to sign this big blob of data that proves that you
247320	250940	have the private key. But you can do that first part without the private key at all. And it's
250940	254480	really cool. There's been a module in Metasploit 4 since 2012, lets you take someone else's
254480	257500	public key that you got, however you got, and then check a bunch of servers to see whether
257500	261160	that public key has access to, uh, those servers for that username. So, you can kind of see
261160	265040	where this is going. Um, it's, there's this great comment on OpenSH saying, is this a
265040	267760	problem? I don't know. But it's been there forever. It's just kind of the protocol spec at
267760	271400	this point. It is what it is. Maybe it's not a big security deal. So, we decided to create
271400	275100	this thing called Shamble, which started off being a half-off scanner for SH. So, what we
275100	278640	do is you take a bunch of public keys and then you'd like put them in Shamble and scan the
278640	283240	whole internet saying, what on the internet can you access using these public keys? And the
283240	287440	idea is like, well, if we had, let's say, Gia Tan's public key, we can find all the servers
287440	290260	that they use and then from there we figure out who they are. So, that was, that was the
290260	294620	idea. But it ended up evolving to this massive tool to find all kinds of other crap because of
294620	298340	all the things that we found. So, you know, first thing you do say is, hey, my name's Gia Tan,
298340	301460	we're gonna go download your GitHub keys. So, we grabbed our two GitHub keys, which are
301460	306440	still present today, um, and basically took those two public keys, ran them into Shamble,
306440	310040	and then, um, you know, threw that at the whole internet, all the, all the sh-demons we
310040	314360	could find, let it grind out for a couple days. And what's, what's exciting about it is,
314360	316960	like, we spent the whole week on this, we hadn't slept or anything like that, Rob and I were
316960	320520	like working at four in the morning, like, we got one! We got a hit for Gia! It's really
320520	324620	exciting. Um, in the meantime, we're melting all of our DigitalOcean nodes. So, this is this
324620	328340	poor little DO droplet just like falling apart as we're like destroying it. It's, I think it's
328340	333520	sent like a terabyte of traffic at this point. Like, we're, yeah, we made DO VMs very unhappy.
334160	339320	Um, so, just heads up for law enforcement, um, we sent the public key for GiaTAN to every
339320	343800	server on the internet from RIPs. We are not GiaTAN, we are not backdoor exe-utils, even
343800	347720	though it very much looks like we did. So we sort of accidentally framed ourselves. Uh, we
347720	352020	realized that after the fact that we probably might, I'm sure the long-arm law will catch up
352020	355520	at some point, like, you guys, you're GiaTAN, like, ten years from now, and like, yeah, we
355520	360680	are not, sorry. So, um, unfortunately, like, every single result we found that we thought was
360680	365000	false positive. It was like a buggy server with, like, the memory was corrupted, or the service
365000	369000	would accept every fifth public key, or every third public key. So we had to say, okay, let's
369000	372780	try a bunch of random public keys, and if you reject all those, now try the Gia key. And let's
372780	377800	try, like, an RSA key, RSA 1024, 2048. We've still found devices that just randomly accept or
377800	381260	randomly not accept keys, and it just drove us crazy. So we finally fixed all these bugs,
381260	385800	re-scanned, re-scanned, re-scanned, uh, you know, clicked all those digital ocean abuse
385800	389740	notices, says, yeah, we're good, our server's not compromised, we're cool. Um, and we still
389740	393460	found no Gia 10. So, whoever this, you know, actor was, they had really good OPSEC, we found
393460	397660	nothing, so good job them. Um, but we did find, like, thousands of free shells. So, we're
397660	400500	like, how come we're getting all these random shells and all these random machines? And that's
400500	406020	really what this talk is, is about. Uh, so with that, um, a little bit of a detour. So, an
406020	410040	SH, um, public keys used to not be something that you actually made public. They used to be
410040	412920	something you kind of kept privately, and you were .SH directly, and you copied to a server
412920	417880	here and there. But, um, in the last five or six years, we've seen people using, uh, SH keys
417880	422200	like identities. So, just like people used PGP back in the day, you can now use SH keys as your
422200	425020	identity when you're installing a bunch of server. You can tell it to grab your key from
425020	428340	GitHub or from Launchpad and automatically give you access to your server during installation
428340	434660	by username. Um, you can also, uh, um, use these keys for things like, uh, OJ encryption. So,
434660	438380	if you use the OJ tool or H tool, you can use it almost like a PGP key now these days as
438380	441880	well. So, it's all kinds of cool stuff you can do with, uh, SH keys you didn't before. But the
441880	444860	key thing here is, like, keys are effectively public if you use any of these major
444860	448900	platforms. And literally public. So, there's this great little, uh, daemon by Filippo where
448900	452780	if you SSH into it, it'll say who you are. It'll use the public key you send to the server,
452780	456460	dock to you based on the GitHub database and say, oh, you're so and so, welcome. So, it's
456460	459700	kind of a fun little trick. And effectively, we're doing that, but at scale for the whole
459700	463800	internet. So, if you want to link a user to a particular key on a particular server, you need,
463800	467700	um, one, a list of all the SH servers out there. So, ZMap, Mascan, dump it, show it in,
467700	470400	whatever you want to do to get the list. You want a list of all the public keys, so you go
470400	474200	grind all those out of GitHub through their BigQuery API, about 117 million users as of
474200	477560	about a month ago. Launchpad's got a bunch of users, too. You get all their keys, too. Why
477560	482180	not? And then Bad Keys is a great project by, uh, Hanno Bach, um, that allows you to, that
482180	484860	keeps track of all the compromised keys out there. So, you can look for keys that give you
484860	488540	access to the system. And then lastly, you need a list of common usernames the user might
488540	492380	have, like root, ec2 user for cloud, Ubuntu, et cetera, or whatever the comment is in the
492380	495980	key. So, one of the nice things about GitHub is that when you upload your public key to
495980	499400	there, they actually preserve the comment field, which is typically your, your username
499400	502160	when you uploaded the key. So, you know what their default username is. So, if you're
502160	504840	trying to find, like, their server someplace, you can pull it out the comment, use that to
504840	508200	talk to the user, and so on. So, you, you take this nice little recipe and you throw it in
508200	513460	the oven. And, um, it gives you a nice little primitive to take a one key and check lots of
513460	516260	servers really fast. Like, you can grind through all the servers on the internet in, like, an
516260	520160	hour or something like that on a single box. It's pretty quickly. Just for one key. Um, but
520160	523220	if you want to test, um, so that works great if you're looking for, like, a geotan everywhere.
523240	527100	But what if you want to say, for this server on the internet that's acting fishy, which
527100	531220	GitHub user has access to it and do the other way, to check all 117 million keys on one
531220	534620	server. Well, that's a very different attack. That's like, you know, duck-sized horse or
534620	538500	horse-sized ducks, you know, kind of approach. So if we want to test a million keys against,
538500	542800	uh, a single server, it's a little bit tougher because, uh, SH will slow you down. Uh, they
542800	546160	have, uh, this thing called max auth limit, which is how many tries you can authenticate
546160	549220	before it kicks you off of that connection. And there's a max connection limit, so you can
549220	552820	only do so many of those at once, right? So the idea is that with OpenSH, if you try to
552820	556440	brute force keys, you get four into it and it knocks you out and you can't auth anymore. So
556440	559700	if you ever had more than four keys in your SH, uh, agent, and you try to shell out a
559700	562700	machine and it just immediately says, you know, too many tries, that's why. It's because
562700	567840	you're hitting the max auth limit of OpenSH. However, um, OpenSH is the only one that does
567840	571640	that. Everything else lets you just bang keys all day long. So DropBear lets you just
571640	575540	grind keys as fast as that little device can, can test them. Um, also a lot of commercial
575540	579180	products like Bitbuys, GlobalScape, Maverick, LanCom, all this stuff, all their SH daemons
579180	582260	do not care. They'll let you just try every possible key in the world until, until you're
582260	585220	done. It's great. Uh, we emailed the DropBear folks, they didn't care, they didn't even
585220	588400	bother replying, so we're like, it's not really a bug, it's a feature. So, we like that
588400	593160	feature. So, uh, with the shamble code you mentioned before, we tested the GitHub, like
593160	597660	4.6 million key database at the time, and you can do about 10,000 keys per second on a
597660	601500	DropBear box on an embedded node without it spiking the CPU on the target device at all. It
601500	604880	just doesn't even care. It's like super fast. So it doesn't even murder the machine. And
604880	608800	this is 10,000 keys per second per connection, and DropBear is typically configured with 15
608800	613700	connections. So you can do 150,000 keys per second on a machine for pub key testing to
613700	616660	dock someone's server. So if you see someone like hitting you on a random box and SH is
616660	619760	open, just go take all the keys and get it. I'd be like, yeah, you jerk, stop that. And
619760	624020	just email him, like quit it. Like, it's really, really easy to dock to your hackers. And if
624020	627800	you're running an SH honeypot and your SH honeypot collects the public key being sent to
627800	630440	you, you can turn around and flip that on them again and immediately figure out who they
630440	634280	are. Like, people forget all the time that their SH agent's configured and they're sending
634280	637180	their public key to every server they connect to. Even if their agent is not authenticating
637180	640320	to it, they're still automatically sending that public key as a task whenever you touch
640320	644240	anything. So if you're a, a lead hacker and you've been just SHing at random machines on
644240	647400	the internet, you're also sending your public key identity to all those machines and if
647400	652740	they're logging at your host. So, um, by contrast, if you try the same attack against open
652740	656980	SH, you can do 132 keys per second. So it'll take you 10 hours to do the same 4.8 million
656980	662100	keys with a single connection. So, um, obviously the open SH approach is much nicer, um, but
662100	665900	it's great if you're trying to, um, adapt, docks people. So, uh, with that, I'll hand it to
665900	673940	Rob to talk about shaking out shells. Testing, testing, testing. Testing, testing. Hey,
673940	681060	all right. So shaking out shells, say that five times fast. Um, what we did with shamble is it
681060	687820	resulted in, uh, around 27 million devices on the public internet that are listening on port
687820	693900	22. We got another, you know, 14 million or so that actually negotiated, uh, SSH off and we
693900	700620	ended up with about 110,000 sessions. Um, what's really interesting about SSH, so SSH, uh,
700620	709940	especially open SSH has done an immense amount of work in, do what? Oh, sorry, front mics are
709940	718320	hot. Uh, so, sorry. So, uh, we ended up with, um, about 110,000, uh, that are actually
718320	723080	listening and we were able to get sessions. What's fascinating about open SSH is, or SSH, is
723080	728880	that there's a fairly large post-authentication attack surface. So SSH does lots of things.
728880	732580	You can create tunnels, you, uh, can create pseudo-terminals, there's subsystems, there's all
732580	738580	sorts of things that are running on, uh, SSH once you're inside. Uh, it kind of assumes that
738580	742400	once you've authenticated, you're okay, but there's an immense, uh, an immense amount of
742400	749920	systems out there that actually will do this interesting post-auth-auth. So you authenticate,
749920	754980	uh, non-authentication with left beef and you get in and then it actually gives you a
754980	758480	secondary authentication mechanism. It'll prompt you for a username and then a password, but
758480	762500	you're inside the session at that point. So you can start doing some interesting things. This is
762500	767620	one of the, the interesting cool things that, that Shamble will do. Um, you can say, oh, okay,
767620	772960	uh, I can send signals, I can send, uh, SIGWINCH, I can, uh, forward X11, things like that.
773340	779200	And you can see there's a fair amount of large, uh, devices, uh, popular devices out there
779760	786100	that do this post-auth-auth. So you can see you've got, uh, SonicWall firewalls, um, Juniper
786100	790120	network devices, you can SSH in with auth none, and then it'll give you the secondary one.
790120	794160	That, uh, that smaller one, the please login, that's, uh, a ruckus one that HD's gonna talk
794160	799080	about here in a minute. That's super, uh, super fascinating. But it's worth noting that there
799080	806880	is this post-auth attack surface that is kind of not considered, but is exposed. So, uh, and
806880	810300	with that, with sort of the first one that you can talk about is signal injection. I'm gonna
810300	813600	pass it back to HD for that. Did we get the second mic working?
814360	817140	Cool, thank you. Sorry, just trying to stay away from the front mic so we don't get feedback
817140	822380	here. Um, so, uh, Rob mentioned that one of the things you can do to a post-auth session is,
822380	827000	uh, inject signals into the process before you've fully authenticated. So if actually you
827000	831700	can connect to a machine, it'll pass through the authentication from SH auth equal none, and
831700	835440	then drop you to a real login shell, and it'll say, please login. And you can just say, signal
835440	839800	seg v, and it goes, ah, and dies. Which is a lot of fun. So effectively you can just, you know,
839800	842860	we talk about regression being signal re-entrance, this is just signal entrance. You just
842860	845620	bang signals all day long into whatever process you want and see what terrible things fall
845620	849940	back out of it. So, uh, we didn't get too far into this testing, but we, there's all kinds of
849940	852900	fun things that come out of it. You can send a SIGINT request, you can pass Python scripts
852900	856920	that are part of the login shell to crash, uh, you can do SIG alarms, SIG childs, SIG ills,
856920	860060	SIG aborts, you can pass core dumps, uh, all kinds of crazy stuff you can just do with
860060	864720	signals. And OpenSH tries to protect you a little bit by limiting things like sig seg v,
864720	868160	sig abort, and so on, uh, but DropBear does not. DropBear is like, anything that you can
868160	871440	possibly send me, I'll treat as a signal and deliver to the process, thank you. Um, so
871440	873620	there's a lot of really cool attacks that we think you can do there, and we're gonna start
873620	877520	working on expanding the shamble code to then basically just mash symbols into random
877520	881180	processes so you get a shell. And, yeah, um, with that, hand it back to Rob to talk about
881180	887100	TSP forwarding. I, I do always love that, uh, DropBear is like, I, you know, it's like if it
887100	890020	were dying, it wouldn't be dictating, right? It wouldn't be writing it out, it would just
890020	896340	say IEE, but no. Um, but another part of this post-auth, uh, uh, attack surface is
896340	902100	forwarding, right? So SSH allows you to generate or create tunnels, uh, you know, through
902100	905820	channels and create encrypted tunnels. It's almost like a little miniature VPN thing, and
905820	910120	this is a pretty popular and common, uh, feature. But once you po-, once you're in this
910120	913360	post-auth situation, you can start doing that. You can start creating these things on a lot
913360	918020	of these systems. Um, many of them will administratively restrict you from doing it or
918020	923460	they'll only let you go to certain things, but for example, uh, uh, you can say, okay, well
923460	927640	I'm gonna try to forward to this particular host, or I'm gonna try to forward to a local host
927640	932460	and do a loopback, um, and we actually found, uh, this is an ION, yeah, okay, good, the
932460	937640	chip's playing, uh, this is, uh, an ION network's access point, and you can see that it's
937640	945800	trying to, uh, forward to google.com, and it, it gets rejected, and then it's gonna try, oh, and
945800	950360	by the way, this is the shambles shell, uh, which I love. Um, and it'd say, oh, I'm gonna
950360	955340	try to get to 88888, but then you can actually forward back to local host, so you can actually
955340	960340	use that to get around restrictions and things like that once you're in this sort of, uh, uh,
960340	967460	mystery, uh, uh, post-auth shell. But, the big, the big one is shell injection, I'm gonna let
967460	971820	you take this one, cause this is super cool. So one thing that was kind of fun about this is
971820	975340	that we found bugs that, like, we shouldn't have found. Like, because of this post-auth
975340	979420	sequence, effectively you SH to the machine, and instead of asking for a password, you just,
979420	982320	it drops you straight in, but it drops you straight into a secondary shell. And that
982320	985460	secondary shell has its own bugs. So we kept finding these vulnerabilities in these
985460	988940	secondary shells that no one had found before, even though they were, like, stupid. Like,
988940	992960	we found so many dumb bugs just because no one really tested that level of the protocol. So
992960	998500	in this case, um, we're right across these, like, ruckus access points, and you SH them,
998500	1001880	there's about 36,000 of these suckers exposed to the internet, about 900 are vulnerable to
1001880	1006360	this particular attack, still right now, today, and it asks you for a username, you type
1006360	1009200	in root, you type in, you start entering your password, and for your password, you just type
1009200	1012060	in, like, dollar, parenthesis, whatever command you want to run, right? And just redirect it
1012060	1015200	back out to standard error so you can see the result, and it just runs this root, pre-auth,
1015200	1019220	it's great. Um, so we'll, we reached out to ruckus, of course, like, hey, what's up? Like,
1019220	1022900	you guys, is this a new bug? Is this a fixed bug? We can't really tell what's patched. Like,
1022900	1026060	oh yeah, we patched that already. I'm like, did you tell anyone? Nope, they didn't tell
1026060	1029100	anyone. There's no CV, no security note whatsoever. So of course no one's applying
1029100	1032480	patches because they didn't know they had to apply a patch. Um, so they've got two
1032480	1036080	different tracks, the 521 and the 621, those both fix it, but there's, you know, still
1036080	1039340	about, you know, almost a thousand folks out there still running unpatched up. But the
1039340	1041940	question was, like, why did this bug live so long? How did we end up with this, like,
1042080	1046220	a stupid login prompt, like, password character injection, and it's because it was behind
1046220	1049840	this SSH auth layer that no one really bothered to test it. Like, all your folks who normally
1049840	1054240	hit a telnet prompt, something like that, just hadn't tried this SSH post auth attack.
1054240	1057100	So we uncovered this whole, like, layer of bugs that really should have been found 20
1057100	1061420	years ago, but they were just hiding behind this extra SSH layer. Uh, and that's one of
1061420	1064720	the interesting kind of side effects of this work. So here's an example of us, uh, rooting
1064720	1069360	one of these random ruckus boxes. SSH in with all the, I don't care about my cipher stuff,
1069360	1075000	please log in, R-O-O-O-O-T, and then for the password, we're just typing in $PSAOX-W and
1075000	1079140	getting a big process listing. And the funny thing about it is you can actually see the echo
1079140	1083160	command in the PS listing showing that it's going to shop 256 sum, that's how they check
1083160	1086420	your password. So they fixed it just by putting in proper quotes, but the whole thing is
1086420	1089860	ridiculous. So it's amazing, like, how many dumb bugs are out there if you just go a little
1089860	1093680	bit further into the protocol stack. And back to Rob for the permit.
1095500	1100180	So SSH, you know, is the secure shell, it's designed to talk as your shell, it replaces
1100180	1105380	Telnet and RSH and all that, and it lets you set environment variables. Um, environment
1105380	1109280	variables are used to control the execution of things and, you know, keep track of the
1109280	1114120	environment and all that. And a lot of, uh, SSH implementations will limit what you can
1114120	1119800	send, but a lot won't. Um, there's been a, uh, and it's configurable, of course, some will,
1119800	1123020	uh, accept these environment variables, some don't accept these. So there's been this
1123980	1128900	renaissance in, uh, Gitforges lately, there's a ton, there's, there's GITI, there's GOGS,
1128900	1132900	there's, uh, I always pronounce this wrong, FORGEHO, tell me if I'm saying that right,
1132900	1138180	GARET, things like that. And they are using these embedded SSH libraries that speak the
1138180	1141520	SSH protocol, and these libraries, because they're, you know, designed for general use,
1141520	1145800	they will accept, you know, any environment variable you send, and they rely on the client,
1145800	1153280	the user of the library, to, uh, limit what is going on. Um, and so that's generally okay,
1153280	1157620	like a lot of them do it correctly, uh, for example, GitLab, GITI, FORGEHO, they will
1157620	1162560	only accept Git protocol as, uh, an environment variable, and that's, uh, something that's
1162560	1165960	looked at by Git to negotiate protocol versions, so you can say, oh, I want to use Git protocol
1165960	1169760	version 2 or whatever. But, for example, there's still some vulnerabilities there, if you were
1169760	1173480	using a version of one of these, these are all written in Go, and it was compiled using
1173600	1179300	a version of Go prior to 1.19.3, which is a year or two old, um, on Windows systems,
1179300	1182880	they don't properly sanitize the, uh, the value of the environment variable, so if you
1182880	1185860	put a null in there, you can actually just inject arbitrary environment variables, which
1185860	1192980	is, uh, super fun. But, um, there was another one that was really interesting in, uh, GOGS,
1192980	1197420	where whenever it gets an environment variable, it actually runs the env command, and so the
1197420	1202060	point of the env command is to start a new process, um, with a new environment, with,
1202060	1206760	you know, setting certain environment variables or whatever. And it starts a new process,
1206760	1212280	it doesn't affect the environment that you're in, right? It, it, that's not how POSIX works.
1212360	1217220	So you could just say, okay, well, I want to set an environment variable with, you know,
1217220	1224000	dash, dash S A equals B, and then, you know, bash, or, you know, touch temp foo, or whatever,
1224000	1228320	and you are just executing arbitrary commands. And we, we did reach out, there's, there's
1228320	1234520	no patch for this, uh, it's, seems moribund, so maybe don't use it. Um.
1234680	1239600	This is a great example of, like, parallel discovery, so, not in, not in the court sense,
1239600	1244100	but in the, uh, we reported this vulnerability on, like, April 24th, and Sonar Research had
1244100	1247880	reported the same bug to the same maintainer on the 22nd, and they scooped us on the advisory,
1247880	1250900	and we both had our own separate GitHub advisories, but it's just hilarious that we both
1250900	1254040	managed to look at the same bug at the same time, so, it's funny, like, how often that
1254040	1257280	happens, and this is a great example. So props to the Sonar source folks for beating us by
1257280	1260980	two days, uh, and they did a really great blog post about how the bug works, but it,
1260980	1263600	it almost looks like a backdoor, because it doesn't actually influence the environment
1263600	1268160	of the subprocess, it's just a straight command exec pre-auth, so it's a, it's a funky bug.
1268180	1268740	Yeah.
1269060	1274380	Yeah, exactly, thank you, HG. Um, so going back to these, uh, these libraries, so, for
1274380	1279140	example, uh, Apache Nino, which is a Java, uh, implementation of SSH, will accept any
1279140	1284820	variable you want, um, and most of the time, uh, it doesn't really run into anything, but
1284820	1289280	this is, this is maybe my whole, this is maybe my favorite thing that we found, uh, personally.
1289420	1294260	Uh, so there's this piece of software called SoftServe, and it's designed to build, um,
1294260	1299540	Git repos, and it gives you this beautiful, uh, SSH, or, you know, CLI, you SSH in, you
1299540	1304920	control it, you can do whatever, and it uses, um, the Charm Bracelet SSH, uh, library, which
1304920	1309960	is built on top of Go's SSH, um, and it will accept any environment variable, or it did,
1309960	1315600	we reported it, they fixed it, this is our CVE, Go us, um, but what's fun is you can, first
1315600	1321640	off, watch how slow I am when I'm typing in, uh, in GIF form, but, um, you can, uh, we just
1321640	1326480	basically created some shellcode, and we checked it into LFS, and you can actually do this in
1326480	1330600	lots of different ways, LFS just, uh, Git LFS is large file storage, it, it just makes it
1330600	1333720	to where it's not compressed, and, uh, the file name is predictable, so we don't have to
1333720	1339820	worry about it too much, uh, makes it easier to exploit, we push it up to, uh, to SoftServe,
1339820	1345140	and then, uh, doing the SHA 256 sum of our shellcode, because that gives us the, uh, the
1345140	1349300	file name that we can, you know, guess, and then we just set LD preload to our shellcode, and
1350400	1355600	we now have, you know, shell on that system. So, that was super fun, uh, I, I always love
1355600	1359120	when I get a shell, and I'm just like, oh, this is great, you know, uh, so that made me
1359120	1362940	really happy, and these, uh, these folks were really super cool to work with, um, we, uh,
1362940	1368400	we disclosed that, they were very, very nice. Um, but now moving on to, uh, Broken States,
1368400	1372020	which is the SSH state machine to HD.
1372040	1376320	Thanks, um, another fun thing about the, the SoftServe side, so that particular exploit, um,
1376320	1379920	because it's using git LFS, you can, you can reference a raw file on disk, and you don't have
1379920	1383400	to know your file location, you can use relative paths and stuff, but this works just fine for
1383400	1387060	unauthenticated git access too, so if you're running SoftServe for read-only access, you can
1387060	1390040	still exploit it, it just requires jumping through more hoops, because you can specify LD
1390040	1394160	preload, LD load library, you can set LD library debug out in the past, there's a million ways
1394160	1398020	you can, like, eventually get a file onto disk to then load, or to trigger a shell script, but
1398020	1401840	just LFS was the quickest way, but like, yes, we're loading arbitrary code, so, it, write access
1401840	1405300	to the repo is not a requirement to exploit SoftServe, and there's still about ten of those
1405300	1408360	suckers hanging out on the internet right now that are exploitable, so, if you're quick, they're
1408360	1414200	yours, um, kidding, but, um, so, I'll talk a little bit about the SSH state engine. So, SSH is
1414200	1417500	like, incredibly complicated in terms of how it makes you go through these different states to
1417500	1420520	get to each phase of the protocol. The stuff you're mostly familiar with is like, when you
1420520	1425540	first connect to the port 22, you'll see like, SSH-2.0, uh, server banner, things like that.
1425540	1428600	If you happen to send the same manner back to it, or you connect to dropper, then you'll get
1428600	1432100	this big blob of stuff with null delimited strings, which have like, ciphers, and max, and
1432100	1436180	algorithms, things like that inside of it. So, all that's kind of during the, uh, server version
1436180	1440460	exchange, and the key exchange, um, the SSH daemons are very clear that they will only accept
1440580	1445100	a certain range of message values for each state. So, before you've done the, uh, version
1445100	1447940	exchange, you can't do the key exchange, before you do the key exchange, you can't do
1447940	1452460	authentication exchange, and this is enforced two ways. The protocol itself has a range of
1452460	1457340	values allowed for each state. So, values 1 through 49 are allowed in state 1, 0 to 49 in
1457340	1460880	state 2, and so on. So, if you're trying to like, just open a channel, or open a shell,
1460880	1463580	technically there's no even message handler for it, because it hasn't even configured the
1463580	1466960	state handler to even accept that type of message yet. But that depends very much on the
1466960	1470860	implementation. Uh, DropBear and OpenSH are really good at keeping a big command table,
1470860	1474520	and when they go to another state, they just remove that command table handler for the
1474520	1477240	previous state. So, there's really no way to like, accidentally call the wrong function
1477240	1481600	pointer. Um, and that mostly works the way you expect. What's also interesting here is
1481600	1485840	everything after the key exchange, of course, is encrypted. So, SH is kind of like TLS in a lot
1485840	1489080	of ways, in that you have your normal, like, version exchange, key exchange, algorithm,
1489080	1492060	Diffie-Hellman type thing, and then you have, like, your encrypted transport, and that's
1492060	1495260	where all the fun stuff happens, like authentication, your banner, if you will. Like,
1495260	1497920	have you ever seen a pre-auth banner in SH? It's actually being sent over the encrypted
1497920	1501140	connection, not over the unauth connection. So, typically when you're talking about an
1501140	1503820	SH banner, you're not talking about the version string, you're talking about the pre-auth
1503820	1507340	big blob of data that it sends you when you try to authenticate. Um, so lots of cool stuff
1507340	1510900	happening there, but you can see the state engine is pretty complicated. Um, what's also
1510900	1514200	worth pointing out here is there's something called a larval session. So, that means you've
1514200	1519000	successfully authenticated, or maybe not, and it's the state of your shell before there's a
1519000	1522000	shell. So, effectively, if you haven't created a sub-process yet, you're in this kind of,
1522000	1525240	like, larval state, and that's how the code generally references it. And that's important
1525240	1529260	when we start getting into some of these other exploits. So, a historic example of where
1529260	1533800	this has gone wrong is libsh. In 2018, uh, someone reported vulnerability where this
1533800	1536960	library is used for both client and server side, same with OpenSH, same with DropBear,
1536960	1540400	they kind of share the same code base for both halves of the protocol. Um, and if you sent
1540400	1543760	the user-authenticated succeeded message from the client to the server, the server's like,
1543760	1547080	oh, okay, cool, you're in, and that's fine. Um, there's still a bunch of these libsh
1547080	1550320	informations out there that'll just drop you to a shell if you send user auth success, and
1550320	1554620	of course, you know, shamble test for that and makes it easy for you to use it. Um, so we
1554620	1558140	decided to take this up another level. Instead of just saying, let's just send a fake
1558140	1562200	success message, let's just try to get a shell everywhere. Let's take every single part of
1562200	1565700	the protocol transition and say, let's do half auth, let's do full auth, let's do a fake
1565700	1569860	pubkey, let's do a password, let's do a password none, let's do, even before sh user auth
1569860	1572920	command at all, and between every one of those attempts, we're going to ask you for a
1572920	1575240	shell. We're just going to be like, how about a shell now? How about a shell now? How
1575320	1578600	about a shell now? And how about now? Um, and it worked. Like, we got crap loads of
1578600	1582100	shells from random devices because we asked them in weird states to give us a shell. So
1582100	1585200	there's some out there where you don't even bother even starting the authentication
1585200	1587520	process and it gives you a shell. There's some out there where you start the
1587520	1590000	authentication process but don't finish, it gives you a shell. Like, it's all over the
1590000	1594640	map. So, um, there's three good examples we talk about here. The first one is the digi
1594640	1597500	transport, uh, gateways. They're mostly using like ICS environments, they're kind of
1597500	1600800	like out in the field with hardened stuff. They act as like kind of the VPN router, if you
1600800	1605900	will, for all the, all the juicy OT stuff you want to hack behind it. Um, so having remote
1605900	1608800	admin to these means you basically have serial port access to all the stuff behind it,
1608800	1611520	which is great. So if you want to like blow up pipelines, things like that, that's how you do
1611520	1615620	it. Um, so the digi team was really cool. They were great to work with. Um, this device
1615620	1618740	had already been like basically effectively legacy and retired, but it's still up for
1618740	1621920	maintenance on screen patches. But they had to go find like the one developer who hadn't
1621920	1624820	looked at this thing in five years and dust off their compiler and try to figure out how to
1624820	1627700	build the damn thing and all that. And the funny thing about this is it ended up being an
1627700	1633100	un, uh, an uninitialized variable in the SH engine. So it took us forever to repro, because
1633100	1636320	we'd say, hey, we can get shells in like all these machines on the internet. Like here's a
1636320	1639800	bunch of them, here's the serial numbers, like it's bad, go fix it. Like we can't repro it. I'm
1639800	1642940	like, you got to be kidding me. Like just run the command. Like what are you doing wrong?
1642940	1646920	Like it's run command, what's doing, it was not their fault of course. It's that when they
1646920	1650160	were setting up the machine to test, they were logging in for the rest of the H first and
1650160	1652400	setting up their monitoring on it. And then they'd run our exploit and it wouldn't work
1652980	1656220	because the uninitialized variable had been set. So just one of those things was like
1656220	1659380	freaking Heisenbug to repro. It took forever to fix. Anyways, so we finally got to the end of
1659380	1661940	it, but the team was really cool. They're great to work with. They got a patch out even for
1661940	1665900	this legacy hardware. So awesome to see them actually supporting older systems. Uh, then we
1665900	1669920	found these real tech devices that are like branded all kinds of things. Netterbit, um,
1669920	1673680	Netis, there's probably a good dozen vendors out there and they all have like different flavors
1673680	1677560	of firmware from 2018 to 2023. And it's just like free shells everywhere. We don't even know
1677560	1682080	who to report it to. So that's, there's a bunch out there. Um, yeah, have fun with that. Uh, we
1682080	1685820	also ran across a bunch of Panasonic switches, but also a really weird set. And we had no idea
1685820	1689160	who to report that one to either. Like the normal Panasonic thing wasn't the right fit. And so
1689160	1692780	all the docs were in Japanese. We kind of gave up on that too. So we'll eventually figure out
1692780	1695780	how to disclose that one. But there's a bunch of random Panasonic switches that'll just give
1695780	1699000	you a shell pre-op as well through the same mechanism. Um, and this is just kind of the tip
1699000	1701980	of the iceberg. We found another like 70 odd devices. We just haven't figured out where they
1701980	1705580	are yet. Um, so, you know, basically take Shamble, throw it in your home network, throw it
1705580	1708580	in your work network and you might just get random free shells out of crap through this stage
1708580	1712000	transition. The only tricky bit here is you may have to specify a username that's not
1712000	1715700	the default username. So if the device typically has like an admin or manager username,
1715700	1719840	specify all the default admin usernames for the products and you'll be more likely to shake
1719840	1725700	out some shells. So here's an example of the Netterbit NSL224s. These are really popular
1725700	1730120	in Iran. So a huge portion of Iran uses these things and you just basically log in as, you
1730120	1734840	know, whatever you like. Um, so in this case we're using the Shamble shell for it. We're
1734840	1738880	just saying like brute force all the different session states and it logs us directly into
1738880	1742340	it and it shows data, here's the firmware, all the info, things like that. So super
1742340	1747380	straightforward. And here's an example of the Digitransport ICS gateways. Same thing. What I
1747380	1752080	love about this is when you log in it says, welcome, your access is super. So I also have
1752080	1756640	the, you know, the South Park voice in my head when I see that. So it's amazing. Um, with
1756640	1761200	that, I would like to talk a little bit about the OpenSH landscape. So, you know, typically
1761200	1766560	we think about like SSH being OpenSH and sure it's like 90% of us, it's 87% of all SSH in
1766560	1770360	the world, but OpenSH isn't just OpenSH either. There's a lot of different flavors of
1770360	1775840	OpenSH. So for folks who aren't super familiar, uh, OpenSH was forked from OSSH, which was
1775840	1782800	forked from the original V1, um, you know, tattoo, um, version of SH back in the day. Um,
1782800	1788080	but OpenSH wasn't designed for Linux. OpenSH was hardcoded for OpenBSD. Like they didn't
1788080	1792440	want our dirty Linux paws all over their beautiful SH daemon. So eventually they conceded
1792440	1795720	and said, you know what, you guys can, all you plebs can actually touch our beautiful SH
1795720	1799520	code, but we're going to create a version of OpenSH just for you called OpenSH portable. So
1799520	1802140	when you talk about OpenSH, you're really talking about the portable version of OpenSH,
1802140	1806240	which has a compatibility layer that makes, um, all of us heathens be able to use the nice
1806240	1810560	functions of VSD basically, uh, without all the pledge and cool things like that. But if you
1810560	1814000	look at OpenSH portable, there's actually a bunch of variants of that too. So if you look at
1814000	1818600	like who is molested OpenSH the most, we're going to start off with Apple. Apple was just
1818600	1822140	light touch. They just gave a little hug. They didn't really do much to it. Uh, they did not
1822140	1827540	do terrible things to OpenSH. They, um, added some changes for, um, let's see the key login,
1827540	1831380	the endpoint event logging, uh, PKCS helper and keychain, things like that. Really
1831380	1836600	straightforward, not terrible at all. Very happy that they did not destroy OpenSH. Um, they
1836600	1840320	start looking at Debian and Ubuntu. They've got about 36 different patches on top of the
1840320	1846300	core OpenSH code. Uh, and those patches make it libXE utils backdoor compatible. Um, among
1846300	1848820	other things, right? But there's a lot of changes and those changes aren't getting the same
1848820	1851920	scrutiny that let's say the rest of OpenSH code is getting. It's, it's basically linking it
1851920	1855420	to all kinds of other libraries. It's the reason why it linked to system D. Um, there's a lot
1855420	1859980	more attack service because of all those changes they put into the, those system patches. Now
1859980	1864580	moving up to Red Hat, now you're like 60 plus different patches. So even, even bigger attack
1864580	1867200	service. And, you know, hopefully they're auditing this stuff and everyone's looking at it
1867200	1869800	because it's important because if you're hacking a Linux server, it's probably going to be
1869800	1874140	either Debian, Ubuntu, or Red Hat based these days, right? Unless you're like, I use ARC, you
1874140	1878580	know, you know, there's only a few of those out there. Um, so, um, if you're using, uh, you
1878580	1882480	know, Debian, Ubuntu, Red Hat, Linux, et cetera, um, you probably have a ton of different
1882480	1887280	patches on top of OpenSH that are not pure OpenSH, if you will. Uh, you may go pretty well.
1887280	1890860	And then there's a thing called PKIX SSH, which I think probably a lot of folks haven't heard
1890860	1895860	about. It was forked from OpenSH back in 2002 to support X.509 certificates and then FIPS
1895860	1900140	code. So because it supports X.509 and FIPS, a lot of the networking vendors decided to use
1900140	1903700	that instead of regular SSH, uh, to build out their products because they want to sell to the
1903700	1907480	federal government and they want to use crusty old crypto protocols. Um, so there's a thing
1907480	1912100	called PKI SSH. It forked in 2002. It mostly, it's almost like they hate each other. If you do,
1912100	1916480	like, so, put it this way, we diffed all of it. We looked at, like, OpenSH mainline to every one
1916480	1920240	of these forks and just read every single line of code for days and weeks. Well, that was my
1920240	1925400	vacation. I just did that for hours a day. Um, but PKIX one is really funny because you'll see a
1925400	1930340	change in OpenSH and then a change is written slightly differently in PKIX SSH and they
1930820	1934560	oftentimes disagree. Like, once in a while they mostly match, like, if one equal this, if that
1934560	1938560	equal that. But occasionally it's like, if not, one equal this. And it's like, so, there's
1938560	1942120	probably some weird compatibility bugs because the changes weren't followed entirely. They
1942120	1945420	obviously don't want to look like they're copying OpenSH, but they also can't not copy it and
1945420	1948780	stay compatible. So, you can just, you can feel the rage between the two teams there. It's
1948780	1954220	great. Um, I've never felt so much, like, animosity in a code diff before. Um, but finally,
1954220	1959380	the, the really fun one here is Windows. So, Microsoft Windows, um, shipped OpenSH on Windows
1959380	1962700	10. Everyone's like, oh my god, I can actually type SSH and curl. I don't have to do all these
1962700	1966100	stupid commands anymore to back to my Windows box. I can use the built-in, I did nice native
1966100	1969720	Linux commands to back to my, my Linux boxes. And that was great. So, we love the fact that
1969720	1973460	SSH clients on Windows, we can use them on all kinds of stuff. Um, there's also SSH server for
1973460	1978300	Windows. And so, there's a fork for, uh, of OpenSH portable called OpenSH, um, under the
1978300	1983780	PowerShell GitHub repo. And they just massacred it. There's like 350 files were changed. They
1983780	1987220	ripped out everything. All those secure parts of SSH kind of just got put into the corner
1987220	1991020	over there, uh, and, and deleted. And then it's like, if Windows do something totally
1991020	1994620	different. So, they ripped out your support. They ripped out, um, the PrivSep stuff works
1994620	1998040	totally different through a sub-process versus the fork, because there's no forks on Windows.
1998040	2002820	Um, they, uh, logged to Windows Event Viewer. They logged, uh, they sent telemetry back to
2002820	2007440	Microsoft for everything you do. Um, they still haven't bothered fixing Terrapin. Like, it
2007440	2011040	just, it's a very different fork. So, if you're using Windows and SSH, either a client or a
2011040	2014820	server, you probably want to pay attention to this next slide, which is, uh, let's see, this
2014820	2018300	is what it looks like. Not super exciting. But, if you start looking through the OpenSH for
2018300	2021540	Windows code, you can start looking at the telemetry callback. You can't disable this crap,
2021540	2025860	unless you disable telemetry total on your machine. Every single connection going to your
2025860	2030300	Windows, your SSH server on Windows, is sending your client version and server version back to
2030300	2034140	Microsoft in the telemetry. So, every time you port scan your system, every time you run a
2034140	2037660	Nessus scan against your Windows server, it's sending that info back. Every time you SSH
2037660	2040880	directly from your Mac OS client or whatever it is to a Windows server, it's sending your
2040880	2044300	version string back to them. So, Microsoft knows who you talk to, who knows who you shell
2044300	2048080	into, it collects all those craps for default telemetry. It even collects telemetry for things
2048080	2051200	that are part of an encrypted session, like things like authentication methods that are
2051200	2056120	negotiated over the secure channel, that's also shipped off to telemetry. So, uh, you know, I
2056120	2059780	know we're all good, you know, cool kids here and we disable telemetry in VS code, but like,
2059780	2063740	have you done so in OpenSH? Probably not, right? Um, so it's worth digging out the
2063740	2066640	diagnostics viewer where you can look at the telemetry data on Windows and seeing like all
2066640	2071320	your SH stuff being shipped off to the cloud. Um, so, yeah. But the next thing we'll talk
2071320	2076500	about is even worse. Uh, so there's this really key function, we talked about OpenSH
2076500	2082040	portal being a, a compatibility layer to make it, um, work not on OpenBSD. So the pure
2082040	2086240	OpenBSD people, you know, can, can give us their code. Um, one of the functions that they
2086240	2090020	implemented was timing safe B comp, which is like you expect. It compares two binary
2090020	2094180	blobs, are these identical, in a way that doesn't change based on how long the strings are,
2094180	2097620	what contents they have. They, it can be consistent either way. This is to prevent side
2097620	2101120	channel attacks, it's really clean, really code, it's only like four lines of code. Maybe
2101120	2104960	take out the return in the int, in the variable, it's only three lines of code. It's really
2104960	2109540	hard to, to break this, right? This is a super nice, great piece of code by, uh, you know,
2109540	2113380	Damian, uh, Miller. It's great, it's perfect, it's beautiful. And then OpenSH for Windows
2113380	2120100	comes along. And they made it Windows compatible. So, uh, Windows compatible means, uh,
2120100	2124680	first they look for a back R and a back N, and they scrub out the back R, and so they
2124680	2128020	said, they allied the fact that there's a back R back N, they treated it as if it was equal
2128020	2132640	to a back N. But you can probably see there's some problems here. Um, we'll kind of
2132640	2135840	highlight those real quick. First off, there's only two lines of code they added, and they
2135840	2140180	introduced a ton of bugs. It's no longer timing safe, because they look one byte ahead. It's
2140180	2144240	no longer, uh, secure, because they read one byte out of, out of band memory. They're
2144240	2147540	actually reading the, the pointer plus one, not the pointer, which could be beyond the end
2147540	2151340	of that particular variable. So for every back R back N sequence you have in the source
2151340	2154820	buffer called by this function, you're actually going one byte out of the memory buffer and
2154820	2159620	moving forward. And that, and then that value's being compared for your byte comparison. So
2159620	2163100	if you know there's a lot of data at the end of your buffer, you can now just tell SH to not
2163100	2165760	compare the bytes you thought you were comparing and now compare the bytes at the end of the
2165760	2168780	buffer, which are typically a bunch of nulls or something more predictable. So there's a
2168780	2172000	bunch of like really gnarly bugs that happen just because somebody decided their config
2172000	2175140	parser didn't work with this function that wasn't designed to parse configs in the first
2175420	2179980	place. Um, so it's, it's about as bad as it gets. So this function's used in every single
2179980	2184060	packet that gets processed by SH. So every crypto buffer coming into it gets the SH comp
2184060	2189440	or comp buff check on it. And, and basically it, it gets buggy really quick. Um, it's used
2189440	2192280	for RSA signature validation, all this stuff. But the question was like, can we actually
2192280	2196020	exploit it? And that's where it gets tricky. It's like the buffer that you can, that triggers
2196020	2200020	the bug is the first buffer, first parameter, and the attacker doesn't control it directly.
2200160	2202900	But if you do enough signing operations, you know, packets, eventually you get a buffer
2202900	2205560	that has at least one back or back end in it. If you get to two, you get a little more
2205560	2208360	interesting, but it's been really tough to actually get an exploit out of it. So of course,
2208360	2212560	when we report to Microsoft, uh, their take is, you know, even though we've got $1 billion
2212560	2216820	annual security budget, we've got 3,500 security professionals, and we backdoor your timing
2216820	2221640	safe B comp code, you do not get a banana. So, we got nothing. They said, no, no, you guys
2221640	2224180	don't get anything. We're not going to fix it. Have fun. Like, all right, well, we're going to
2224180	2229880	talk about it at DEF CON. See you guys. Uh, so we did. Cool. Um, so that's the end of the,
2229880	2232700	most of the content about SH. We're getting a little close to time. I want to make sure you
2232700	2235640	have time for a little bit of questions here. Uh, we're going to talk a little about the
2235640	2240440	shamble tool. So, uh, this tool is a research tool for SH limitations. It's a combination of
2240440	2243700	like, a thing you can use today to scan your network, but a thing you can extend to find even
2243700	2248140	more horrible bugs in SH and then share them with the world. So, uh, we, we'd like you to, uh,
2248140	2253320	play with it, make it better, and, and rain hell upon vendors that do it wrong. Um, there's a
2253320	2257180	lot of really cool interesting attacks against authentication, off-bypass, null-bytes, uh, ends
2257180	2261820	up when you send a, uh, uh, SH password authentication, there's a, if you send a second
2261820	2265180	parameter in addition to your password, that tells SH server that you want to change your
2265180	2268260	password to that new value. So, you can imagine that when we're developing this tool, we might
2268260	2273300	have accidentally changed a lot of passwords. Uh, so, be careful about that part. Uh, other
2273300	2276160	than that, and it's kind of funny, it's like, oh, I got into all these machines, and then you
2276160	2279000	scan them again, like, now I can't get into all those machines, what happened? Well, we
2279000	2282340	accidentally sent all the passwords to a null-byte. Uh, there's also a lot of systems out
2282340	2286940	there that will, uh, accept a null-byte as a password, and specifically a lot of honeypots. So,
2286940	2289960	we doxed like 5,000 honeypots by accident because they accept null-byte passwords where
2289960	2292300	nothing else does. It's like, oh, here's all the honeypots, that makes our lives a lot
2292300	2295860	easier. Uh, a lot of the pre-auth state transition stuff, so you can extend those, make
2295860	2298520	your own. It's kind of modular. It's not as cool as menisplate, but it does a lot of stuff
2298520	2301680	like that. You can kind of add your own checks to register them. Uh, and then all the post
2301680	2305340	session stuff, too. If you get a session, but you don't get a shell, you can use shamble to,
2305340	2308960	like, bang on that session, try signals, jam keystrokes into it, generally do all the crap
2308960	2311880	you don't want to do by hand that's really annoying, and eventually, um, do that. Plus, we
2311880	2314740	added some timing analysis stuff, too. So, if you think there's, like, timing leak in a
2314740	2318220	username, we've got some built-in functions that'll tell you, like, what's the, what's the
2318620	2320800	statistical probability of this username being different than this other one based on a
2320800	2325660	timing tag with really tight, uh, timing. So, shamble.com gets you all that stuff, and
2325660	2328780	there's a whole bunch of stuff it does. So, I think, first off, I'll hand it to Rob to talk
2328780	2333580	about all the vulnerability checks we do. So, uh, shamble will actually check for all the
2333580	2337540	vulnerabilities we talked about, uh, over this, and they will not only check for you, it will
2337540	2342000	give you proof, so you can run through, uh, it'll check for TCP forwarding, see if it can
2342000	2345740	forward anywhere, it'll try different, uh, destinations, see what it can find, see if it's,
2345740	2350040	uh, administratively prohibited for some. Uh, it will do generic environment injection, so
2350040	2353780	it'll take, uh, environment variables, it'll control execution of processes, and we'll check
2353780	2357620	to see if the output changes and things like that, uh, LD preload, stuff like that. Super
2357620	2360760	useful, we'll say, oh, this is actually how it's vulnerable, this is what it can do, it'll tell
2360760	2364580	you what to do next. Um, the software vulnerability that we talked about, it will, uh, it
2364580	2368940	will give you the exact, uh, version and exactly the repo that it used and everything to get
2368940	2374540	into there. Um, it will check the GOGS thing, that's the, uh, that's the, uh, ENV thing that
2374540	2378560	looks vaguely like a backdoor, um, where it's executing ENV, and it'll try to give you
2378560	2382620	commands, uh, command execution there. And, uh, it will check the ruckus password escape,
2382620	2387220	that's the one where you can, uh, you can put backticks or, uh, dollar parens in the
2387220	2391000	password, and, uh, it'll just give that to you and it'll say, and the report, you can
2391000	2394280	actually see, uh, in the report, it'll say, okay, here's what I found, here's the
2394280	2398160	references, and here's the proof, it'll actually give you the output that it found. Um, and
2398160	2401800	you can just run that, they're automatically, it will automatically detect it, and it will
2401800	2405900	continue, we're continually adding more vulnerabilities here, so, uh, stay tuned and run
2405900	2410040	that on all your systems and tell us what you find. Well, thanks, Rob. And even in the last
2410040	2413080	24 hours since the code's gone live, we've got a lot of great feedback, feature requests,
2413080	2416600	things like that, so we're really excited to keep expanding it, adding things like the, you
2416600	2419240	know, keystroke masher, where it just, like, hits every possible keystroke trying to break
2419240	2421700	out of the shell, like, the things you usually put your toddler in front of to make them
2421700	2426260	give you shells, like, we'll just do that for you here, so, uh, who needs AI, right? Um, but
2426260	2430120	in that sense, um, lots of cool stuff's already built in today, uh, to get started, you just
2430120	2435880	run shamblescan-o, it generates a gigantic JSON file, um, if you run this across the
2435880	2439720	whole internet, you get about 60 gigs of data, I don't know why I know that, but it's a lot
2439720	2442580	of fun and you have millions of shells to go play with, uh, and then you can run the
2442580	2445260	analyze command, it'll try to, like, bucket your results based on what cool things you
2445260	2449220	found, so if it, if it's, like, a known backdoor, a known, uh, bug, it'll hopefully stick
2449220	2452040	into its own little file and you can track them that way. We also report, like,
2452040	2455540	vulnerabilities in the JSON, you can scrape out and import, uh, of course all this stuff's
2455540	2458680	been, a lot of this has been linked into the run zero tool that we work on at, at our day
2458680	2461600	job, and so it does a lot of these checks for you automatically, including grabbing all
2461600	2465060	your keys, stuff like that. We're also looking at integrating it with, uh, honobox,
2465600	2469060	a bad keys project to automatically identify host keys that have been compromised, and
2469060	2472460	shambles is unique in that it's one of the very few tools that test all of your host keys,
2472460	2477320	not just your first host key. So if your machine has an RSA key, an ECDSA, an ED25519,
2477320	2480120	et cetera, we'll actually grab all the different host keys by grabbing them all and then
2480120	2483860	test all those keys for weak keys and, uh, things like that. So we're still a little bit
2483860	2487560	early for the bad key stuff, but we're, we're making progress. Uh, so an example, one of
2487560	2490820	the neat things about shamble is that you can tell it to get into that larval session
2490820	2494440	state without actually opening the process, which is a pain in the butt to do otherwise
2494440	2498660	with the message client. So essentially you say, um, you know, shamble scan dash dash
2498660	2502300	interact equal first. So interact with the first session you get and the interact auto
2502300	2505780	equal nothing. Do not do any, do not do anything at all and just drop you straight to the
2505780	2508860	interpreter shell instead. And then from that interpreter shell, you can like set any
2508860	2512920	environment variables you want. LD debug equal all, LD preload, whatever you like. Uh, you
2512920	2516940	can start sending signals to it even pre shell. And then when you want to drop a shell,
2516940	2520360	you either type exec to run a command or you can do shell to get interactive shell. And at
2520360	2523120	that point you can then mess with the shell itself. So it gives you kind of all the tools
2523120	2526580	you need to manually mess with it and control E is how you open the shamble shell, uh, from
2526580	2530040	the prompt there. Just so we don't conflict with SSH escape codes. And there's a million
2530040	2532300	other things we can talk about, but we're going to keep kind of hammering on the code a
2532300	2537040	little bit. And of course, happy scanning. And, uh, here's us just throwing out a slash 24
2537040	2540860	real quick, but it is pretty fast too. It'll just, it'll eat all your CPU and RAM just
2540860	2546740	grinding away all your things. Um, and yeah, here's a bunch of bones we found. Thanks.
2546740	2549740	We've got a couple of minutes, I think for questions, looks like. Uh, if you have a
2549740	2566990	question, please come up to the middle standy thing and the mic so that everyone else can hear you.
2568850	2573090	Um, the mic may not be on, I'm not sure. You want to grab this one instead? Yeah.
2576810	2582430	Oh, sorry. You're still on mic. All right. So out of all the implementations that you have,
2583230	2586870	that you've scanned, what is in your opinion, the most secure?
2588090	2591830	Uh, the most seeker or the most insecure? The most secure.
2591830	2596550	Okay. Yeah. The, yeah, two, you know, the, the TLDR of this entire talk is just use
2596550	2600610	openness H98P1 and don't do anything else. Just don't roll your own. That's basically
2600610	2603610	all you found. Just like any other crypto. Anytime you try to mess with it, you break it.
2604390	2607190	Oh, thank you. Uh, any other questions?
2609190	2613210	Does anybody recognize my shirt? It's, it's particularly nerdy.
2614710	2616230	I'll be your friend if you know.
2616230	2621830	Okay. Anybody? One more question?
2622250	2628070	Yes. Did you guys try anything with Putty? Putty, P-U-T-T-Y client?
2629210	2637470	Sorry. Yeah. It's a TTY client for windows called Putty SSH.
2637490	2640610	Yeah. We didn't look at the code for it, but it's mostly client side. We really focused on all the,
2640610	2644130	just the server side of invitations. I know Putty does a bunch of weird things with the keys. Like
2644130	2647750	it has a weird preferences in which E-D-S-A keys uses, but we didn't get the chance to test Putty
2647750	2652310	itself. There, there was an interesting, uh, not volume per se, but there was an interesting, uh,
2652310	2654930	key generation issue with Putty this year. I need to go back and look at that. Yeah.
2654930	2655890	Sorry. Another question?
2655930	2662550	Does Shamble detects honeypots? Like how do you guys are detecting honeypots? And like,
2662550	2664370	how Shamble detects honeypots?
2668130	2672710	Okay. Yeah. So the short version is you, it just makes the TCP connection to whatever port
2672710	2676190	and range you tell it to. And then it looks for that stage version, does the handshake, all that.
2676190	2678890	So, um, that's about it. Unless I missed your question.
2679450	2681510	How is it detecting honeypots?
2681530	2686250	Oh, honeypots. Yeah. Um, so the funny thing is most honeypots, uh, have a bug where they accept
2686390	2690370	a null-byte password and they just drop and they accept that where a real machine will never accept
2690370	2694410	the null-byte password. So in a, in a, in an open-stage implementation, by default, if you put
2694510	2698490	a null into the password field, it'll kick you back out. But most honeypots will accept you with
2698570	2702250	a null-byte password. And that's an easy way to find like 5,000 of them. Um, we found a bunch of
2702250	2705910	other ones through, uh, some of them accept any public key, no matter what key you give it.
2705910	2709310	Other ones will take, uh, passwords that are, uh, outside the spec otherwise or
2709310	2712770	m-mangled password requests. So you just throw a garbage item and it accepts it.
2712770	2714270	You know it's not open-stage.
2715990	2718270	Cool. All right. And that's it. Thank you very much.
2718290	2721490	Thanks everybody. Look for us if you have any questions. We're happy to talk to y'all.
