start	end	text
0	8260	I'm going to introduce you to our next speaker. He's currently working as application
8260	18260	security engineer at global.com, which is a news media and TV network from Brazil. He has OSCP
18260	24100	and OSC certifications, jumped into soft engineering to help develop teams improve the
24100	29260	quality of their code by finding vulnerabilities as soon as possible. He's very
29260	33960	interested in development, exploit development and building security tools to automate
33960	41920	the process of security issues during the SDOC or CICD, you choose. His presentation is
41920	49080	going to be about Husky CI, finding security flaws in CI before deploying them. Give a
49080	57080	round of applause to Rafael Santos.
57080	62380	Hello. Well, thank you very much. I'm very excited to be here. It's first time here
62380	67340	speaking in Vegas, so today I'm going to talk and present a tool that I have been working on
67340	76600	with my security team and it's called Husky CI. Who I am? I have already been presented, but
77280	83280	as a Brazilian I play a lot of soccer and when I play soccer I usually play as a left winger.
83940	94980	And last year I was working a lot in the pain testing field and this is something that I did, some
94980	100400	sorts of certifications in this field. And currently I'm working as a security engineer at
100400	108120	Globo.com and Globo.com is the largest media company in Brazil and in Latin America. It's actually
108380	116660	a TV channel. We host some famous shows like Big Brother Brazil and The Voice Brazil. And my
116660	123720	passion is about writing security tools and trying to understand how the process of exploit
123720	130480	development is and this is some of my passions. So today I'm going to talk about a story about a
130480	138040	day in the life of a development team. So let's imagine that there is this development team that
138120	146900	they have their project, they have that repository that is hosting in GitLab and during the
146900	155060	process of developing their project they actually use for example Tsuru. Tsuru is our platform as
155180	163940	a service that is open source, but you can also use Heroku and AWS to deploy our project. And
163940	172240	later on we have our project in production. So this is basically the overview of a day in the
172900	179160	life of a development team. So let's imagine that this developer wants to develop his features
179740	189980	and try to do his commit to the repository and all tests are being used in his CI. So we already
189980	196840	have these configurations being made, the build, the iOS, Android and linked and the test. So
196840	204060	later on we at global.com we ask to another developer to do this manual code review. So to check
204060	211700	if there are some flaws and something that was not seen by this automated test. And if that is
211700	219540	correct this commit is merged to master and we deploy it to our platform as a service and later
219540	228300	on the project is in production. So as a security team this process we see there's something
228300	236460	is missing. I mean no security test is being made here. So as some security teams we say wow,
236460	241640	you are actually coding in Go. Have you ever heard about this static analysis called GoSec
241640	249520	that is open source? It's very good so you can add it into your CI so we can find eventually
249540	255260	security flaws before deploying it. So the developer actually, the development team actually
255260	262500	include this in their test and this is something that we as a security team thinks that is very
262500	269160	good. But later on another developer that is working in another language that is Ruby, the same
269160	274820	process, we as a security team comes to the team saying hey, have you ever heard about Brakeman
274820	281520	that is also an open source tool that do the same thing and the same process goes and the team
281520	288780	will eventually put that in their CI as well. But what happens if there are a lot of other
288780	295200	languages that we do not know? For example, which static analysis tool does these
295200	303840	developers must use if you use Java or JavaScript? So we as a security team could eventually
303840	311840	ask them hey, what about using a tool that we could eventually create that developer may
311840	318380	abstract and will not have to worry about which security tool she or he would eventually try to
318380	326660	use and this is what we dream. This would be great if we were able to do that. So a day in the
326660	331540	life of a bigger organization. As I was saying, we are actually talking about one security
331540	336640	as one development team. So global.com is a huge organization, we have a lot of
336640	342720	developer teams, so if we try to scale this scenario, we have a lot of development teams, we have a
342720	350560	lot of pull requests, we have a lot of commits and each one uses its own repository, GitHub,
350560	355480	GitLab, so everyone is deploying, everyone is doing this thing. Unfortunately, our security
355480	360840	team can't be inside all of the development teams, so all this commit is being made, is being
360840	367560	deployed, and later on our security team will do some tests, some manual tests, some pen tests on
368100	372660	this project that is already in production. So this is something that is very bad in our
372660	380180	perspective, because there's a lot of coding involved. So at global.com we have this project
380180	386700	that is called the Hack Day, this is actually my t-shirt that I'm using, that is a hackathon
386700	393840	that we take a day, a day or two to do a lot of everything that we want, and this was a great
393840	401020	opportunity to us as a security team to try to develop in this security tool. So what would be our
401020	406440	dream? We have all these development teams, each one using its own repository, we would
406440	414120	eventually add this security tool in EverCI, and eventually some may eventually pass and some
414120	422200	will eventually fail. And for those that fail, we will eventually receive this response, because
422200	431240	we can eventually have this emailed and that is good to us to know what vulnerability is being
431240	436140	found. And for example, for this second development team, it will eventually see, oh, we have
436140	440500	found this vulnerability, all right, let's correct it and send another pull request, and we'll
440500	448740	eventually mitigate it. But for some development teams, this may not be so easy. So by using
448740	454740	this tool, we can eventually put this security analyst inside that team to understand that
454740	462080	vulnerability, for example. We do not know how to mitigate this SQL injection, would you help us?
462080	467500	So our security team may eventually be there and try to help them, and now this deploy can be
467500	472960	made. So this is our dream. And later on, our security team will eventually continue doing
472960	480600	these pen testings and manual testings in our productions. Okay, so what are we coding? At
480600	487780	global.com, we code in a lot of languages. So we use a lot of Golang, use a lot of Python, we use
487900	493600	a lot of Ruby, use a lot of, a lot of languages, and this is maybe, and this is, we eventually
493600	498760	meet the, the same scenario as you face every day. And I even challenge you to, to check this
498760	504600	slide and see, you, you may eventually miss some language that you work on, and that shows how
504600	510660	challenging it is to us to, to, to security team to, to handle this. So as we are working in the
510660	515540	hack day, we were just trying to focus on these three languages at first. We're trying to use
515540	522500	Golang and Python and Ruby, and there are three open source tools that are being done. And this
522500	528840	is another important thing, we, we were using open source tool only, so any other, other
528840	533900	companies could eventually use this tool as well. So GoSec, Bandit, and BreakWin was our
533900	541060	starting security test tools that we eventually do. So how would we build this tool? So we have
541060	545820	this development team, it will eventually send this pull request, the CI will, will start all
545820	554180	the security tests, and HuskyCI will eventually fail if some vulnerability is found. So we, we
554180	560980	are using some, so three companies here, we use an API, a Docker API, and our database that we
560980	565960	are using Mongo, and for example, if we're using this Golang story, when this pull request is
565960	571340	being made, and HuskyCI will receive that request, it will eventually send this request to a
571340	576700	Docker API to start a container that will, for the first thing that we'll do, it will use
576700	583740	Henry. Henry that is, is actually another open source tool that can check which language are in
583740	589160	those repositories. If you go to GitHub or GitLab, you, you, you eventually see, oh, this
589160	596020	repository is 80% Go and 20% Makefile, for example. This is what Henry do. So, and he does,
596020	601080	sorry. So Henry will eventually see that, that is a Golang, and will return it to the HuskyCI
601080	607380	API and say, hey, this is a Docker API, this is a Golang repository. So what, what are the
607380	611620	security tools, the open source tools that we have in Golang that we can eventually try to scan
611620	619260	it and find vulnerabilities? At this moment, we do, we only have GoSec, but as we are
619260	624440	building this, this tool, we are actually trying to make it possible so everyone could send
624440	629860	plugins, so I, I've got this new security tools in Golang, and so this will eventually build a lot
629860	636200	of containers and try to run all of them, and eventually to fail it. So this is the, this is the
636200	640800	same process, and later on the security team will eventually see these results that is being
640800	647500	stored in our Mongo database. So what happens if another, another language is inside this
647500	652280	repository? So now Python is being aided, some scripting Python is being aided in that
652280	659340	repository, so the same process will, will, will, will flow. And, and he will, will check
659340	667120	that now we have both Golang and Python, and later on we will, we will create two containers or, or
667120	672700	more if there are more security tests related to Python in parallel, so we can run all the
672700	680160	security tests, and later on if, if there are vulnerabilities, we will fail with DCI. So this
680160	687480	is, this is our dream. And what we would like to see with, what are the metrics that are
687480	693540	important to us? The first thing that we, it would be good to see is the commit alter, not to
693540	699080	blame the developers or, or, or nothing like that, just to get, have this method so we could,
699080	704720	for example, if we find that this top ten developers are committing a lot of SQL injection, we
704720	710800	could eventually get our security team to train them in this specific, in this specific
710800	715960	vulnerability. So git commit alter is something that we think it's good to us to see. The
715960	721200	repository language for, for metrics, it's very good. Also the files that were found in that
721200	727560	repository so we can have, for example, in this pull request we have these files, and later on a
727560	731980	new file has come in, a new vulnerability was found, so this is something that would be good to
731980	737040	us to see. Also the branch name, and the most important to us are the vulnerabilities that, that
737040	743260	are being found. So these are, this is an example of the two. And also the mitigation, so if
743260	753880	the vulnerability was mitigated is a very important metric to us to see. So this is how our
753880	760940	MongoDB looks like. And there is this repository, the containers that were used, and the
760940	769460	results that we're actually trying to, to separate here. We currently are trying to, to fail
769460	775660	the CI, well, medium and high vulnerabilities are found, so this is, this is something that we
775660	783000	start with, and this is how we also are printing it in, in some JSON so that we can consume
783000	789820	this, this output in other, in other, in other tools. For example, if we use a front-end later
789820	798100	on. So I've got a, and this is another thing, so what dev, the developers must do now. The
798100	804520	developers must only add, add his configuration in the CI, these simple requests that we
804520	811100	eventually download this client, this HuskyCI client, and, and the client will be executed
811100	817500	inside that container, and the container will run that container. So we run the security
817500	823600	test, so the developers do not need to, to, to check which are the security tools that we, he
823600	831180	or she needs to use. HuskyCI will do that for, for him or her. So I've got a video here to show
831180	844140	the, the tool working. I've created a, an open, a repository that is open, that is public. And
844140	849180	this is, this, this is a repository that, that is in GitLab, I have the reference for the
849180	853880	links. And let's check the GitLab CI's configuration. We'll see that there are a lot of
853880	859360	stages that are already being used. And now I'm using this HuskyCI that we have built this
859360	864600	external environment so we can test. And now we're going to add some vulnerabilities here just
864600	871920	to check how the, the, the tool works. We're adding some, a new function here that gets MD5,
871920	877740	that is something that, that there is a, a vulnerability in Golang that we are using some
877740	888320	wiki function here. So we're actually checking out, creating a new branch to push it. And at
888320	895360	this moment this repository only has one, one, one, one language that is Golang. And after
895360	902900	committing and pushing it into GitLab, all these tests will be, will start. And we are not
902900	910240	using GoSec, we're using only HuskyCI. And HuskyCI will be, will be able to understand that,
910240	914800	that repository is a Golang. And later on we, it will eventually start all the security tests
914800	921080	related to Go. So I have added the video so that we, as we are short on time, so the pipeline
921080	927320	has started. And all this security, all this pipe, all this pipeline, this pipeline has a lot
927320	933340	of jobs and the last one is HuskyCI. And when we click it on HuskyCI we will see it running.
933720	941280	And the container will run. And, and we'll eventually download the HuskyCI client and start
941280	947060	the analysis. So after a few moments and a few minutes, HuskyCI will eventually find those
947060	952860	vulnerabilities on the CI that is medium high. We're using a weak cryptography primitive. And
952860	958340	it shows the file that, that, that vulnerability was found. It finds the line of it, the code
958340	965280	itself. And, and give it some summary over there, over there so developers could see what's
965280	972300	going on. So for GoSec, it, it has found some four or three vulnerabilities and as there are
972300	981790	some vulnerabilities that are medium, the, the, the CI will eventually fail. So that, that is
981790	986290	the, the CI failing. So what if a new language is added into the project? As, as I mentioned
986290	992490	before, as what if a, a new script is aided? So I'm aiding, I'm creating a new branch here and
992490	998670	I'm, and I'm aiding this Python script that is using some, that has some intended
998670	1003330	vulnerabilities here so we can check if it, HuskyCI will find that we are storing some
1003330	1009070	hard-coded credentials on it and eventually calling a function that could cause a remote code
1009070	1014670	execution, for example, that is, that we consider insecure. So the same process is being done.
1014670	1021650	Now we are committing and pushing it once again to, to GitLab and let's see what HuskyCI will
1022350	1045770	find. And the new pipeline is, is created. And the jobs will be run. I have aided the
1045770	1056710	radio so we can check. Just to HuskyCI. And the runner will start. Now the HuskyCI will
1056710	1063550	eventually see that a new language is being set and it will add, and it, and it will run all the
1063550	1070390	securities related to Python. So as we already had the vulnerabilities in GoSec, we still can
1070390	1077930	see them there. And also as we are using now Python, currently in Python we have two security
1077930	1083390	tasks that we use, that is bandit, that do some static analysis and safety, that checks for
1083390	1102250	vulnerable, vulnerable, vulnerable dependences. So this is what it, it found. So I want to show
1102250	1108770	you how, some statistics that we have in global.com so far. So we have talked to some
1108770	1114750	development team so if, if they wanted to have HuskyCI in their, in their CI as a better
1114750	1121170	testers. So as I said, this is our, some of the products that we, we have in Brazil in
1121170	1127210	global.com and some of them are already using HuskyCI. And we have a 65 unique repository
1127510	1137790	that was already analyzed and 108 unique range that was analyzed. So 20% of the, of this, of
1137790	1146130	our CI has failed, causing, showing us that some vulnerability was found. And 52 passed and
1146130	1151090	the others just have, the developers are still understanding how the, the tool works and
1151090	1156930	some errors has been found. For example, they forgot to, to set their environment variable
1156930	1163210	that HuskyCI needs to, needs to run. So this is our, our first statistic that we, we have.
1164170	1169750	And the, the, the metrics of the seconds that each security tool takes to, to, to run
1169750	1176950	completely. GoSec takes 14 seconds. BreakMan as well. For Python we have these both security
1176950	1182870	tests that we are running that take this long, 7 and 30 seconds. And for JavaScript we have
1182870	1189290	these two, these two tools. We are NPM, we are using NPM Audit that we have built our own
1189290	1195810	containers to do this check. And Retire.js is, JS is another security tool that we use.
1195810	1202210	Retire.js takes a little longer because we are, we need to do some NPM install before using
1202210	1207790	the, the tool. So this process of NPM installing is taking a little longer, so. And all the
1207790	1214310	process is being taken seven minutes, our average. Because a lot of projects use
1214310	1219730	multi-languages and eventually all these containers must be created and this is our average
1219730	1226130	so far. For vulnerabilities, the most, most vulnerabilities that we are facing there is some
1226130	1232330	error are not being handled. For example, in Golang we, we are able to return error when we,
1232330	1236910	when we are using our function. And if we do not want to use this error, we would
1236910	1246290	eventually use, use a, I forgot the word in English, a dash, I guess. And this is some
1246290	1250890	security vulnerability for us. And all the others are vulnerable dependencies. This is the
1250890	1258290	top one for all of them in languages. And what are our next steps? As I said, this is an
1258290	1262570	open source tool that everyone could eventually try to use inside your organization and
1262570	1268570	try to understand how this could help you. So as I said, we are at this moment, we, at this
1268570	1273530	moment we have these three components and our security team is working on checking all the,
1273530	1279230	all this data from our MongoDB and, and some feedback that we are having from our developers
1279230	1286670	is that we need to have a front end so everyone could check in in a more, more friendly way to
1286670	1293150	see this vulnerability and to collect these metrics. There are already some open source tools
1293150	1300490	that are very, are very good to do this. There's R3sec and eventually SonarCube that can use it
1300490	1308630	as input to, to use as a front end. So we are, we are not using none, none of them at this
1308630	1314290	moment, but we could eventually use them. And there are a lot of other languages that we are
1314290	1321930	not facing, we are not handling at this moment, but it, it would be great if we, if we could.
1322230	1328010	And next step is also to contribute to this, to this awesome open source tools. Then they are
1328010	1336330	all, they are all open source tools that we, they are being updated daily and it would be great to
1336330	1346250	us as a HuskyCI community also contribute to them. And add more security tests. For example,
1346250	1350910	there are some, these are some open source tools that could, that we could add. And there are
1350910	1360030	some GitHub repositories that have a, a huge list of security tests, uh, of security, uh, static
1360030	1368550	analytics tools that can be, can be used. And this is something that we have to, in mind. And
1368550	1373670	many more, we are trying to open some issues to handle all, how, how the future of the tool is
1373670	1381310	going, uh, on, on how we could do some more, uh, features and, and now, and everything. And I
1381310	1385670	would, if you would like to give HuskyCI a chance, we are trying to build some
1385670	1393570	documentation so it's, it's turns it so it's easier to other, uh, to other companies to use it
1393570	1405290	as well. And as I said, it's open source. These are my references. I'm not sure if I was too
1405290	1424540	fast, but I'm open to questions if anyone has one. Yes? Yes.
1424540	1431700	Uh, so, do you scan just the commit changes or the whole entire repo? On each push or whatever?
1431700	1436300	Yes, we are, we are scanning each push. If, when a, when a new push is made, we're, we're getting
1436300	1443080	that branch and, and, and, and using that commit from, until that commit, that branch. And we clone
1443080	1448520	all the, those repositories based on that branch. We, we do some git clone, a single branch and
1448520	1451720	the following branch that we're working on. And later on, we start all the security
1451720	1460720	analysis based on, on, on, on that code. So... Yeah, it's the entire repository. I'm not sure if
1460720	1477690	that is optimal, but this is something that we're doing at this moment. Yes? Yes. We, we are
1477690	1482930	trying to use some goroutines to start all the containers in parallel and trying to make it
1482930	1489570	possible to scale it so it's easier when a lot of repositories try to use it, we, it, it, it's
1489570	1495370	smoother to our environments to run it. So we're using goroutines to start them in parallel,
1495370	1511200	all the security tools. Yes? Parallel. They are working in parallel. Yes? So you had a lot of
1511200	1516700	examples for GitLab in your CI system. Has there been any thought about moving to using,
1516700	1525270	expanding it to Jenkins? Yeah, sure. We are using a lot of GitLab because we use a lot of
1525270	1531770	GitLab in our, in global.com, but we also use some GitHub and also SecureCI and, and another,
1531770	1538630	another CI. So, uh, basically we, what, what we could do is, is just add it, you have to build
1538630	1543130	this environment, this CI environment and put that line inside your container that will be
1543130	1564680	run. So I think it, it would be easier to use in Jenkins than any other CIs. Yes, nice. Some,
1564680	1570380	some security tools, uh, permit us to add this, this, this comment in the line that we, that
1570380	1573840	developer and the security team think that these are false positives. For example,
1573840	1580240	GoSec allows us to put some comment in, you, uh, uh, using NoSec, so that GoSec will
1580240	1586360	eventually not consider that as a, as a, as a, as a vulnerability. But false positive is some
1586360	1592600	of our challenges in, because if some developers also, uh, ask us how we could not fail that
1592600	1598060	CI if this false positive is, is shown. But we are, at this moment we rely on how the
1598060	1604960	security tools are, are, are, are, are allowing us to, to handle these false positives. So for
1604960	1610580	Bennett we, we, or safety we need to check if them can allow us to, to add this tool. But it's
1610580	1616600	something that we could eventually do in HuskyCI client. We could do some feature to try to
1616600	1620080	allow it, us to not face this problem.
1620080	1620520	...
1626010	1626530	...
1640950	1648730	Did you find that you were able to handle the capacity of putting the resources out? And as, like, a
1648730	1654470	follow-up question, was there any, is there anything you're noticing in terms of, do developers run
1654470	1660450	into some of the same problems where you might have the same vulnerability popping up across your
1663830	1673290	Nice. Well, when we first talked to development teams to use this tool, it's something like,
1673590	1681250	it's a culture. So each team has its own autonomous way of handling those repositories. And as
1681250	1687010	unfortunately we are not able to be inside all of the development teams, but on the development
1687970	1697190	team that we do have a secure analyst. We ask them to gently add this security tool in their CI. And our
1697190	1703570	most problem is basically finding that the repository using vulnerable dependencies. So this is
1703570	1712410	something that we are trying to do. Developers are generally saying that those dependencies are
1712410	1719650	from the vendors, not of their project. But we actually see as, well, it is indeed a
1719650	1724390	vulnerability. So we should not use this, this, this, this dependence. So this is something that we
1724390	1731370	are trying to, to handle. And I see security more, more like a people. So we have to talk with
1731370	1738230	them and try to increment, put some security culture inside our team. But this is something that
1738230	1753560	we are trying to, to work on. Currently our, our SQCI team is, is, is free, two and three
1753560	1759220	developers as well. But it's something that we could eventually add in the future. Even trying to
1759220	1768420	integrate to, to these tools or ServiceNow and, and any other tools. Okay. Thank you very much.
