start	end	text
0	2400	Good afternoon, DEF CON.
3520	7160	Our next talk is Zero Trust Total Bust.
7160	11500	Please give a big welcome to our next speakers, Dave and Rich.
18280	23900	Hey everyone, thanks for coming to our talk about zero trust network access.
24180	26020	I'm Dave, this is Rich.
26140	32040	We both work at Amberwolf, which is a UK-based consultancy specialising in red teaming and bone research.
32040	40380	We're covering a lot of bugs in this 45 minutes, but all of the technical details will be on our blog within the next few weeks, some of them straight after this talk.
41840	43560	So everyone's heard of zero trust.
43560	47060	The theory is that no user, device or request is inherently trusted.
47120	50820	Everything must be continuously evaluated against a set of access controllers.
50820	55300	So even if you've got valid creds, you won't get access unless all the criteria are met.
56760	59460	There's some terminology that we'll be using in the presentation.
59740	67840	If you think of SaaS as like checking whether the user and device are permitted to access a resource, acting like a traffic controller.
67920	73860	And then you've got steering, which is routing traffic based on conditions, so like ACLs.
73920	76060	Identity providers feature in this.
76060	77320	It's not their fault.
77500	80660	And we've included a definition of privacy just as a reference.
82440	87800	So the number one question we got asked after our last presentation was, what about Zscaler?
89040	96180	And we've all seen adverts similar to this saying that legacy VPNs are dead, need to move to the cloud, zero trust network access.
96260	102420	We also routinely see these products on red team engagements, so we thought we'd better take a look at whether they live up to their claims.
105230	106470	So a picture of the scene.
106470	110190	Everyone's panicking over the latest Advanti bug and they want to move to ZTNA.
110290	122050	So what happened is that people just replaced their VPN with a ZTNA product but then just used it just like a VPN, so no granular access controls, just brokering connections into the internal network.
122410	136090	And actually, even worse, we've seen a lot of this trusted corporate LAN concept used in the ZTNA world, but instead this time, you're sharing an IP space with every other customer of that ZTNA product.
137610	148550	So we see conditional access policies like this, where there's an exclusion for MFA from the ZTNA public IP ranges to reduce authentication friction.
148970	152570	And this means that we can just bypass MFA by coming from those ranges.
152830	159870	A lot of the vendors do have a concept of dedicated IPs, so if you do have to do this, then maybe look at that.
160470	163390	But enough of the preamble, let's get into some actual bugs.
165050	167650	So checkpoint ZTNA offering is called Harmony.
168270	175790	We cracked open the Windows client and immediately saw a reference to an encrypted private key within an upload to SFTP function.
175990	176730	Interesting.
176730	181870	This function is called whenever a customer chooses to upload log files to the checkpoint supporting.
182830	193110	And that decode resource function you saw, that just decrypts a resource from within the binary with a hard coded AES key and IV, and the result is your standard open SSH private key.
193770	202090	The log files were also encrypted before being uploaded to the SFTP server, but the encryption key was predictable and brute forceable.
202630	218390	The log files contained JWTs that lived for 30 days, so the impact is that any customer that had uploaded logs, um, was, could, could just be compromised because those JWTs can be used or, or straight to the, uh, ZTNA service.
218750	224250	Um, read access to the SFTP file system was removed immediately upon reporting to checkpoint.
224310	225210	That's pretty quick.
225390	229870	Um, we've got some more bugs in this product as well, but they are still in disclosure at this point.
232230	239010	When we start this research, we made like a little wish list of, uh, what are the best bugs we could possibly get, uh, in all of these products.
239110	242950	So we're going to keep this table updated as we go through the presentation.
245780	250840	So next we're going to take a look at Zscaler, which is a very popular ZTNA product.
250840	252900	Um, you see this a lot in red teams.
252980	255820	And we'll start from a completely unauthenticated perspective.
256180	260440	So the first thing that happens when you launch a Zscaler client is you put in your email address.
261160	265660	As soon as you do that, the client's going to start making requests to the mobile API.
265860	279380	So the first request it makes is, uh, it's encrypted here and, um, we don't have time to go through reversing the exact encryption routine here, but to summarize, essentially it generates a random AS key.
279620	285940	It combines that with a hard coded key and then it encrypts that with RSA and adds it to an auth token header.
286180	290720	And then that blob that you see there in the post request is encrypted with AS.
291100	292920	So we'll just decrypt that now.
293600	300700	So you can see here it sends a device type and a user email and then that uses that to fetch the cloud endpoint host name.
301560	304100	And then the next request is this get AEP.
304600	307020	And again, we just decrypt this.
307520	314400	Uh, and so before you put in a password, it pulls down this policy, uh, pre-auth, and it's called the pre-auth configuration for the tenant.
315460	317720	So what does a pre-auth config contain?
318300	333440	So this can include configuration details such as the authentication settings, such as whether the tenant is using IDP, or it can contain things like the cloud features that are enabled, whether they're using ZPA, uh, Zscaler private access, or just ZAA,
333440	336680	uh, and what features in the ZCC client are enabled.
336680	342540	So things that we might be able to potentially abuse once we get a shell for things like privilege escalation.
345510	352470	So this has been fixed now, but the pre-auth config also used to contain a URL for the pack file.
352570	355170	And this is something that we'd commonly see on red teams.
355530	369650	So, um, they usually look something like this one here with lots of misconfigurations in, so it might be things such as like, misconfigured wildcards in domains, expired domains, uh, or abusable services like Azure.
369870	377050	And what we're looking for here is domains that we can use to bypass inspection and we can use those potentially for C2.
378710	385110	So another way that Zscaler can be configured without a, uh, the ZCC client is in this explicit proxy mode.
385130	394870	So the idea here is that users traffic is steered to Zscaler's cloud proxies either by explicitly setting a proxy in their browser or via a pack file.
395430	400970	And what happens here is the user's HTTP requests get pushed through the Zscaler cloud proxy.
401130	403530	Uh, the proxy then checks for a gateway cookie.
403590	408230	If no cookie is found, the user's redirected to their IDP to do auth.
408750	416290	The user is then sent back through the proxy and then the proxy checks that gateway cookie and strips that from the request and forwards it back to Zscaler .
418670	429670	So it might not be a surprise if we can steal the gateway cookie from a user's device, then we can also authenticate to the Zscaler gateway and make our traffic appear as if it's coming from a Zscaler IP.
430490	432650	But what about if we don't have a gateway cookie?
433550	439190	Well, unfortunately we can't show you the next slide, because Zscaler asks us to remove it while they fix it.
440690	443890	But the good news is, we've got a different bug to show you.
443970	445030	A better bug.
445350	455010	Uh, so to pick up where you left off on the Zscaler client flow, if a tenant is configured for SAML auth, the client makes a request to the CL star end point.
455530	466830	This get request includes the domain parameter, a code challenge which is used for PKC, so this is essentially a client chosen sha256 hash, which the user has the plain text for.
467430	474630	And then the server responds with a SAML form, with a SAML request relay state parameter, fairly standard SAML flow.
474730	479690	This is then submitted by the client browser and redirected to the IDP.
480770	489350	So once the user signed into their identity provider, the SAML response and the relay state are posted back to this SFC SSO end point.
490010	500770	This then responds with a 302 redirect, redirecting the client back to the mobile end point test.html end point containing a JWT in the redirected URL CKE parameter.
501950	504790	This JWT can then be used to register a device.
504790	508830	And that's summarized as a typical SAML login flow.
509590	512870	But let's take a step back and have a look at that last step again.
513570	517750	So the client sends back this SAML response to the Zscaler service provider.
518190	527590	The server should then decode the SAML response, extract the user details from the SAML assertion and validate that the signature is valid for that assertion.
527770	531110	For the one that's been configured by the admin in the portal.
531230	532530	All fairly standard.
533470	541310	However, what we found is that the signature on the SAML assertion was only checked for presence and it wasn't validated against the IDP's public key.
541310	546330	So we could just sign it with any key we wanted or even one with an invalid signature.
546950	551430	So this gives us an auth bypass for any Zscaler tenant using SAML for authentication.
553330	559670	So we reported this to Zscaler on the 18th of July and they were very quick, fixed it within about four hours.
560230	565670	On Tuesday the 22nd of July, we tried the POC again and it worked.
565990	574170	So we reported this regression to Zscaler and they confirmed that they had to roll back the patch due to a more critical issue that was introduced.
575590	581370	So this has now been fixed and there's a CB so it's a CB 2025 54982.
581450	587610	And it's fully resolved, doesn't require any interaction by Zscaler clients.
589110	591370	So we're going to show a demo of this now.
592470	597570	So what we're going to do is we're going to run our script which is going to forge the SAML assertion.
601930	608350	And this contains now, we've got our JWT back and we've got our code challenge which we need to redeem the JWT.
614720	622040	And then we're going to use our Pyscaler tool which is just going to take that JWT and then register a fake machine in Zscaler.
623100	632640	So you can see now in the admin portal this is our machine that we've registered using that JWT and you can see that the hardware ID that we chose to register with them.
638310	640450	So let's take a look at that wish list again.
640530	642930	We can tick off off bypass Zscaler.
644830	646530	So moving on.
646750	652490	Another way that Zscaler can be configured is with this authentication mode called device token authentication.
652830	665550	So this isn't enabled by default but it enables admins to allow a token to be distributed to machines or mobile devices that use, that can use Zscaler as the identity provider.
666170	668550	This is documented in Zscaler's docs.
668590	673250	So on Windows you simply specify the token and user as MSI arguments during install.
673310	679190	But the problem here is that it only validates that the token is valid for that tenant.
679270	682810	There's no association with a specific user.
683210	691730	So if an attacker or a malicious user is able to extract that token from an endpoint, they can then register as a machine with any user name.
693670	701970	Or simply by changing the user name on an existing device, they can potentially bypass steering policies by simply changing the user name and registering as anyone they want.
703590	705950	So where is the device token stored?
706310	710650	So when installing with the MSI arguments, this actually ends up in the registry.
710650	716130	So there's a device token that's stored in the registry in clear text and a user name parameter.
716130	720110	For mobile devices, this is typically deployed by an MDM config.
721710	726650	So we're going to show a demo now of device token extraction and replay.
731680	737440	So the user, this is on the victim's machine, so we're going to extract that device token from the registry.
741020	745700	And then on our attacker VM, we're now going to import that token.
746220	748380	So we're going to pause that scaler.
752470	755690	We've then imported those tokens and user name.
759530	762390	Then we'll just kill that scaler so it picks up that new token.
770100	773400	So you see now, we're logged in as user 1 with just the token.
774300	779060	And if we try and access the internet, we can't get to the internet because this user doesn't have internet access.
779460	781640	So let's try a different user.
787390	791030	So again, we suspend it and we'll just go in and change the user name in the registry.
793210	796190	So we'll try admin 1, they've probably got better access.
805700	807620	Registers as admin 1.
808400	811200	You can see now we've got the network admin policy.
812940	814460	And we can access the internet.
823240	825340	So move on to Netscape.
825380	830940	We came across this on a red team engagement and it seemed quite architecturally similar to Zscaler.
831840	836560	There's a couple of specific bits of terminology to talk about here.
836560	838700	So we've got an org key.
839400	842080	And that's assigned to your tenant.
842080	843060	It's immutable.
843220	845300	So it's always going to be the same one.
845300	848880	And we've got a user key which is assigned to the user.
849280	850400	Also immutable.
850400	853300	So always going to be the same for that user.
853300	854360	Not revocable.
857040	859920	Recon, again, very similar to Zscaler.
859920	861340	The tenant name's sent.
861760	866880	And if the tenant's configured to hand off to another identity provider, a SAML request is returned.
867240	869280	And that contains the org key.
870440	874000	So, you know, we've already kind of leaked that at that point.
875200	882840	If they're not configured to use SSA, then there's a high chance that their kind of customer admin portal bit is.
882900	888580	So if you go to like customer.goscope.com, there's the same kind of SAML request flow.
889040	890600	And again, it leaks the org key.
890680	894380	So I think we've established at this point that the org key isn't really a secret value.
897940	900100	Recon, again, very similar to Zscaler.
900100	904900	You can use this org key to pull parts of the tenant configuration or the pack file.
904960	906940	And this is before you supply the password.
908860	913480	There's actually more information that's leaked to Netscape than there is through Zscaler.
913820	915880	And you can see some of the end points there.
916800	921100	And you can kind of get the steering config and everything before you've even supplied credits.
922320	930580	We're going to go through the flow of a publicly disclosed authentication bypass in Netscape to set the scene for kind of what comes afterwards.
931040	938020	So here we start with our first request, exchanging our knowledge of the tenant name for a SAML request.
938020	941060	And remember that SAML request contains our org key.
942360	946980	As is convention, the next step sends the SAML request to the identity provider.
947460	949980	And the SAML response is received.
950020	952020	So it's all fairly normal so far.
953060	955840	That SAML response is exchanged for JWT.
955840	957740	Again, all fairly standard.
959300	963020	Then the org key and the email address are exchanged for a user key.
963900	969420	And as we said, that user key is just a long immutable string that's tied to the user.
970300	971720	Uh, but hang on.
971820	974660	This request has got no authentication at all.
975180	980800	We can just see that we're supplying the org key that we have already leaked, uh, and an email address.
981340	990440	So in actual fact, we can skip that whole SAML IDP stage and go straight to pretending that we're whoever we want, providing we know the org key and the valid email address.
990900	992260	So we're Mclover.
994080	999640	The authentication flow then continues by exchanging the org key and that user key for a configuration .
1000920	1005780	And finally ends with exchanging that same information for a certificate that's used to set up the tunnel.
1005780	1014600	And remember, this is for Netscape's private access solution, which in the scenarios we came across was, uh, equivalent to VPN access to the target network.
1016910	1028230	So we got our exploit working, exploited the bug on the red team, network access, um, report the issue to Netscape, point out that it's already been reported, fixed, and even had a CVE advisory.
1028390	1032770	Uh, so firstly, big props to Sander DeWitt for being the original discoverer of this issue.
1032910	1039070	Um, we're a bit confused because if it had been fixed and had a CVE, why were we still exploiting this a year on?
1039270	1057200	Um, I suppose the important takeaway is that Netscape's recommendations here are use secure enrollment, uh, and make sure you use, sorry, make sure you use device compliance, um, so that red devices can't connect.
1060070	1062570	So we'll just talk through the fix for that quickly.
1062570	1070710	So, uh, according to Netscape's advisory, this issue was first reported to Netscape, um, by the original discoverer on the 18th of April, 2024.
1071030	1078370	Uh, they released an advisory on August the 26th, 2024, and assigned CVE 2024 7401.
1078510	1084970	Uh, so this describes a new enrollment method called secure enrollment, and this was first introduced in release 11610.
1084970	1092210	So interestingly in this advisory that they released, it also states that the issue was exploited in the wild by bug bounty hunters.
1092970	1100130	Uh, so despite a CVE and advisory, we're still running this mode in, um, February 2025 when they made secure enrollment the default.
1100170	1106330	Um, and even now in August 2025, we're still finding organizations who don't have secure enrollment enabled.
1110040	1111600	So what about secure enrollment?
1111600	1112580	How does that work?
1112580	1119280	So this uses a secure enrollment token, and this has to be deployed via MDM to user's devices before registration.
1119640	1127040	Uh, as a side note, we're not really sure why they didn't go for just validating the JWT that you could get in, in the offload, but we'll go through it now anyway.
1127880	1139620	So we can see they've added an authorization header here, and this authorization header contains a JWT, and we're still specifying an org key in the URL, but we've now got this signed JWT in the authorization header.
1140440	1142200	So how is this JWT made?
1142880	1154900	It's signed with the secure enrollment token, and it contains the UPN and the user key, uh, along with the org key and, um, in the JWT as claims, uh, which you can see on the right here.
1155020	1162240	As mentioned, this JWT is signed using secure enrollment token with HS256, but there's also an org key in the URL.
1163040	1165040	So which one will the server use?
1165280	1167700	The one in the JWT or the one in the URL?
1168860	1170640	There's only one way to find out.
1172880	1175080	That's right, get parameter wins.
1176260	1185080	The server only checked the JWT was signed correctly for the org key within the JWT itself, but it actually uses the org key in the URL when it enrolls into the tenant.
1186020	1194420	So if we supply a valid JWT for any Netscape tenant, and then we can tamper with the org key in the URL and begin secure enrollment process for any other tenant.
1194760	1201280	This negates the need to know the secure enrollment token for the target org, as long as you have an enrollment token for an entirely different org.
1201500	1204440	And we can specify the target user in the signed JWT.
1204900	1211780	We even found leaked enrollment tokens online, so you don't necessarily need to be a Netscape customer to exploit this.
1213200	1214740	So what about the fix?
1215160	1219100	We reported this cross-tenant bug to Netscape on the 14th of March, 2025.
1219540	1224080	They released a server-side fix in version 126 on May the 12th.
1224080	1227800	This fix now checks that the org key in the URL matches the one in the JWT.
1228100	1235340	Unfortunately there's no CV for this vulnerability, and despite Netscape being a CNA, they don't issue CVs for server-side fixes.
1237600	1241700	So we're going to show a demo of the cross-tenant exploit now.
1243500	1253460	So the attacker is going to run a script and they're going to provide the target tenant details, the EPN for the target tenant, and the org key for the target tenant, which remember can be leaked pre-auth.
1253660	1261480	They're going to provide the org key and the secure enrollment token for the source org, and then this gets back a cert and a branding file.
1262100	1268180	Then on the attacker's VM, they can then just import this, the branding file and the cert.
1277510	1279690	So now we just restart Netscape.
1294080	1296020	And now we have MPA access.
1303610	1306150	So that's Netscape auth bypass completed.
1311300	1315380	So we've seen how secure enrollment can be bypassed, but how should it work?
1315380	1324240	As Rich said, it's usually kind of rolled out via MDM, like an in-tuned install argument or SCCM or something.
1324300	1331420	The token's then stored in the registry in this location, and it's encrypted using DPAPI.
1331800	1341720	But it's encrypted using flag 4, which equates to local machine, which in fact means that any user on the machine can decrypt it.
1341960	1350300	It does have a little bit of entropy, and that's hard-coded as this is global entropy string, and yeah, that really is the entropy.
1353880	1366180	We'll just show a quick demo just to show you that, yeah, you can actually extract that string as a low-pref user, and what you end up with is the decrypted enrollment key.
1371580	1373560	That's what an enrollment key looks like.
1380030	1381750	So what does all this mean?
1382750	1389650	If you're an XSCAPE customer and you're still using IDP mode, there's still a complete auth bypass for enrollment.
1390510	1408730	In secure enrollment mode, this has been fixed, but if your secure enrollment token is leaked, for example, from someone compromising your in-tuned environment and getting the install arguments, then you can still auth as any user and bypass string restrictions,
1408730	1415270	and it's still possible if you've got an auth key, which is very easy to obtain to, to do loads of recon on a target environment.
1417920	1420080	So we covered, covered the auth bypasses.
1420080	1421340	What if you've already got a shell?
1421820	1433000	If you're up against EDR, we might want to spend as little time as possible on a monitored endpoint, and actually a good option is to steal the ZTNA config, move it to our machine, and then we can access the internal network from a non -monitored endpoint.
1436520	1441640	So both Zscaler and Netscape can store their configs as DPAPI encrypted blobs.
1441660	1444060	Only Zscaler actually does this by default.
1444680	1448640	But in theory, zero trust should stop you from stealing the config.
1448640	1450460	The posture check should fail.
1450840	1453580	The hardware ID should mismatch.
1453580	1457260	But as we'll show, all these checks can be spoofed.
1460250	1463130	So we'll have a quick primer on the Zscaler config.
1463490	1472930	It's stored in a file, and it's encrypted, well, it's XORed with a fixed key after some kind of convoluted XOR shuffle.
1474990	1481330	But to dump the config, you do require a system , and that means we need at least admin privileges to read it.
1481370	1488990	Luckily, we've got two privesks in Zscaler as well, one of which we reported in 2023 and still isn't fixed.
1490410	1499790	We can actually do, like, a whole other talk on the privesks, but we don't have time to, like, cover all the technical details in this bit.
1500410	1506930	But we do have some demos to show you in a second after we've explained how they kind of roughly work.
1506930	1511410	But if we go back to our table here, we can tick off config theft.
1514280	1521640	So about these privesks, all of the ZTNA products we looked at shared a very similar architecture.
1521640	1526680	They've got a low-privileged system tray and a high-privileged service or broker.
1527180	1530460	And those two kind of communicate via IPC.
1530460	1536540	That might be TCP socket and then pipe, RPC, but they all have one thing in common.
1536540	1541300	They failed to properly validate the calling process.
1541380	1549180	There's some attempts to do this by checking signing or path-based checks, but you can bypass that by injecting it into a relevant process.
1549440	1554280	And there's also some kind of tamper proof stuff, but we bypass that, too.
1554460	1558920	But just because you can call IPC methods, that doesn't automatically give you a system shell.
1559140	1570820	But luckily for us, every product we looked at had a vulnerable IPC method that we could exploit to run code or system, whether that was directly via , like, process starting or via file writing.
1574350	1576090	So I'll show a couple of quick demos.
1576090	1577810	Here's our Netscape LP.
1578370	1581270	You can see the attack is using a custom IPC client.
1581270	1586350	Injects a TCP proxy into a legitimate process to bypass the path signature check.
1586830	1603110	And then after this, the client actually enrolls Nacho VPN style, if you've seen that, into a malicious server, and it gets delivered an MSI update, and that MSI update gets run as system, and ping, we've got a system shell.
1609320	1612420	So next up we've got Zscaler.
1612580	1615860	This is version 4.7, which I think is the latest version.
1615880	1623280	Again, using process injection to bypass the signer check and then trigger a vulnerable IPC method to load some malicious code.
1623760	1628560	And then once we've got our system shell, we can dump the user's config, as we previously discussed.
1631480	1641860	And then finally, we use a script to dump the various source values needed to spoof the hardware ID, which will be important later on when we discuss, um, hardware ID spoofing.
1645060	1646780	So back to the wish list.
1646920	1651640	We can tick off, and this is starting to look quite scary now, but let's carry on.
1654710	1655510	Cool.
1655550	1658350	So you've stolen the config and even rolled, now what?
1658510	1664070	So we mentioned at the start of the talk that zero trust involves verification of the device as well as the user.
1664170	1667250	Uh, and one of the ways that this is achieved is through processor checks.
1667350	1673550	Uh, so these have been around for decades as, in SSL VPNs as well, and they're really no different in, um, in the ZTNA space.
1673650	1680530	Uh, so the specific checks that are carried out vary vendor to vendor, but, um, they typically involve the ones we've listed here.
1682010	1694510	Uh, in the ZTNA products that we assessed, the processor checks were retrieved over HTTP from the ZTNA server before being processed locally via the ZTNA client, and then the results were returned back to the, over HTTP to the server.
1695170	1707490	So Netscape bypassing these checks was really simple, we just had to, uh, put an intercepting proxy between the client and the server and change status equals false to status equals true, and we could bypass the processor checks.
1709090	1717630	Whilst this was mildly amusing, in practice, having an intercepting proxy between the client and the server is impractical due to things like DTLS and mutual TLS.
1717710	1725870	Uh, so we took a different approach here, and instead of, we injected a DLL into the client and then used API hooking to spoof the checks at a Windows API level.
1727710	1731430	So another piece of information that we had to fake was the hardware ID.
1731590	1742750	The hardware ID is essentially a hash of information that's derived from various components in the operating system and hardware, um, and then this is sent during registration and later on during keep live or device assessment requests.
1743010	1753270	Uh, it's supposed to be unique per user and per machine, um, and if the hardware ID mismatches, the server might refuse the connection or class it as a new device and force re-registration.
1753910	1761470	Uh, in reality, all of the values that make up a hardware ID can be spoofed and we can generate the correct expected hardware ID.
1761470	1766010	Uh, in the game cheat world, this would be called a spoofer and it's really no different for ZTNA.
1766990	1776670	Uh, so we quickly realized this would make a great generic tool for tricking software that evaluated these various operating system components to, to trick these compliance checks.
1776770	1783390	Uh, so we made this configurable D, DLL that could be injected into the ZTNA process and allow us to hook these API calls.
1783710	1790110	Uh, for hooking the Windows API methods, we mainly use MinHook because it's a simple library and it's widely used.
1790130	1799410	Um, for DLL injection, we mainly use the app, app init DLLs, um, method for DLL injection, but we also have the option to use a sign driver.
1801230	1805570	So for most checks, a simple Windows API hook was all that was needed.
1805590	1808710	Uh, however, to spoof some other checks, things that are slightly harder.
1809110	1814290	Um, so one of the things that normally makes up the, the, uh, hardware ID check is CPU ID.
1814290	1817730	So they use this as a way to get a unique fingerprint of the hardware.
1817930	1828030	And the way this works is they'll execute a CPU ID instruction to extract the processor info and the feature bits, um, by saying EAX to one and then executing the CPU ID instruction.
1828310	1830730	Uh, so we can't hook this because it's an instruction.
1830730	1832910	It's not a, um, a method.
1832910	1835710	Uh, so instead what we do is we use a page guard hook.
1835850	1841370	So the way this works is we search through the, the, the memory and looking for the CPU ID instructions.
1841550	1844090	And then we find the, the page that they're in.
1844090	1845550	We set the page as page guard.
1845570	1851890	And then when that instruction gets executed, it triggers an exception, which we can catch with a custom exception handler.
1851890	1858150	And then we can swap the, the register values out just after the CPU ID instruction gets executed.
1858990	1862610	The downside to this is it's slightly slower than an inline hook.
1862930	1869470	Uh, another option would be to use a custom hypervisor to spoof this, but in reality, we didn't need to do this.
1870290	1877370	So we then created this small GUI application to control the hook settings, allow us to spoof all these various values dynamically.
1877370	1884170	Um, and this allows us to import the config and it'll automatically adjust the spoofing settings to the posture profile inside the config.
1884170	1892510	Um, although some vendors offer the ability to perform cryptographically verified compliance checks or server side checks, they're not turned on by default.
1892550	1897990	And some vendors don't actually support this feature at all, meaning that compliance checks can always be bypassed in this manner.
1898570	1901150	Um, yep.
1901150	1907830	Uh, also we got a side note here that, um, we called it red scaler, but it makes more sense in British English than American English.
1907830	1909770	Otherwise, I guess we would have called it rescaler.
1911390	1913410	Uh, we're going to do a demo of this now.
1916440	1918360	So this picks up where we left off.
1918360	1923720	So we, we privest, we stole the config and this is what the config looks like in plain text.
1923780	1926420	So you can see it contains all the posture checks.
1930780	1933900	So now we're going to import that config into our red scaler GUI.
1940550	1943850	This is going to re-encrypt the config and put it in the right place.
1943950	1948630	You can see here, it's picked up some of the posture checks and asked if we want to apply those automatically.
1950350	1953870	Then it restarts red scaler and
1966180	1967080	we're logged in.
1973790	1975170	But we can't get to the internet.
1976250	1976710	Oh, it's okay.
1976710	1978490	We forgot to spoof BitLocker.
1978930	1980030	So we'll just spoof that.
1981130	1983210	Just to show you the posture checks are working.
1990720	1992160	You sunk my battleship.
1993800	1995940	That's a full house for all the products we looked at.
1995940	1998400	Bar the, uh, checkpoint side quest.
2001750	2004870	So let's have a couple of minutes on this privacy thing.
2004890	2014570	So due to the way these products work, they have to install , uh, a root CA in order to inspect less traffic and provide you some of the security benefits that, that they offer.
2014670	2020110	Um, I quite long lived here, like 2065, it's quite a long time for a set.
2020130	2027270	Um, the way these are pushed down typically either with the policies or they're installed with the client.
2027890	2033590	It's not really particularly difficult, uh, different to a traditional VPN appliance or, or a web proxy.
2033790	2038150	Um, but the difference here is that the zero trust engine is, is very much an unknown.
2038150	2041970	Your traffic enters there, it's decrypted and processed , that leaves again.
2041970	2046310	You're trusting that it's routed correctly, um, that nothing else happens.
2046310	2055030	Um, and we're sure this hasn't happened, but the compromise, a ZTN provider would allow some additional processing to be performed on the deep decrypted traffic.
2055070	2056950	Um, and you would never know.
2061190	2064310	So we'll talk through a couple of, uh, defense and mitigations here.
2064310	2071510	So the most important one is if you are an Xcode customer and you're not using secure enrollment, please enable it now.
2071910	2077530	Um, also ensure that clients are always updated, even if there's no CV published.
2077530	2081610	Just because there's no CV doesn't mean there's no bugs, so make sure you're always up to date.
2081650	2086990	Enable cryptographically secure checks or server side validated checks where they're supported.
2087430	2092450	Um, as far as we know, there's nothing for Netscape, but, um, ZTN do support this since version 4.4.
2092490	2102190	Uh, we've also shared some general hardening tips here and some mitigations to help limit the impact of config theft, for example, requiring re-authentication with a, a small re-authentication period.
2102470	2110110	And to minimize the attack surface for privilege escalation, disable client side access to features such as debugging and verbose logging.
2110290	2119270	Um, and finally, if you do use app based or domain based steering bypasses, ensure that these are appropriate for, and narrowly scoped, and they're reviewed on a regular basis.
2120450	2135490	To detect malicious behavior, you can look at vendors provided logs from newly registered devices, devices that perhaps quickly switch from passing failures and fa- passing posture checks and failing posture checks, and make sure that you're ingesting these logs into your scene.
2136190	2149710	You might also see devices coming from unexpected locations or, um, from unexpected operating systems, so for example, if a user normally uses a Mac, and then suddenly enrolls a Windows device, uh, you can also use EDR to detect activities on end points,
2149710	2158010	such as reading sensitive registry keys or files, uh, and some of the techniques we've discussed require process injection, for example, bypassing those signature checks.
2158070	2169750	Uh, equally, some vulnerabilities might cause a ZTNA process to spawn an unexpected child process, so using, uh, EDR to detect on unexpected child processes can be useful, too.
2171590	2176070	So, there's a couple of techniques that are good for detecting token and config theft.
2176070	2181650	Uh, Google have this brilliant blog that, uh, explains how to configure auditing from deep, for deep happy events.
2181750	2185430	Uh, this is actually aimed at detecting browser cookie theft, but also applies here.
2185490	2198010	So, if the data is, uh, flagged as auto, auditable during encryption, then the, the 4693 event will be raised during decryption, or when an attacker attempts to decrypt the value on the, on the machine.
2198330	2205370	But, unfortunately, none of the vendors actually flag the data as auditable when it's created, uh, so we can't use this 4693 event type.
2205470	2212950	However, we can use the very, very memorably named Microsoft Windows Crypto Deep Happy Log if we turn on debug locking.
2213030	2215330	And this is also detailed in the, in the Google blog.
2215330	2224030	And then this gives us a new event, event ID 16385, and we can use this to correlate the data description and the caller process ID to identify any potential misuse.
2224310	2235370	Uh, so in the case of Zscaler, you can see here, uh, when we installed Zscaler config earlier, uh, you can see the data description is client configuration, uh, which is the description that's set by Zscaler during encryption.
2236250	2248770	Uh, another option for audit, auditing access to sensitive registry keys and config files is to configure SACLs, uh, which will raise, uh, another event in the event security log, so this is, uh, event ID 4663.
2249010	2255610	Uh, and you can see here the event that was raised when we exported the secure token from, um, from the registry for Netscape.
2258600	2263680	So in conclusion, well it turns out there are no magic said TNA beans.
2264100	2268000	We've got the same old bug classes reimagined for a new technology stack.
2268000	2273600	Rather than zero trust, we're actually putting a lot of trust into these vendors and to process our data securely.
2273620	2277860	And we expect them to clearly and effectively communicate when they do fix vulnerabilities.
2278060	2283580	Even if those bugs are server side, so clients can make informed decisions regarding risk profile.
2284020	2287460	When the bugs exist only in one place though, at least patching them is efficient.
2287660	2293440	But even in that case, if the patch still requires you to change a setting, we think that this could be communicated more effectively.
2294040	2304140	Vendors are still putting far too much trust into client side components as we saw with authentication bypass and posture profile bypasses, which doesn't really fit the zero trust principle.
2304360	2311720	In summary, we found that in practice, rather than being never trust, always verify, we found it was more always trust, never verify.
2313700	2315060	So thanks for watching our talk.
2315060	2315880	We hope you enjoyed it.
2315880	2317200	We've got a link here to our blog.
2317200	2319860	We'll be publishing write ups over the next few weeks and days.
2320060	2323060	And you can come up and speak to us and we'll take some questions.
