start	end	text
8460	10760	Alright, this is our agenda for today.
10760	13240	First, we'll be going over what WAFs are.
13240	15140	I think many of you already know what they are.
15140	17100	Otherwise, you probably wouldn't be here.
17400	20180	Just so we start with an even play for everyone.
20460	22720	Then, we'll go over what we've learned at Datadog
22720	24660	operating a very large-scale WAF
24660	26920	and the struggle that comes with it.
27340	29840	We'll try to address a bit how we deal with
29840	32260	false positives and false negatives.
32580	35800	And then, we'll finish by sharing
35800	38040	how we try to make them a bit better.
38600	40880	Alright, who are we first?
41460	43760	I'm Emmanuelle. I'm a software engineer at Datadog.
43760	44760	I'm based in Paris.
44760	46200	And I've worked on machine learning models
46200	47420	for the past four years.
47420	49300	So, not a security background at all.
49460	51480	And actually, last year, I decided to join Datadog
51480	53940	to work on our application security product.
54440	56220	And this is my co-presenter, Emile.
56860	58500	So, I'm Emile Gospier.
58500	61780	I'm a security researcher at Datadog,
61780	62780	also based in Paris.
62780	64860	I've been working on a WAF and a RASP solution
64860	66460	for the last five years.
66560	68120	First, at Screen, then Datadog,
68120	69940	following an acquisition in 2021.
70500	72300	And, yeah, let's talk about WAFs.
72300	73660	You may know about them.
74020	76020	If you don't, that's a security tool
76020	78940	that was created in the mid-90s,
78940	82900	when web applications started to become more complex,
82900	86600	more useful, and thus, a more enticing target.
87120	89100	We didn't really have anything to do
89100	92160	to help protect them.
92160	93980	So, we looked at other tools,
93980	96160	and a promising one was firewalls.
96160	98060	They're working really great at the network level.
98060	100220	So, the idea was, let's take them
100220	102720	and bring them to the application layer.
103080	104900	And instead of running on specific rules,
104900	107000	like this IP, this port, this whatever,
107000	110220	it was more, yeah, let's run regexes or dictionaries
110220	114280	to find suspicious patterns in that.
114280	116300	And if you find them in the incoming request,
116300	117540	that's probably because it's bad.
118460	120920	And, yeah, that's pretty much it.
123080	125080	WAFs today are pretty much the backbone
125080	127180	of runtime application security.
127180	128760	And that's for a few reasons.
128760	131460	First, they are super easy to explain.
131500	133480	In just a few words, I was able to give you
133660	135320	a good view of what they are.
136180	138440	They're also incredibly easy to customize.
138440	140880	Because they're based on regexes and dictionaries,
140880	142880	you have an entire industry of rulesets
142880	146380	that you can use, or you can even customize them yourself.
146860	148640	They're also really easy to demo.
148640	152080	All you need to do to show that your WAF works
152080	154220	is plug it on the Internet.
154500	157280	And just the noise from the Internet
157280	158720	is going to create a bunch of alerts,
158720	160080	and, hey, you have a great security tool,
160080	161160	you're protecting everyone.
162580	164140	And finally, it never hurts,
164140	165660	it's actually recorded by compliance.
165800	169640	So if you're dealing with credit cards,
170400	171800	yeah, you need a WAF, basically.
171940	174340	So, yeah, all of that came together
174340	176860	to make WAF an incredibly popular product.
178840	181300	However, WAF tends to give
181420	183400	a bit of a false sense of security.
183440	184720	Because what a WAF does
184720	188400	is that it looks for suspicious requests.
188400	190040	It's running regexes, dictionaries,
190040	191240	that's what it does.
191540	193340	But then it means that if you can make
193340	197660	your malicious attack look unsuspicious,
197660	199040	then it's going to go through.
199560	201360	And if you happen to have a user
201360	202580	that sends another request
202580	206760	that happens to look suspicious,
206760	207900	they need to be matched.
208340	211760	And there is not really anything you can do about it.
211760	213340	That's WAF working as design.
214200	217060	So, yeah, a few alternatives were tried over time,
217060	218700	like RASP, IASP,
218700	220640	but they never really went anywhere.
220960	223460	No solution really got anywhere as popular as WAF.
225160	226680	We talked about what they are.
226980	229300	Emmanuel is going to tell you about how to make one.
229300	230800	Yeah, how do we build a WAF?
230800	232640	Well, first, of course, you need a web application
232640	234240	because that's what you want to protect.
234240	235800	In front of that, most of the time,
235800	236640	you're going to put a reverse proxy
236640	239600	to route all the incoming traffic to your web application.
240020	240680	All right.
240900	242500	Now, let's build a WAF.
242600	245160	First element that we need is a rule engine, of course.
245160	246440	We're going to put it on the reverse proxy
246440	247760	because it's very convenient.
247760	249340	It's where we're going to be able to see
249340	250880	all the incoming traffic and filter out
250880	252960	the malicious request if we need to.
253800	255960	Second element we need, a rule set.
256360	258380	Here, we're mentioning the OWASP core rule set
258380	261020	because it's a very popular one across the industry.
261020	262920	It's open source, so you can also use it
262920	265240	to build your own rule set on top of it.
265240	269080	Here, you can see we mentioned PL1 for Paranoia Level 1.
269580	272240	What it means is it's supposed to be not too noisy,
272240	273920	so it's supposed to be a set of rules
273920	276140	that shouldn't trigger too many alerts for us.
276160	277160	Okay. All right.
277160	277740	Well, good.
277740	279620	Last element we need, the monitoring.
280200	283220	It can be just a text file where you push all of your alerts,
283220	286660	or it can be a super fancy dashboard that you've built.
288220	288940	Okay.
289200	289880	We're all set.
289880	291240	I think we can activate the WAF.
291240	292660	And this is more or less what happened
292660	293900	the first time we did it.
293900	295480	We started crying.
295740	297600	We got a bunch of alerts.
297640	299880	And we were like, okay, what do we do with this?
300360	302180	And we took a step back and were like, okay,
302180	304640	this is actually a great learning experiment.
305080	306560	So what did we learn, Emil?
308640	310700	So the learnings we are going to share
310700	314240	are based on us operating a WAF at a pretty large scale.
314240	316580	We are talking around a billion requests per second
316580	318840	across hundreds of thousands of organizations.
320060	322260	And the first and most important learning
322260	326280	we took away from that is that the accuracy of a WAF rule
326280	328420	is totally unpredictable at scale.
328620	330800	You can think that your rule is perfect.
330960	333380	Until it's tested, you have no idea.
335600	338560	So they will tend to converge quite fast.
338780	342600	So if you can test them on a broad enough set of data,
342600	344120	within a few hours you will have a good idea
344120	345060	of how it's going to behave.
345060	349300	But if you only tested them on WordPress or CMS,
349300	352100	and you deployed them on an e-commerce website,
352100	353580	I mean, you can have a French customer
353580	355660	going to share their address,
355660	358280	which has a quote and OR,
358280	359640	and then the WAF is going to freak out.
359640	362320	I mean, of course, this is a SQL injection, no?
363020	363880	Yeah.
365580	367660	The other important consequence from that
367660	370640	is that even if you do very simple modifications,
370640	373020	like you just expand it a little bit further,
373020	376240	like you add a couple of duplication steps,
376240	377340	you need to test them again
377340	379780	because you don't know what you are missing before.
380720	383280	The other side of this coin, however,
383280	385260	is that even if you have a crazy rule
385260	386940	that shouldn't work,
387720	390120	it's usually worth testing them just in case.
390460	392260	To illustrate that, we're going to go back
392260	394700	like to late 2021,
394700	397240	when AppSec just caught fire,
397240	400820	and we had log4j drop on us a few weeks before Christmas.
401440	403100	And for those of you who don't know,
403100	405960	it was an RCE in the log4j library,
405960	408760	which is used by Java application to log.
408760	409820	And if you don't know,
409820	412220	Java applications love to log.
413340	415400	So when it came out,
415400	417460	the initial PLC was something like that,
417460	422000	where if you could get log4j to log this,
422000	423740	you had an RCE.
424780	427160	So yeah, everyone started scanning all over the place.
427860	431080	Pretty much every WAF vendor or user
431080	433680	set up their own pattern, and we did too.
433720	435560	The first version was something like that.
435560	438520	So, okay, we just match gndi,
438520	441840	which is the entry point of the bug in log4j,
441840	444200	and then pretty much everything that follows.
444440	445720	We test it.
445840	446600	Okay, it's fine.
446600	448000	It triggers a little bit.
448400	450400	No obvious pattern of false positive.
450400	451440	Okay, good to go.
451440	452300	We can ship it.
453200	454960	And yeah, it worked well.
455200	456760	Very quickly, however,
456760	459760	the attackers tried to find bypasses for that.
459760	460800	So the first one they found was
460800	462280	they could use a different schema.
462320	465540	The initial PLC used LDAP to perform the RCE,
465540	467120	but actually you could use another schema,
467120	468720	so they just did.
469300	472720	In our case, we were not really looking at LDAP,
472720	473960	so we didn't really care.
474020	478340	But then they decided to step things up.
478340	479400	So they started to use
479400	482300	the string interpolation features of log4j
482300	485440	to obfuscate their pattern further.
486300	489580	So, okay, we need to complexify quite a bit the pattern.
489580	492180	So every single character we had before
492180	494340	became this whole mess
494340	496960	to support some amount of obfuscation.
497080	499460	Then attackers decided to step things up further.
499460	501180	So, okay, now you have completely spurious blocks
501180	503080	that are just going to disappear.
503720	506300	Okay, we can expand the pattern further.
506300	508460	This is becoming a bit unwieldy.
508460	511380	For each character you have in the initial pattern,
511380	513060	you have this whole mess there.
513600	516120	And attackers just got crazy.
518640	522120	This could either be the most complex waffle ever,
522120	523660	or we need a different type strategy.
523660	525440	So when we saw that,
525440	528160	we basically tested two rules.
528200	532120	One monstrosity that could deal with that,
532120	533700	or something much simpler.
535080	536640	And we are shocked,
536640	539760	but this never triggered the false positive.
540840	543120	Like, that's why we're telling you
543660	544540	that you need to test rules,
544540	546720	because this shouldn't work.
548160	551760	And, yeah, the last bypasses we found at the end
551760	554720	were attempts to use non-ASCII characters.
554820	557000	So here, like, log4j would do some kind of
557000	558280	unicode normalization.
558860	560560	Yeah, at this point you need to do the same.
560560	561900	And that's expensive.
564660	566960	Yeah, and when we put this in production,
566960	570340	it triggered roughly half a million triggers in a week.
570340	572040	And that was before the acquisition of Datadog,
572040	573640	so at a much smaller scale.
575700	578900	We told you about how you design a rule,
578900	581640	but there is a greater framework behind it
581640	582700	and some constraints.
582700	584460	So let Emmanuel tell you about the dilemma
584460	585860	of building a WAF rule.
585860	588200	Yes, so when you build a WAF rule,
588700	592200	we try to kind of display this into a graph.
593300	595060	On the horizontal axis,
595060	597420	you can have a very broad rule that will catch everything,
597420	599620	or a very specific rule.
599880	601180	And on the vertical axis,
601180	604220	you can have either a rule that's very easy to bypass,
604220	605820	but doesn't give you too many false positives,
605820	608980	or here on the top, it triggers a lot of false positives,
608980	610160	but it's hard to bypass.
610880	612880	All right, based on that,
612880	615560	we try to define a max amount of noise
615560	616960	that we're willing to accept,
616960	619920	meaning if a rule starts triggering more false positives
619920	620960	than this threshold,
620960	622500	we're not even going to put it into prediction
622500	625280	because it's not worth the hassle.
626180	629640	Okay, now an ideal rule we could try to build
629640	630800	would be something very broad
630800	633840	that's going to catch every XSS attack that we're getting.
634360	634940	Dope.
634940	636640	And it doesn't trigger too many false positives
636640	638380	and it's not too easy to bypass.
638380	640140	All right, it's right in there in the middle.
640140	641360	On the other side,
641360	643100	you could also try to build a rule
643100	644500	that's very, very specific,
644500	648660	meaning it could only target a very specific XSS vulnerability
648660	650180	for Jupyter notebooks.
651160	652840	And same, not too easy to bypass
652840	654560	and not too many false positives.
654820	655380	Dope.
655420	657260	Well, that would be an ideal rule
657260	659420	because actually what happens most of the time
659420	660760	when you try to build this rule
660760	662660	is you end up right there.
662860	664400	If you do a very broad rule,
664400	665520	you're going to have a lot of false positives
665520	667420	and if you do a very specific rule,
667420	669440	you're going to be bypassed very easily.
671020	672220	So what happens?
672540	674940	Most of the time, you're going to be in this yellow area
674940	676900	right there, the space of operation.
676920	678540	And what you want to do, ideally,
678540	680120	is to be right there in the middle.
680120	681920	So you are doing, kind of,
681920	684140	having the best of both worlds, so to speak.
685300	686920	All right, so we've talked about
686920	688600	how we don't want too many false positives
688600	690160	because they are nasty.
690520	692800	Well, let me tell you or kind of remind you
692800	694000	why we don't want them.
694080	696300	First, they are going to create an alert fatigue.
696300	697640	So, yeah, there is nothing worse
697640	700260	than you come into work and you see 10,000 plus alerts.
700260	701380	What do I do with this?
701680	703920	It's not worth looking at it
703920	705020	and it's not actionable.
705840	707260	Second reason why.
707260	709280	Well, it can have a business impact.
709560	711800	If you have rules in blocking mode,
711800	713680	you might be blocking legitimate customers
713680	716180	with a wrong setup.
716460	717860	And if you're blocking customers,
717860	718760	you're losing business.
718760	720260	If you're losing business, you're losing money.
720260	721640	So you don't want that either.
721860	723700	And the last reason why you don't want false positives
723700	726740	is because you might end up collecting PII by accident.
726740	729380	Meaning you might collect some private information
729380	731940	like addresses, emails, phone numbers.
731940	734080	And this might end up in your log triggers.
734920	736120	And because of that,
736120	737920	you're going to have a security issue on your hands.
737920	739580	So, yeah, you don't want that either.
740720	742520	Overall, what you need to keep in mind is that
742520	744520	it's all about finding this compromise.
744520	746820	You want a rule that doesn't have too many false positives
746820	748900	but still brings you value.
750420	751380	All right.
751820	754020	In all this time working on false positives,
754020	756220	at Datadog, we've been able to see a bunch of them
756220	757400	and we've tried to classify them
757400	758980	into different types of families.
759400	761100	The first family we've encountered
761100	764500	most of the time is based on what they are.
764600	768440	Meaning you get a bunch of triggers coming from free text.
768760	770500	For example, you're running an application
770500	771680	like Stack Overflow.
771680	774640	You have a bunch of people pasting SQL injection all the time
774640	776080	because they're asking questions about it.
776080	777140	And this will trigger your WAF
777140	780420	if it's set up in a way where it looks at free text.
781380	783340	Second family you can have is
783340	784900	if you're running any type of infrastructure
784900	787140	that's having an admin panel,
787140	792680	running SQL queries against your DB.
792680	795400	This is going to look like SQL injection to your WAF.
795400	796960	So let's say you're running phpMyAdmin
796960	799100	that could happen most of the time.
799960	804600	And also, if your application is relying on some concept
804600	807660	like you're doing a lot of queries all over the place.
807660	809920	For example, at Datadog, that's an issue that we have.
809920	811780	We're running a ton of queries everywhere
811780	814400	and it looks like SQL injection a lot of the time.
814400	815820	So what do we do with that?
816300	819700	Most of the time, when we run these queries,
819700	822000	they have the keyword query in them.
822000	824280	So we decided to pass list the word query
824280	826100	to get rid of those false positives.
827780	829800	And different type of rules are going to be sensitive
829800	832620	to different type of false positive families.
832660	834460	So you have to kind of look for them.
834700	838800	For example, if you manage to detect
838800	841280	some false positive based on the free text,
841280	844920	what you can do is just pass list free text
844920	846980	for some of the rules that trigger on them.
849720	851320	We've talked about families.
851320	853120	So now, how do we catch them?
853300	855300	Because it's all good and fun,
855300	857540	but how do we actually find them in our application
857540	859620	when we have 10 plus thousand triggers?
860000	861700	Well, you can do a bunch of statistics.
861700	864360	So yeah, that's where the ML engineer comes into the room
864360	867100	and tell you you should do statistics on your triggers.
868540	871800	You can look at application or trigger trends.
871800	874480	So what I mean is, let's say you're...
874480	876600	you can look at your global traffic trends
876600	879100	and see how many queries you're getting.
879220	882080	And then what you can do is look at your trigger trends.
882080	883580	If you have a rule that has a traffic
883580	888220	that follows a lot your global application traffic,
888220	890360	then it's probably a false positive here.
890580	893580	We took an example of something with your data dog here.
894340	896160	Yeah, you have a rule here, the yellow rule,
896160	897520	that's triggering a lot of the time.
897520	899600	It's like, I don't know, you cannot really see it here,
899600	904280	but 250k triggers most of the time
904280	906420	and across all days, every day.
906440	907440	So that's where we're like,
907440	909420	okay, we have a false positive on our hands.
909900	911380	And here, on the other side,
911380	913280	you can see here a purple bump.
913280	914380	It's actually a security scanner
914380	916320	and this is a rule that works perfectly fine.
916320	918340	You can see it's not spread all over the place.
919000	920660	If you're in doubt and you don't know
920660	922620	if the trends that you're seeing
922620	926100	are actually kind of matching the trends of your traffic,
926100	929240	you can also look at the IPs that are triggering your alerts.
929240	931080	If you have a very broad range,
931080	932760	meaning everyone that's coming into your application
932760	934640	is actually triggering your rule,
934640	937700	you also have a rule that's having a false positive issue.
938380	939500	And on this side here,
939500	941180	I decided to kind of show you
941180	943920	what a Nelfy-ish traffic would look like.
943920	945880	So you have a bunch of bumps, ups and downs.
945880	947200	It's not super regular,
947200	950620	so this is typically what Nelfy rules
950620	954380	would be outputting in terms of number of triggers.
954720	955760	All right.
956240	958180	Now let's take it a step further
958180	959640	and let's see if we can actually do
959640	962620	any kind of machine learning path processing.
963720	965880	Yeah, you can start with embeddings.
965880	968320	So I don't know if any of you are familiar with embeddings,
968320	970800	but they are used, for example, in LLMs.
970800	971960	So it's very trendy at the moment
972780	974800	and you can use them to...
974800	976880	basically use them as a hash function.
976880	978320	You give it a payload,
978320	979540	so it could be any type of string,
979540	982120	and then it will give you back a vector of numbers.
982520	985240	Here, it's going to be much larger than a 2D vector,
985240	987140	but for the sake of this example,
987140	988580	I kept a 2D vector.
989000	989860	And what you can do is,
989860	991940	you put it in some kind of graph.
992700	994600	Here, okay, we put it there.
994600	997360	Then, as we have a new payload coming in,
997360	999320	that we know is also a false positive,
999780	1002220	we also put it through the embedding function
1002220	1003820	and we get a new representation.
1004140	1006160	And they are kind of clustered together,
1006160	1008820	so we can kind of define a false positive area,
1008900	1010020	a false positive cluster.
1010680	1011740	And what this means is that
1011740	1013040	when you have a new payload coming in
1013040	1014960	and it's actually a real trigger,
1015420	1016540	you're able to see it,
1016540	1018700	because it's further away from all the false positive clusters
1018700	1020100	you've been able to build.
1020240	1023820	So you can kind of deduce false positives
1023820	1024780	or new false positives
1024780	1026340	based on what you already know.
1027120	1028740	All right, old fun games,
1028740	1030180	but if you're lazy
1030180	1032680	and you don't want to do all this manual clustering,
1032680	1033600	it's very cumbersome,
1033600	1036040	you can do some more fancy things.
1036040	1038100	So you can do classification, for example.
1039020	1040880	You can use machine learning models
1040880	1043160	like the classic old-school ones,
1043160	1045420	or you can even use OpenAI LLMs,
1045420	1046600	if you feel like it.
1048460	1049280	If you do that,
1049280	1050660	some of them will work out of the box,
1050660	1051560	so it's super nice,
1051560	1052920	and some others,
1052920	1054620	if you want it really tailored to your use case,
1054620	1055400	it's not going to work,
1055400	1057000	so you will need to fine-tune them.
1058320	1059520	And let me tell you,
1059520	1060300	this is a hassle,
1060300	1061100	like we've tried,
1061100	1062760	and this is very tricky to do.
1063340	1065600	You need to build a legit data set,
1065600	1067140	so a lot of real triggers
1067140	1068000	and a lot of false positives
1068000	1070380	to actually make it make sense.
1070620	1071100	And here,
1071100	1072120	I took a plain example
1072120	1074020	that we had when we did a trial.
1074080	1075260	So we gave it an embedding,
1075420	1076620	a bunch of payloads,
1076620	1079580	and we picked an OpenAI LLMs,
1079580	1080340	we fine-tuned it,
1080340	1082960	and we gave it an actual SQL injection payload,
1082960	1083320	and we were like,
1083320	1084400	OK, what is this?
1084400	1085200	And it replied,
1085200	1086360	it's a true attack.
1086400	1087820	Dope, OK, it's working.
1088000	1089580	And then we did the same thing,
1089580	1091540	but we just put a comment after,
1091540	1092420	and it was like,
1092420	1093020	oh no, no,
1093020	1094280	this is not an attack,
1094280	1095380	this is actually just someone
1095380	1096760	randomly coming to your application
1096760	1098360	and pasting that.
1098860	1099680	So yeah,
1099680	1101540	this is a blatant case of false negatives,
1101540	1102660	and this can happen a lot.
1102660	1104000	So if you're going the route
1104000	1105580	of doing some fancy machine learning
1105580	1108080	to deal with your false positives,
1108080	1110740	just try to build a good data set.
1110940	1111340	And yeah,
1111340	1113760	it's just fancy statistics, basically.
1114280	1115040	All right.
1116260	1117700	What if we talk about
1117700	1119340	the blind spots of the WAF now?
1120160	1121340	So that's the part of the talk
1121340	1122700	where the security vendor tells you
1122700	1123240	it's totally fine,
1123240	1124460	the product doesn't work.
1124460	1126720	No, more seriously,
1126720	1130080	WAFs have a problem with obfuscation.
1130240	1131860	If you hide your payload,
1131860	1133100	it's going to go through.
1133100	1134340	And this is mostly because
1134340	1135880	of what the internet is,
1135880	1137580	which is a bunch of RFCs
1137580	1140220	from the late 80s, early 90s,
1140220	1142200	and all of the weird implementation bugs
1142200	1143620	we had since then.
1143740	1144720	And as a vendor,
1144720	1146340	you can only really easily
1146340	1148260	find the first ones.
1148580	1149900	What are we talking about
1149900	1151740	with, like, those weird bugs?
1151840	1153520	You have a web server
1153520	1154720	that I'm not going to name
1155540	1157100	that happens to perform
1157720	1159660	recursive decoding of URLs
1159660	1161540	and support non-serial syntax.
1161740	1162720	What this means is that
1162720	1164300	you have this monstrosity here
1164300	1165820	and it's going to be converted
1165820	1167060	into an open bracket.
1167060	1167520	Why?
1167520	1168640	Because, I guess,
1168640	1170260	some engineers hate us.
1171620	1172300	SQL.
1172300	1173240	That's great.
1173240	1174040	It's a language.
1174040	1174900	It's standardized.
1174980	1176420	Every database engine
1176420	1177540	is using the same.
1177580	1177960	Right?
1177960	1178280	No.
1178280	1179080	No, of course not.
1179080	1180060	MySQL decided to make
1180060	1181460	some commands conditional.
1181460	1182600	You have this command
1182600	1185140	and in specific version of MySQL,
1185140	1185860	it's not going to be
1185940	1186800	a command anymore.
1188680	1189800	Thank you.
1190920	1192260	Last but not least,
1192260	1195140	you can't define a list of value
1195140	1197000	in a URL parameter.
1197180	1198340	Like, it's just not supported
1198340	1199060	by the other specs.
1199060	1200020	So, if a developer
1200020	1200660	wants to do it,
1200660	1201260	of course,
1201260	1203160	they only send it in the body.
1203160	1204860	That's what it's there for.
1205240	1206180	No, of course not.
1206180	1207020	Every single web server
1207020	1207780	does something different
1207780	1208460	and passes,
1209100	1210280	like, turns an array of parameters
1210280	1210980	into a list.
1210980	1215530	The best way to deal
1215530	1216650	with this kind of obfuscation
1216650	1219750	is to work around it completely.
1219750	1221010	We have one advantage
1221010	1222290	as defenders,
1222290	1223970	which is that we know
1223970	1224970	what the application
1224970	1227050	on the other side of the WAF is.
1227050	1228170	We have some insight.
1228170	1228730	We know that we could
1228730	1229890	know the language,
1229890	1230790	the framework,
1230790	1232050	what it's expecting.
1232370	1234070	And using that,
1234070	1235110	you could tell the WAF
1235110	1237750	to decode the incoming parameter
1237750	1239330	just like the application
1239330	1240350	would do it.
1240350	1240850	It does not mean
1240850	1241450	that we would be able
1241450	1242910	to decode everything.
1243110	1243730	But in practice,
1243730	1244450	you don't care.
1244450	1245210	Because if the application
1245210	1246550	can't decode a parameter,
1247250	1249450	then the parameter can't harm it.
1250090	1251350	It's not perfect.
1251350	1252370	Specifically, it won't work
1252370	1253570	if the parameter is integrated
1253570	1254570	by something else,
1254570	1256610	so specifically XSS,
1256610	1257390	where the final target
1257390	1258510	is a browser.
1258510	1259590	But it's very effective
1259590	1260570	against all kinds
1260570	1262930	of URL encoding,
1262930	1264230	HTTP shenanigans.
1264230	1265630	Like, if you can just extract
1265630	1266210	what the application
1266210	1268450	is going to see,
1268450	1269510	then you're golden.
1269510	1272050	Moreover, another problem
1272050	1273130	WAFs need to deal with
1273130	1274610	is performance.
1274650	1275990	The way most WAFs are set up
1275990	1277310	is they add their latency
1277310	1278450	to the response time
1278450	1279550	of your application.
1279610	1281550	Meaning, if your application
1282470	1284270	answers in, like, two milliseconds,
1284270	1285770	and you spent a lot of resources
1285770	1286990	to optimize it,
1286990	1288610	and the WAF just barges in
1288610	1289650	and adds, like, 100 milliseconds
1289650	1290830	of latency,
1290830	1292510	that's unacceptable.
1292790	1294450	So WAFs need to be able
1294450	1296150	to fit within those constraints.
1296330	1299010	Moreover, even if you're not
1299010	1300270	under attack,
1300270	1302230	we notice that even a small
1302230	1303430	minority of long payload
1303430	1305790	is enough to tank the performance.
1305950	1308130	Like, surprisingly little.
1309670	1310850	What this means is that
1310850	1312390	you have a few constraints
1312390	1313590	that WAFs are never really
1313590	1314650	going to be able to
1315170	1316390	work around of.
1316390	1317530	So, for instance,
1317530	1318550	if your WAF is not passing
1318550	1319390	the body,
1319390	1320630	and the application is expecting
1320810	1322390	a large JSON payload,
1322390	1323710	then all the attacker has to do
1323710	1324830	is to put the attack
1324830	1325770	at the end of the payload,
1325770	1327230	and they're in.
1329010	1331530	Some WAFs also have some constraints
1331530	1332930	on the time they are allowed to take.
1332930	1334370	And if they start taking, like,
1334370	1335730	let's say more than five milliseconds,
1335730	1336610	all right, they disconnect,
1336610	1337270	they are like,
1337270	1338470	there's too much impact.
1339310	1340690	And all an attacker has to do
1340690	1341530	is to increase the load
1341530	1342870	on the WAF just by sending
1343070	1345690	a bunch of requests,
1345690	1347650	and, yeah, they're in.
1348670	1349830	And, yeah, finally,
1349830	1350610	the obfuscation,
1350610	1351850	the WAF can do it.
1351910	1353810	It can try to parse the parameter
1353810	1355230	as a browser would do it,
1355230	1356250	but it's expensive.
1356250	1357850	So you need to figure out
1357850	1359250	how do you want to spend your budget.
1359250	1360150	And you might decide,
1360150	1362990	okay, this decoding would be very effective,
1362990	1363630	but actually if I use it
1363630	1364470	on all of my rules,
1364470	1366210	I'm, like, spending half my time
1366210	1366950	just doing decoding
1366950	1369150	and not actually running rules.
1370250	1372130	There are a few solutions to that,
1372130	1374590	such as running the WAF async.
1375130	1376970	They all have, like, terrible problems,
1376970	1378410	from not being able to block
1378410	1380730	to you could direct all of your traffic
1380730	1382590	to some kind of cloud infrastructure,
1382590	1384450	but then you're adding latency,
1384450	1385350	you're saying all of your traffic
1386010	1387110	don't know where.
1387390	1389310	So, yeah, that's kind of terrible.
1391570	1392930	Finally, WAF,
1392930	1394110	and I'm going to blow your mind,
1394110	1396170	don't know what they don't see.
1396190	1397530	So if you have an attack
1397530	1398610	that the WAF don't catch,
1398970	1400070	the WAF won't be able to tell you
1400070	1401670	that you are under attack.
1402070	1403050	What this means is that
1403050	1404950	to be effective with WAF,
1404950	1406450	you kind of need to do threat intel.
1406450	1407450	You need to be able to do
1407450	1410650	quick and quiet deploy of rules
1410650	1411550	to be able to know
1412250	1413510	what's happening in the wild.
1413510	1415330	Doing some kind of shadow deployments.
1416050	1417710	The scale at which you do that
1417710	1419350	depends on what you can do.
1419350	1420290	Like, it can be an only pot,
1420290	1421550	but then you're mostly going to catch
1422010	1423570	against the noise of the internet.
1423870	1425050	You may be able to do it
1425050	1426770	on your internal services,
1426770	1429510	but, yeah, you'll get a better idea
1429510	1430970	of what an actual attacker
1430970	1432690	is going to do for your kind of application.
1432950	1434110	And if you're a vendor
1434110	1435770	and can work with it
1435770	1437230	with your customers,
1437230	1438270	you can even deploy it
1438270	1439290	in customer environments.
1439290	1440510	And that's amazing,
1440510	1441210	because then you see
1441750	1442970	a very broad diversity
1442970	1444830	of attacks.
1444830	1446010	Like, you see what the actual
1446010	1447910	threat landscape is like.
1448290	1449890	And when you do
1450430	1451970	and you catch someone,
1452670	1454010	WAFs are really good
1454010	1455430	at leveraging mistakes.
1455430	1457990	If you find any identifying pattern
1457990	1459470	in an attacker,
1459470	1460690	you can leverage it.
1460690	1462070	Be it user agent,
1462070	1463910	they're using this old version of Firefox.
1463930	1464770	All right, I'm just going to match
1464770	1465910	everything from that.
1465910	1466550	It could be the IP
1466550	1467990	or the range of IPs.
1467990	1468970	It could be the domain
1468970	1470670	they're fetching their attacks from.
1470670	1471910	It's very common for accesses
1471910	1474370	to load the payload
1474370	1476490	from some given domain.
1476670	1478330	Or, and that's the best one, typos.
1478550	1479510	The attacker does a typo.
1479510	1480450	All right, I just want to match
1480450	1484670	all of the typo headers.
1484730	1486470	And then once you have all of that,
1486470	1488230	you dump all of the attacker traffic
1488710	1490910	and you burn it all at once.
1491170	1493270	And yeah, destroy that toolkit.
1495750	1497370	So, we talked a bit about
1497370	1498510	what WAFs are,
1498510	1500170	what their issues are,
1500170	1501290	what the false positive,
1501290	1502090	false negative,
1502090	1503110	what they're good at.
1503110	1504630	Let's talk about making them better
1504630	1506050	for end users.
1506950	1509410	The first and most important point
1509410	1511170	is you need to
1512430	1513590	embrace the strength
1513590	1514810	of the WAF
1515470	1517430	and stop seeing a WAF
1517430	1519010	as a protection tool.
1519610	1521330	It won't be very good at that.
1521330	1522370	If you want something to catch
1522370	1523610	every single exploit
1524110	1526230	going to your application,
1526230	1526970	there are things,
1526970	1528950	there are products that do that.
1528950	1530250	There are RAS, there are IAS.
1530370	1531810	There are some solutions,
1531810	1532750	but WAFs are not it.
1532750	1533490	What a WAF is,
1533490	1534810	is a monitoring tool.
1534810	1535890	A WAF will tell you
1535890	1536770	that you're under attack
1536770	1538110	and give you a feeling
1538110	1539010	for the kind of attacks
1539010	1540310	that the attacker is sending.
1540310	1542110	It won't give you everything.
1542250	1543550	If you wanted to do it,
1543550	1544270	you can.
1544290	1545310	It's called, like,
1545310	1546370	here, this rule,
1546370	1547230	trade secret.
1547270	1548710	You just match that star.
1549210	1550490	You can get everything.
1550730	1552330	It will be totally unusable.
1554910	1556290	Next one,
1556290	1557130	rule testing.
1557890	1560750	You can have a good turnkey experience
1560750	1561850	in a WAF.
1561850	1562850	But for that,
1562850	1564370	rules need to have been tested
1564370	1567110	on every single kind of workloads.
1567150	1570130	And this requires massive scale.
1570130	1571470	On top of it,
1571470	1573330	whoever is doing the rule qualification
1573330	1574930	will need to decide
1574930	1577750	how much noise is good enough.
1577750	1578770	And that's going to depend
1578770	1581850	from a deployment perspective,
1581850	1583350	from a company perspective,
1583350	1584470	from a... yeah.
1584470	1587230	It even changes on an engineer basis.
1589090	1590070	The best way
1590070	1591190	for someone to guarantee
1591190	1592070	that the rule is going to work
1592070	1593650	is to do some kind of shadow deployment,
1593650	1594610	meaning running the rules
1594610	1595470	on your environment
1595470	1596690	without blocking.
1597630	1598890	And, yeah.
1599170	1600190	Doing all of that,
1600190	1600650	you need to make sure
1600650	1601630	not to catch any PII
1601630	1603050	because otherwise you're in trouble.
1605050	1605890	All right.
1605890	1606730	Next up,
1606730	1607610	you can try to leverage
1607610	1609090	your application context.
1609090	1609630	Meaning,
1609630	1611270	if you're able to give data
1611270	1612710	about your application to your WAF,
1612710	1613450	like, telling it
1613450	1614970	which language you're running,
1614970	1615350	telling it
1615350	1617310	which framework you're using,
1617310	1618470	then, in that case,
1618470	1619290	you'll be able
1619290	1620410	to increase the precision.
1620410	1621590	Let me give you an example.
1621610	1621990	You're running
1622170	1623650	a JavaScript application.
1623650	1624370	You're receiving a bunch
1624370	1625410	of PHP attacks.
1625410	1626610	Well, you don't really care
1626610	1627490	about those.
1627490	1628210	They're not going to hurt
1628210	1629090	your application.
1629090	1630510	So, what you need to do
1630510	1632090	is just discard those.
1632330	1632990	If you're running
1632990	1634930	some kind of PHP,
1634930	1635350	for example,
1635350	1637370	the SilverStripe framework,
1637370	1638750	it was vulnerable to XSS
1638750	1640030	in older versions.
1640710	1641690	Well, if you're not running,
1641690	1642090	if you're running
1642090	1643250	up to the latest version,
1643250	1643910	you also don't care
1643910	1644450	about the alerts
1644450	1645190	that are targeting
1645190	1646310	the older version.
1646310	1647570	So, yeah.
1647570	1648490	If you're able to do that,
1648490	1649990	you'll increase your accuracy.
1650110	1651210	And one other side effect
1651210	1652450	that can be good for you
1652450	1653610	is you're also able
1653610	1655330	to detect threat actors
1655330	1656270	that will be sending,
1656270	1656670	for example,
1656670	1657870	Java attacks to your app
1657870	1658930	when you're not running
1658930	1659450	any Java,
1659450	1660710	and you can kind of increase
1661530	1662330	the attention
1662330	1662910	that you're giving
1662910	1664050	to this malicious IP
1664050	1664870	and gather a bunch
1664870	1665390	of threat intel
1665390	1666390	on top of that.
1666810	1667950	The only downside
1667950	1668570	is it's going to be
1668650	1669450	a bit challenging,
1669450	1670790	meaning you have to have
1670790	1671690	your security team
1671690	1673010	work with your engineering team,
1673010	1673570	and God knows
1673570	1674530	it can be tricky
1674530	1676150	to do sometimes.
1676310	1677870	So, if you're able
1677870	1678530	to do that,
1678530	1678910	you can build
1678910	1680530	this feedback loop
1680530	1682090	that will be improving
1682090	1682410	greatly
1682410	1683250	your experience
1683250	1684210	with the WAF.
1685790	1687370	And the last element
1687370	1688110	that you can try
1688110	1689150	is to tune the response
1689150	1689650	to the attack,
1689650	1690870	meaning if you're able
1690870	1691950	to catch a specific IP
1691950	1692690	that's been targeting
1692690	1693270	your application
1693270	1694490	for a while,
1694490	1695510	you could dynamically
1695510	1696590	roll out a new rule set
1696590	1697730	for this specific IP
1697730	1699470	and catch more attacks
1699470	1700770	coming from it,
1700770	1701210	and you could catch
1701210	1702170	everything and see
1702170	1703750	what's coming up.
1703770	1705130	And, yeah,
1705130	1705570	if you're able
1705570	1706050	to do that,
1706050	1707210	and on top of that,
1707670	1708610	what you could try,
1708610	1709270	if you're unsure
1709270	1710090	if the actor
1710090	1711610	is actually malicious,
1711610	1712510	we should be able
1712510	1713730	to enable
1713730	1714530	different types
1715170	1716270	of responses.
1716270	1716590	First,
1716590	1717310	we should be able
1717310	1718690	to have a capture
1718690	1719810	and then only
1719810	1720930	block after.
1721910	1722530	Remember,
1722530	1722990	we talked a bit
1722990	1724230	about how we can do
1724230	1725450	some analysis
1725450	1726410	of false positives.
1726410	1727270	If we're also able
1727270	1728190	to leverage that
1728190	1729030	to feed that back
1729030	1729650	to the WAF
1729650	1731610	and build dynamically
1731810	1732730	a bunch of passive rules
1732730	1733510	so we don't have
1733510	1734510	as many false positives,
1734510	1735570	it's even better.
1735570	1736190	We could be even
1736190	1736890	more confident
1736890	1737950	when we actually enable
1737950	1739030	the WAF in blocking
1739030	1740250	mode on some rules.
1741190	1742050	All right,
1742050	1742970	this is our
1742970	1744210	final takeaways.
1744830	1746890	If you're a defender,
1746890	1747590	look at your WAF
1747590	1748790	more as a monitoring system
1748790	1751030	than as a protection system.
1751250	1752050	You should try to
1752050	1752830	launch your false positives
1752830	1753530	because this way
1753530	1754090	you will be able
1754090	1754930	to leverage
1754930	1756390	the actual alerts
1756390	1757350	that you get.
1757350	1758610	And if you're building
1758610	1759470	some kind of rule set,
1759470	1760390	make sure that you keep in
1760390	1761090	some flexibility
1761090	1762330	for your engineering team.
1762330	1763390	Meaning if you do
1763390	1764650	very restrictive
1764650	1765430	type of rule set
1765430	1766410	and as soon as
1766410	1767010	your engineers
1767010	1767970	are changing the app,
1767970	1768850	they're breaking everything,
1768850	1770050	it's not worth it.
1770470	1771670	If you are a vendor,
1771670	1772550	well, I think
1772550	1773110	it should be
1773110	1773990	our collective mission
1773990	1775730	to propose
1775730	1776850	to our users
1777210	1778910	a very low noise
1778910	1779870	rule set.
1780110	1780530	And then
1781330	1782390	also support them
1782390	1783230	in their efforts
1783230	1784390	to actually analyze
1784390	1784970	their triggers
1784970	1785710	and the trends
1785710	1786770	that they have.
1787530	1788130	And if you're collecting
1788130	1788610	any type of
1788610	1789450	threat intelligence,
1789450	1790110	please share it
1790110	1791470	across all of your customers
1791470	1792390	so everyone can benefit
1792390	1793230	from it.
1794070	1794790	And last,
1794790	1795650	if you're an attacker,
1795650	1796530	well, you're in luck
1796530	1797370	because there will
1797370	1798470	always be bypasses
1798470	1799070	to the WAF.
1799070	1800010	We've talked about them
1800690	1802270	because of the WAF's nature.
1802570	1803610	So keep in mind
1803610	1804230	that you should probably
1804230	1805050	rotate your infrastructure
1805050	1806530	because we will leverage
1806530	1807070	all the mistakes
1807070	1807690	that you make
1807690	1809370	and if you don't rotate,
1809370	1810070	we'll catch you
1810070	1810770	and we'll thank you
1810770	1811270	for that.
1811270	1811670	And then
1812430	1813410	if you have to invest
1813410	1814810	in one type of application,
1814810	1816170	please only invest
1816430	1817070	in ambiguous
1817070	1818270	interpreted obfuscation.
1818270	1820790	HTTP is worthless.
1821130	1822150	Alright,
1822150	1824050	we're at the end.
1824170	1824730	Thank you for
1824730	1825890	listening to us.
1825890	1826390	applause
1829390	1829850	music
1829850	1830470	music
1830470	1831610	music
1831610	1831690	music
