start	end	text
0	7320	Welcome to my talk, No VPN Needed, Cryptographic Attacks Against the OPC UA Protocol.
7840	18820	My name is Tom Tervoords, I work as a pen tester, general security consultant for Bureau Veritas Cyber Security, and I'm personally based in the Netherlands.
19760	39960	When it comes to research projects, my specialization is kind of lies at the edge between offensive crypto research and pen testing, basically trying to achieve useful, well, pen testing results, pwning things, through practically exploitable crypto bugs.
40840	54640	I got a lot of publicity after I happened to find a flaw in an obscure protocol used for Active Directory, which led to the zero logon vulnerability, and now I get to spend a lot of time on research projects such as this.
55420	70740	So, during this talk, I'll first give a little bit of background on what OPC UA actually is, how the cryptography in this protocol works, and then I'll outline two vulnerabilities that I found, followed up with some conclusions.
71700	74640	So, OPC UA.
74760	78620	It's a protocol used for industrial automation.
78620	91300	Think of things like PLCs, SCADA systems, basically computers that monitor or manage or change things in the real world, on real machines.
91300	97540	Think of pipelines, solar parks, windmills, gas turbines, and so on.
97660	102100	There's of course many protocols in this space.
102100	121220	A lot of them are pretty old, based on old serial protocols, or they're proprietary, but OPC UA is a relatively new protocol, about 15 years old, and unlike a lot of others, it is standardized in an open standard, it has a lot of open source reference implementations,
121220	125220	and it's interoperable through different vendors.
125820	132400	But the aspect about it that I personally find most interesting is that it has security features.
133130	152560	And it has features for authentication, it has features for transport encryption, and because of this, a lot of users of OPC UA applications and vendors, they point out that, hey, now that we've got these nice security features, we can actually use this OT protocol across our trust boundaries.
152560	159740	Maybe even put a server on the internet, so we can more easily remotely manage things that are in the field.
159860	166360	And because we already have cryptography, we already have security features, we don't need to tunnel it over a complicated VPN anymore.
166360	172860	We can rely on these convenient security features that are already present.
173160	187040	So that, of course, makes it an interesting research target for me, especially because they're not relying on an existing standard protocol like DLS, but they implemented their own cryptographic protocol, so I decided to take a look at how these security features work,
187040	189820	and are there maybe any issues with it.
190740	196300	So in general, OPC UA, it has kind of two different layers in the protocol.
196300	214180	It has a communication layer or a secure channel layer, and that part is responsible for, well, doing the key exchange, to arrive at a symmetric key to encrypt subsequent messages with, and to authenticate the client and server device, to do basically the machine authentication parts.
214180	230320	Then once you've established this secure channel, you've got keys, you can start encrypting your messages, then before you really do anything, you need to also do a handshake on the so-called session layer or the application layer, and that is mostly responsible for user authentication.
230780	237240	And you can have different, you can start a new session on the same channel, and every channel needs to have a session.
237760	243080	It's also optional which authentication features you actually want to use, or which encryption features you want to use.
243080	254600	You can go for no encryption at all, you can go for only integrity protection, or also confidentiality protection, you can go for the machine authentication or user authentication, or both, or neither.
255220	271920	And for the machine authentication parts, certificates are being used, and, well, the protocol allows for different types of trust models, but what most implementers do in practice is that a device connects to a server for the first time, their certificate gets rejected,
271920	281980	then in a list the certificate will pop up as a rejected certificate, and the administrator can then choose to accept this certificate from then on.
281980	296280	So it's kind of a bit of a pretty pragmatic trust-on-first-use model that makes it easy to configure or to set up these connections without too much pre-configuration, although you can also just preload certificates on all devices that are talking with each other.
296980	305740	And all these different options, do we want to encrypt or not, do we want to authenticate or not, they're all being negotiated during these initial handshakes.
306440	319700	So the first of these two security handshakes, the secure channel handshake, it consists of two messages, an open secure channel request and an open secure channel response.
319960	337080	Both sides will generate a random number called a nonce, that will be different for every session, and then the clients, it will already know the certificates and configurations of the server in advance, because these are pre-configured or they are discovered through a mechanism that's kind of out of the scope of this talk.
337180	348860	So the clients, they will use the certificates, take the public key from it and encrypt the message from the server and they will also sign it with their own private key and they will attach their own certificates that the server can then validate.
349000	359940	If the server looks at the certificate, thinks it's fine, it will decrypt the message, verify the signature and then send its own response, also encrypted and signed.
360340	371060	And then both sides, they have exchanged this random nonce and they plug it into a key derivation function and they will be able to get a symmetric session key that they will use for all the follow-up communication.
372420	378220	Now part of this handshake is that the client will pick a so-called security policy that it knows that the server supports.
378400	381720	And the security policy is basically, it's like a cipher suite in TLS.
381720	384560	It decides what kind of crypto you're using.
384640	386140	There's a variety of options.
386140	398260	Most that are currently implemented in practice are either we don't want to use any cryptography at all or we use some variation of RSA and AES that are actually really pretty similar and mostly interchangeable.
399700	408100	So once you've done this handshake, the second handshake will happen and all the messages in this handshake, they're all encrypted with a negotiated session key.
411360	415580	And here once again, both sides generate a random number.
415580	417260	The standard also calls this a nonce.
417260	420620	I call this a challenge to make it easier to distinguish it.
420860	425700	And they will put this challenge in the encrypted message.
426440	429000	The client will send a challenge to the server.
429000	436380	The server will sign this challenge with its private key, which is the exact same private key that was used in the previous step.
437040	439300	And send the client its own challenge.
439300	442280	The challenge will sign that challenge, send it back.
442420	447740	This can be combined with user authentication and how the user authentication is used.
447740	453660	That depends a little bit on what authentication method you pick, like passwords or tokens or something else.
453660	459320	I'm actually not going to go too much into user authentication because that's not where the vulnerabilities were that I found.
460320	466420	So yeah, you basically just got a pretty straightforward challenge response protocol.
466500	473460	I give you a random number, you sign it to prove that you own a certain private key and to prove that you are who you say you are.
475000	488500	Something that's, well, if your experience with cryptographic protocol design that you may notice is that it seems a little bit redundant, all these signatures, because in the previous step, we already were doing signing and encrypting, now we're signing again.
488520	495160	Your, uh, both sides during the protocol are doing three different RSA private key operations, which are pretty expensive.
495340	501520	While if you want to have an authenticated key exchange, you can design a protocol that really only does one RSA decryption.
501840	506120	Uh, so, it's not really a great design in my opinion.
506120	512420	Uh, on the other hand, you could argue, well, better to do three times as many, uh, uh, operations than, uh, none at all.
512420	516480	Uh, maybe this will add some defense in depth or something, uh, uh, who knows.
516480	521180	So, let's take a look at, uh, how, uh, well this protocol actually stacks up.
522000	537440	So, what I, uh, noticed, uh, about these, uh, the signing of these challenges in this, uh, session handshake, uh, was that the type of message that's being signed, it's like the challenge of the other, uh, of the other party concatenated with the certificate of the other party.
537640	546280	And regardless of whether it's the signature going from the client to the server or from the server to the client, the stuff that's being signed is formatted in exactly the same format.
546280	551800	There's not like some meta data included that says this is a message intended from the client to the server or the other way around.
551860	554260	They really look exactly the same.
554600	567580	And that is something, when you see something like this, this may invite an opportunity for a so-called signing Oracle attack, where you pick one, uh, one message signed in one particular context, but actually plug it in in a different context.
568560	584480	And then I started working out on paper like a theoretical attack, um, that I would call a signing Oracle relay attack, where let's say you have two different OPC servers, and server A and server B, and me as an attacker, I go to server A and I say, hello,
584480	587980	I am actually server B, and you present a certificate of server B.
588200	590440	Um, I would like to log in.
590440	596080	Well, then the server A will say, okay , please prove that you're server B, here's my challenge, please sign it.
596420	605640	Uh, then you go to start a session with server B, and you say, hello, I am server A, um, I have a challenge here, I want to log into you, please sign my challenge.
605880	610080	So server B will sign the challenge , uh, as part of the first step of the protocol.
610080	616660	So you've got this nice signature now , that is actually a signature over the challenge that's originally server A generated .
616880	625500	So then you cut off the connection with server B, don't need it anymore, and then you actually plug in this signed challenge that you got from server B in the exchange with server A.
626540	637820	And that should allow you to finish the whole, uh, authentication protocol, and now you've effectively bypassed authentication, you've tricked these two servers in logging into each other, but actually giving you access.
638940	653140	Or even better, because it turns out in practice, many OPC implementations are set up in a way that servers by default trust their own certificates, so you can actually just log into server A while claiming to be server A, you're logging into the server as itself.
653500	665880	And you just set up a second connection where you make the server sign its own challenge, drop that second connection again, resume the first connection, and then you've got an authentication bypass where you're logged into server A as server A, which usually has,
665880	667280	uh, maximal privileges .
668620	676080	Of course, this whole theoretical attack only really works on the second phase that I showed, this, uh, this session handshake.
676080	684640	Before you can even make any encrypted messages in this session handshake, you first need to do this, uh, this whole secure channel, uh, handshake that also involves the private keys.
684960	691160	So if our attack would make any sense in practice, we first need to somehow bypass this first step.
692040	698460	And it turns out there's actually a very easy way to bypass this first step by looking at OPC UA protocol varieties.
699000	709600	Uh, in most use cases, uh, OPC UA is used as a binary protocol directly layered over TCP, but there is a variance that's, uh, based on HTTPS.
709980	721240	There, um, uh, basically all your OPC messages are wrapped in HTTP, uh, challenges and responses and you set up a standard, uh, server authenticated HTTPS, uh, connection.
721780	730780	And because then the TLS layer will already offer a transport crypto, uh, the protocol designer says, okay, now we can skip this whole, uh, secure channel step.
730780	734340	We can directly move into the session step because we already have encryption.
734340	736380	We don't need to establish it ourselves anymore.
737300	740280	Um, and then we go right to the vulnerable session handshake.
741180	753460	And what's interesting about this is that when you do server authenticated HTTPS, well, it authenticates the server, but it doesn't authenticate the clients while their own custom handshake implicitly does authenticate the client.
753460	764120	So they actually have kind of different properties and we can take advantage of that by, well, just simply skipping this, starting on HTTPS.
764120	767800	I don't need to prove my identity to set up an HTTPS connection.
768000	771000	And then I, uh, try to carry out this attack or this attack.
771180	775420	So I wrote a tool that does exactly that and it turns out it totally works.
775420	781100	Uh, you just point it at an HTTPS based OPC UA server that uses this client authentication feature.
781180	783820	It's not going to bypass the usual authentication.
783820	788240	So if the server, uh, is configured to always require a password, that's not going to work.
788240	799580	But in most cases where you have like really machine to machine authentication, so you're really talking about automated device, then it's, yeah, makes sense to not use user authentication, but use this client server authentication.
799640	804140	And if you support HTTPS, well, I just completely bypassed it.
804560	812100	Uh, only downside though, from the attacker's perspective, in practice, almost nobody actually really uses this HTTPS variant of the protocol.
812100	813980	It's a relatively new feature.
814120	819160	It's, uh, supported in a few implementations, but it turns out there's not really much need for it.
819200	820800	People don't really care about it.
820880	825520	There are a bunch of implementations that open up an HTTPS port by default.
825520	828980	So if you don't change the default configuration, it will expose this.
828980	834900	And even if you don't use it, you may still be, uh, completely vulnerable, assuming that you don't block off this port in your firewall.
835020	841800	So it definitely is a potential risk, especially when you use an implementation that turns this on or when you actually do rely on HTTPS.
842380	847140	But it probably does not affect the majority of OPC UA, uh, deployments.
847420	854600	So I wanted to look a little further and see, is there a way where I can actually attack the standard TCP version of the protocol?
854600	857760	And then I need to get past this first secure channel step.
858280	864860	Now something that's, um, I noticed is in the list of supported, uh, ciphers of supported security policies.
864860	871060	There is one that has a, uh, well, a familiar, uh, uh, name for me.
871060	885900	Uh, it uses, uh, RSA for encryption using the PKCS1 panning scheme, which is a, uh, a way of using RSA that has pretty much been definitively broken in 1998 by Daniel Blankenbacher in this, uh, really nice paper.
886160	895680	Uh, but a lot of protocol designers since didn't appear to have gotten a memo about this and kept putting PKCS, uh, one in their protocols.
895680	905000	Just as the case for OPC UA, which I think the first version was from like 2006, but they still supported this basically broken, uh, encryption mechanism.
906220	908780	However, they eventually did deprecate it.
908780	922160	So there's one, uh, security policy that supports this broken mechanism, but, uh, implementers, they're told, hey, please implement support for this, but turn it off by default and discourage its use.
922600	927280	Um, of course that doesn't stop a lot of implementations from just turning this on by default.
927280	930380	Anyway, this deprecation advice is not always followed in practice.
931260	936140	Um, also the reason giving for the deprecation advice is about SHA-1.
936140	938080	It's not about PKCS, uh, one.
938080	940940	So, uh, people may get the wrong idea.
940940	946000	Think, uh, rightly think that, oh, the fact that you use SHA-1 is completely unexploitable in practice.
946000	946820	I don't care.
946820	948040	I'm going to turn this on.
948160	954100	Uh, there can also be a lot of users that have like a preexisting configuration from before the deprecation advice.
954100	961340	Then if the vendor implements a patch to change the defaults, they're probably not going to change preexisting configurations because that may break stuff.
961860	973020	Also, very interestingly, there are applications that even when, uh, the weak cipher is turned off, uh, you can still send a message that's encrypted using PKCS-1.
973080	980960	The server will still try to decrypt it and only realize that, hey, this, uh, I'm not actually supposed to use this after it's done the decryption.
980960	989600	So in a later stage it will block the connection, but then it has already done a decryption and for, uh, the particular attack that I'm going to explain, that's really all you need.
990320	993760	And besides that, you only really need one vulnerable server.
993880	1004780	Uh, once you've got one place where you can do an attack on PKCS-1, you can also attack, uh, other servers that implement a more secure protocol, uh, but that reuse the same public key.
1005680	1024240	So a quick, simplified primer on Bleichenbacher's attack, um, RSA encryption is, uh, basically just, um, uh, modular exponentiation of a large integer and because the message that you're trying to encrypt may not actually be a large integer, it may be like a value like one or something that you don't really want to exponentiate,
1024240	1026640	you need to turn it into an appropriate integer.
1026880	1040080	So how PKCS-1 padding does this, it, uh, adds a zero in front, it adds a two byte in front, some random bytes, a zero byte, and then it adds the message bytes and it treats this, this as a big integer it's going to encrypt.
1040500	1049600	Um, then after the server decrypts it, well, it gets, it gets this integer and it needs to convert it back in a message, so it checks this padding and then it removes the padding.
1050160	1058640	However, if you do the decryption operation and you get an integer that doesn't match this, uh, padding format, uh, then the server should fail decryption.
1058640	1062040	So it's, uh, will probably just, uh, reject the message.
1062600	1076300	And the attack becomes possible at the moment when you, as an attacker, can distinguish the case where a server says, hey, this padding is wrong, I'm going to reject this message, or when it behaves differently and it does accept the padding, but maybe then fails in a follow-up step.
1076720	1087040	Uh, and when you know that you've given, like, some kind of forged cipher text and you know the end result of decrypting it has valid padding, tells you a really important piece of information.
1087040	1092240	Apparently, when I make the cipher text, it will decrypt to something that starts with a zero with a two.
1092300	1099640	So it's apparently greater than the, uh, than an integer that starts with zero two, and it's smaller than an integer that starts with zero three.
1099640	1102700	So it leaks a bunch of information about the plain text.
1103020	1111300	And RSA also has the property that if you have a, um, encrypted value that you don't know, you still have the capability of multiplying it with the value that you choose.
1111300	1125480	So you can kind of multiply this unknown plain text with chosen, uh, with chosen values, give it to the server, get it to decrypt it, and if you do that in a, uh, in a clever way and you pick the right values, you can kind of, uh, look at all these, uh,
1125480	1131600	padding results and you can kind of narrow down what the original plain text is supposed to be by constantly asking like, hey, does this have valid padding?
1131600	1132600	Does this have valid padding?
1132740	1147280	And then eventually after about a million attempts, which is why the attack is also sometimes called a million message attack, you should eventually be able to have decrypted all the, uh, all the bytes in the message and you've effectively broken RSA.
1148680	1153700	So how would we, uh, use this attack against OPC UA?
1154020	1163460	Uh, well, in this, uh, handshake, there's really two things that are being done with RSA, uh, private keys, uh, on the side of you as a client and you're trying to impersonate the client.
1163460	1164720	So that's what you want to attack.
1165060	1171800	First, you have to sign a message and then, uh, you get the message back from the server and you have to decrypt that message.
1172100	1173860	Uh, well, decryption is straightforward.
1173860	1178840	You just do the attack, uh, in its, in its standard form and you have decrypted that message.
1178840	1181860	You know the nonce, you can proceed to derive the session keys.
1182520	1194020	Um, and for signature forgery, uh, that's actually, uh, like I've already pointed out, uh, not a big problem as well because RSA signatures are basically just decryptions of hashes.
1194120	1204660	Uh, you can just do the exact same attack, um, trying to decrypt a hash value and, uh, you will end up with a valid, uh, signature value.
1205440	1207580	So this would look something like this.
1207580	1212220	You start out by doing this whole, a million message attack until you've spoofed the signature.
1212240	1216860	What's nice about this first step that once you've done this once, you can just keep reusing this message for the signature.
1216860	1220560	So you, so even if the second step fails, you don't have to repeat the first step.
1221120	1223500	Uh, so you do the whole exchange with the spoofed signature.
1223500	1225720	You get a message back that's encrypted.
1225720	1228000	You can't pick out the nonce from it yet.
1228080	1236500	So you do this whole attack again, uh, while you keep the session open, which is important because if the moment you close the connection, the nonce will be forgotten.
1236540	1237880	It's no longer useful.
1237880	1246940	So you kind of have to keep like one TCP session open and use a different TCP connection to do this whole black and bucket attack and keep sending some people lives because the attack may take a while.
1247040	1251760	And then once you're done, you know the nonces, you can proceed with the next step.
1252100	1257140	And, uh, as I've showed with the attack against HPS, we've already broken this next step.
1257140	1263140	And even if you couldn't use that attack, you could also use black and buckers attack, even for the session handshake in just the exact same way.
1265700	1269000	So to make this work in practice, you need a padding oracle.
1269000	1273760	You need a way to have the server tell you, is my padding correct or is my padding not correct?
1273820	1277880	For some implementations this is really easy because you just, they just give different error messages.
1277940	1280780	With wrong padding, it says something like decrypt failed.
1280780	1284480	When the padding is right, it says something like signature validation failed and you're done.
1284480	1286760	You can just use the attack in its standard form.
1287220	1292180	Unfortunately, most implementations that I tested have a very generic error message.
1292180	1300020	So in either of the two cases, they show exactly the same error codes and you can't really tell by looking at it what actually happens.
1300240	1302240	So then we need a different approach.
1302240	1307360	And the typical way to do that is by using a timing side channel attack.
1308580	1314140	Maybe if you have correct padding, their server will take a different amount of time than if you have wrong padding.
1314380	1318960	And that's something that at first to me, well, sounded like, ah, this is probably not going to work.
1318960	1319980	This sounds really hard.
1319980	1329360	I've seen plenty of papers where people managed to pull themselves in practice against a padding Oracle attack like this, but you're probably going to have to send a lot of messages.
1329360	1333420	You have to do some complicated statistics, deal with network, jitter.
1333420	1335720	It sounds pretty hard to do a timing attack.
1335720	1342040	I mean, timing attacks have the reputation of being complicated, but keep in mind, not all timing attacks are hard.
1342040	1346740	Think of like the SQL injection, where you add like a sleep five second statement to your query.
1346740	1350800	Well, seeing if a server blocks for five seconds or not is very, very easy.
1350800	1361660	And it turns out you can do something a little bit like that in OPC UA and actually make your timing attack super easy because the way that they're using RSA is very weird.
1364760	1375760	The messages that they encrypt instead of like first encrypting a symmetric key, encrypting the message with that, they directly encrypt the message itself, but Oh no, the message always contains a signature.
1375760	1378500	It's way too long to fit into a single RSA block.
1378500	1383200	So what we do, we split up the messages in different blocks and we encrypt each block individually.
1383200	1390280	So it's kind of the same principle as like the ECB modes, the notorious ECB modes in block ciphers.
1390640	1397660	Now for RSA it does have a little bit different weaknesses and different properties when you use like this kind of ECB modes.
1397740	1407340	Actually you could probably hide penguin pictures pretty well when you do this, but it opens up all kinds of potential chosen ciphertext attacks.
1407340	1409720	It's really a bad idea to do it this way.
1410360	1421980	But what I could use it for when trying to get this black and bucket attack to work is to take like my guess for this whole black and bucket attack, this one ciphertext I want to try and I simply repeat it a hundred times.
1422840	1427320	And then I sent this long message of like 100 concatenated ciphertext to the server.
1427680	1432940	If my padding is wrong, it will try to decrypt the first message, see the padding is wrong, throw an exception, stop.
1433520	1437120	If the padding is correct, it will decrypt the first message, move on to the second message.
1437120	1439220	Well, it's the same, so the padding is also going to be fine there.
1439220	1443880	Decrypts the third, fourth, fifth, sixth, and then it does like 100 RSA decryptions.
1444020	1446940	And then at the end it realizes my message is bogus.
1447460	1457940	But yeah, RSA decryption is a very expensive operation and doing it a hundred times, you get some pretty sizable timing differences even when you use less than a hundred messages.
1457940	1460140	So this is like a screenshot of my tool.
1460140	1468400	And in this example you can see like when you have incorrect padding, it takes the server about 0.005 seconds.
1469080	1473300	But when the padding is right, there's actually like a 10th of a second difference.
1473300	1478180	So these are really huge timing differences that are like super easy to measure with just a simple Python script.
1478280	1482060	Of course, maybe you have some weird network jitter or issues.
1482060	1491140	So to weed out these false positives, I just simply made my Python scripts, try it a few times again when it does have a hit.
1491540	1499160	And the nice thing about Bleichenbacher attacks is that the cases where you have correct paddings, so the slow cases in this, those are far more rare.
1499160	1503200	So by far the most of these, like 99% of the messages you're sending will have wrong padding.
1503200	1505100	So they actually go by really fast.
1505300	1509780	And only the few interesting ones that give you more information, these are slow.
1509780	1517380	So carrying out this attack with these big messages isn't actually that much slower than using an error-based padding oracle.
1518340	1521320	So I implemented this whole attack in a tool.
1523400	1525760	I threw it at the lab environments.
1525760	1531980	I made a nice little spitting progress bar thing with numbers that will slowly go up and they go up a little further.
1531980	1536700	And then after about, in this case, eight and a half minutes, it has done the first stage.
1536700	1538360	It has managed to spoof a signature.
1538420	1542320	Then it goes to repeat the whole attack again while keeping the connection open.
1542320	1561780	And then in 15 minutes total, bam, we've completely bypassed authentication on the OPC server by using a timing attack involving about a million messages that really only took 15 minutes, which suddenly starts to sound pretty practical for a timing attack involving a million messages.
1561860	1571940	Now I'm cheating a little bit here because this is basically the fastest example I had, because this was against a server that had a very fast implementation written in C.
1571960	1576480	On other servers, the attack may take like 30 minutes, one hour.
1576480	1578980	Slowest case I found was two hours.
1578980	1585400	It's kind of the difference between you as an attacker having to go out for a coffee or having to go out for lunch while waiting for this attack to finish.
1585800	1594980	And what I also noticed in most implementations, because this attack kind of happens in an early stage of the protocol and it's not really something that's really expected to happen.
1594980	1597940	A lot of implementations don't do any logging because this happens.
1597940	1602500	So if you're like an administrator and you look at the logs, you don't see anything suspicious.
1602500	1603820	You really don't see anything at all.
1603820	1608560	You don't see somebody is pounding your server with like millions of weird messages.
1610280	1621260	So I tried out these two attacks on seven different implementations, which I choose because that's where I happen to be able to get a lab environment to work.
1621260	1624360	Didn't need like expensive hardware or software licenses.
1625300	1633460	And out of these seven implementations, five of them were vulnerable to at least one of the attack variants.
1633820	1638820	And four of those had like one of the two attacks that would work in the default configuration.
1638820	1642460	So you didn't have to like turn on the legacy cipher.
1642460	1645620	You didn't have to tweak anything.
1645620	1646820	You just go for a default.
1646820	1651140	You only turn on like the fact that you want to use this client authentication.
1651580	1654520	And one of my attacks would work out of the box.
1654720	1659240	And for some other implementations it would work if you had a particular kind of changed configuration.
1660380	1664980	Now these are just seven implementations I managed to get my hands on.
1664980	1666840	Five out of seven is a pretty high number.
1666840	1677520	You can probably extrapolate from that that's well if we would try this against more implementations there's going to be more that's going to be affected.
1677520	1682960	In the end, these doing these attacks successfully, they do depend on configuration.
1682960	1688000	They do, they do depend on implementation details, but they are still protocol flaws.
1688120	1692520	So it's safe to say that probably a lot more implementations will be affected.
1692880	1702020	And indeed, after I did a responsible disclosure, I saw like advisories coming in from different vendors that had confirmed that they were also affected.
1702600	1711680	Like CodeSys, Siemens, had a whole bunch of like WinCC products where they managed to confirm, okay, this attack is actually very relevant for us.
1711680	1717060	And there will probably be more implementations like that coming forward.
1717780	1723380	So, well, I found this for seven different products, but there's probably going to be many, many more that are affected.
1723380	1725400	How the hell do you even disclose this?
1725580	1739600	Well, thankfully, I didn't really have to do this myself because OPC UA, practically all the vendors that make an implementation of the protocol, they're all connected to the OPC foundation, which like curates the standards.
1739600	1745280	And they have like their own responsible disclosure policy, their own like security processes.
1745960	1747760	And I could just go to them.
1747800	1749420	I could just contact them.
1749420	1751420	So I sent like a responsible disclosure.
1752120	1762280	And they responded to me in like two hours and invited me to like a meeting in the exact same day to where I could explain the details of the attack, which is very impressive.
1762280	1764240	Actually, my compliments to the OPC foundation.
1764240	1768540	That's not how responsible your disclosure usually goes in my experience.
1769260	1777200	And they basically took over all the hard work of going through all these vendors, sharing the details with them.
1777200	1790320	Some of them came back with specific questions for me and together the foundation would figure out like ways, okay, how do we solve these tricky issues in a way without breaking stuff for our customers?
1791000	1792640	Which is very, very nice.
1792640	1793380	I'm very happy.
1793380	1802420	I didn't have to go through all these vendors one by one and maybe even vendors where I'm like, well, I didn't actually test your solution, but you may be potentially vulnerable because you're using a flawed protocol.
1802440	1807000	I'm very happy that the foundation would pick this up for me.
1807200	1809400	A bunch of CVEs got issued.
1809600	1822740	What may be a little bit confusing here is that some vendors, they issued their own CVE and some, they reused the same like standard CVEs to describe the whole protocol flaw, but some products, they give different CVSS scores to the same CVE.
1822740	1825520	So it's a little bit confusing when you're looking at the CVE number.
1825520	1827280	Sometimes you see one CVSS score.
1827280	1832180	Sometimes you see another CVSS score and it kind of depends on the particularities of one implementation.
1832800	1836020	The way this got fixed, it kind of depended on the vendor.
1836140	1838000	Some were like, well, nobody uses HTTPS.
1838000	1840520	I'm going to turn HTTPS off, for example.
1841880	1856860	So for some, they tried to implement like mitigating measures to make it like very difficult to exploit like the padding Oracle in practice, made it impossible to do like the timing attack in the way that I described and also weren't like their end users.
1856860	1859260	Hey, please turn off this legacy cipher.
1859900	1871780	If you want to know what your vendor did or more importantly, what you should do when you are using an OPC UA implementation, I recommend to look at their advisories and their documentation.
1872520	1878920	And when you're not entirely sure about that, I will first check if this is relevant for you.
1878920	1887460	And this is relevant for you if you rely on this certificate based authentication, but you don't use user authentication because once again, my attack, it's still not going to get user passwords.
1887780	1889200	There's one small exception.
1889200	1892120	There's like a feature where users can also use certificates to log in.
1892120	1894680	And there's like a few edge cases where you can bypass that as well.
1895500	1901480	But in generally it's, this only really applies to the certificate based system authentication.
1902180	1905660	And if you're not sure, well, did my vendor patch this or not?
1905660	1907000	Am I affected or not?
1907000	1911280	I'm using something very different than what's listed here and maybe I can't patch it.
1911440	1924940	I published a tool that's available now, that allows you to like scan for like these vulnerabilities, try to carry them out in practice.
1925660	1928560	And well, I tested them against these seven implementations.
1928560	1935260	So I kind of hope that if it works against these seven, it should probably work against other compliant implementations as well.
1935260	1938800	If they don't, please send in a bug report.
1938800	1945840	And hopefully that can help people out to try this out in practice and test their own setups.
1947160	1950380	So what can we take away from this?
1951400	1959000	Well, first of all, always important to reiterate, protocol design, cryptographic protocol design is hard.
1959000	1966280	You may be using like military grade encryption because you use AES and RSA and SHA-2 and so on.
1966280	1975420	But these are really low level building blocks and putting them together in a way to make a, a valid protocol is very difficult.
1975420	1982840	Ideally you really want to involve cryptographic experts, especially of course this protocol is like 15 years old.
1982840	1993040	We know a lot more now on how you can actually design better protocols, how to use formal methods to test them, how to, uh, just better design practices in general.
1993040	2000020	So for, to an extent, you can't really blame the original designers that they didn't really know, uh, these more modern approaches.
2000040	2008440	Uh, but yeah, uh, if you would, if I would design a protocol like OPC UA nowadays, I would just say, yeah, I'm not going to design the crypto myself.
2008440	2009620	I'm just going to use TLS.
2009960	2010420	Done.
2010420	2014120	Please just use TLS when you have a client server protocol like this.
2014120	2018260	If you don't have very particular properties that you need, just use TLS.
2018880	2029260	Um, also, uh, well more than a quarter century later, once again, it's, uh, it's shown that like a Bucker's attack is still relevant.
2029260	2031820	It was still relevant against TLS for a long time.
2031820	2037420	People try to implement fixes to make PKCS1 work in some other way, constantly kept getting broken.
2037420	2042280	It was broken when they decided it was a good idea to support this in JSON web tokens.
2042280	2043780	It just keeps getting broken.
2043780	2046660	Just never ever use PKCS1, turn it off.
2046820	2050720	Uh, just treat this whole petting scheme as fundamentally, uh, broken.
2051320	2058740	Uh, and yeah, when you look at vulnerabilities like this, of course, I am, uh, I may only be scratching the surface here.
2058740	2066420	You really can't rule out that other people may find other crypto bugs in OPC UA or maybe in one of the other elements.
2066420	2073820	I didn't even go for like the old pops up protocol or discovery protocol or certificate updating protocol.
2073820	2075960	There is quite some attack surface here.
2075960	2077840	Uh, interesting research area.
2078300	2084520	And we can't expect that, uh, well, once these particular issues are fixed, you'll be fine in the future.
2084920	2092880	Um, so does that mean we all have to go back to using VPNs again when we, uh, post OPC UA over a trust boundary?
2093600	2096840	Well, I would say depends a bit on the circumstances.
2096840	2113580	If you're in a situation where you cannot easily patch and you know, you cannot easily patch in the future, then I would definitely say, okay, uh, like it's common in, uh, OT setups, you need to rely on network segmentation because you probably cannot respond quickly to when new vulnerabilities like this crop up in the future.
2114020	2124700	If you can, uh, uh, patch promptly when like another crypto bug would turn up or, uh, uh, or another type of vulnerability, then it may be acceptable.
2124700	2142880	Although I would recommend to use IP allow listing, uh, because if there's like something like a pre-authentication bypass or, uh, and the crypto bug that's allows a similar type of authentication bypass or a certificate validation bug and especially researchers from clarity have found a lot of those types of issues.
2143540	2146300	Um, you don't want to expose your thing to anyone on the internet.
2146300	2153060	So at the very least for these authentication bugs, I would recommend to always use IP allow listing, especially if your server controls something important.
2153620	2156320	Uh, and otherwise it really just depends on your threat model.
2156320	2159500	And, uh, this is probably an eventuality you should take into account.
2160180	2162180	And, uh, yeah, this was my talk.
2162180	2164800	I think I finished, uh, in the time pretty well.
2164820	2171880	Uh, if people have questions, uh, you can just, uh, approach me right around the corner outside of the hall here.
2171880	2173680	And, uh, thank you all very much for attending.
