WEBVTT

00:00:00.080 --> 00:00:04.000
There's a good chance you already heard or

00:00:04.040 --> 00:00:07.990
read about the NPM package attacks that

00:00:08.039 --> 00:00:11.240
happened over the last couple of days,
over the last week

00:00:11.540 --> 00:00:14.940
essentially. There have been two major

00:00:15.000 --> 00:00:18.780
attacks on the NPM package ecosystem

00:00:19.360 --> 00:00:23.120
where collectively,
packages with billions of

00:00:23.180 --> 00:00:27.120
downloads, weekly downloads,
have been targeted by

00:00:27.200 --> 00:00:30.510
attacks that aimed to distribute and

00:00:30.680 --> 00:00:33.960
deploy malicious code, steal

00:00:34.560 --> 00:00:38.080
secrets from your machine, for example,
from

00:00:38.380 --> 00:00:42.170
CICD machines, and so on. Now, in case you

00:00:42.280 --> 00:00:45.660
haven't really heard
or read about these attacks, I'll briefly

00:00:45.700 --> 00:00:49.530
summarize what happened but then,
more importantly, I

00:00:49.540 --> 00:00:53.440
wanna dive into what that means for you

00:00:53.500 --> 00:00:57.400
and me, for us developers,
because this of course is

00:00:58.060 --> 00:01:01.900
a kind of attack and a scale of attack

00:01:01.910 --> 00:01:05.900
that's ... well,
I'm sure it has happened before but it's

00:01:05.910 --> 00:01:09.810
not something we see every day
and it has some

00:01:09.840 --> 00:01:13.780
serious impact on the NPM ecosystem
and how

00:01:13.820 --> 00:01:17.730
we as developers should interact with
those packages,

00:01:17.780 --> 00:01:20.690
I'd say. But let's start at the basics.

00:01:20.740 --> 00:01:24.700
It started essentially a week ago with

00:01:24.920 --> 00:01:28.200
the first big attack which, uh, was less

00:01:28.260 --> 00:01:30.880
impactful than the second attack to
which I'll get.

00:01:31.150 --> 00:01:35.010
But that first attack essentially worked
by

00:01:35.040 --> 00:01:38.780
getting access to an account,
an NPM account

00:01:38.880 --> 00:01:42.820
of the maintainer of one NPM package which

00:01:42.880 --> 00:01:46.540
of course gets used by other packages
and so on.

00:01:46.580 --> 00:01:50.180
And that attack in the end happened
through a phishing

00:01:50.520 --> 00:01:53.940
email,
so they used a phishing email to get

00:01:53.960 --> 00:01:57.880
access to this package maintainer's NPM
account

00:01:58.040 --> 00:02:01.900
and through that access
which they got successfully, they were

00:02:01.940 --> 00:02:05.120
then able to deploy a malicious version of
that

00:02:05.160 --> 00:02:08.919
package, a package
which came with some extra

00:02:09.080 --> 00:02:11.960
code which in the end deployed a

00:02:12.460 --> 00:02:16.120
cryptocurrency, uh, token stealer.

00:02:16.160 --> 00:02:19.800
So the goal of this attack essentially
was to get into

00:02:19.860 --> 00:02:23.440
packages that are then used on websites to

00:02:23.620 --> 00:02:27.600
steal cryptocurrency in the end from the
visitors of

00:02:27.680 --> 00:02:30.900
these websites.
So the goal of this attack was not

00:02:31.530 --> 00:02:34.680
to compromise the system

00:02:34.820 --> 00:02:38.580
of people, of developer, uh,
developers using

00:02:38.640 --> 00:02:42.180
that package or of, um, machine

00:02:42.240 --> 00:02:46.220
CID- CICD machines that deploy,

00:02:46.340 --> 00:02:50.100
uh, applications using that package.
That was not the goal of this attack.

00:02:50.120 --> 00:02:53.660
The goal of that attack
was to run on websites and to

00:02:53.700 --> 00:02:57.200
target the users of those websites to
steal

00:02:57.220 --> 00:03:00.950
cryptocurrency, and
that wasn't too successful.

00:03:01.040 --> 00:03:04.920
Uh, from what I read, they
were able to steal like $1,000

00:03:04.980 --> 00:03:08.320
or so,
but still what this attack shows us, of

00:03:08.380 --> 00:03:11.700
course, how dangerous using

00:03:12.040 --> 00:03:15.740
lots of NPM packages can be,
and I'll get back to that

00:03:15.780 --> 00:03:19.340
later, and how vulnerable the entire NPM

00:03:19.400 --> 00:03:22.900
ecosystem can be.
Because even though this first

00:03:22.980 --> 00:03:26.940
attack wasn't too impactful, it was, of

00:03:27.000 --> 00:03:30.320
course, a successful attack. And the

00:03:30.640 --> 00:03:34.570
second attack about
which I wanna talk shows us that

00:03:34.600 --> 00:03:38.540
the threat can be much higher than what

00:03:38.580 --> 00:03:41.410
resonated or what was done by that first

00:03:41.440 --> 00:03:45.240
attack. Because that second attack
which happened a

00:03:45.300 --> 00:03:49.180
couple of days after
that first attack which, as far as I know,

00:03:49.260 --> 00:03:53.220
isn't directly linked to it as it seems,
but I'm not 100% sure

00:03:53.260 --> 00:03:56.800
about that. But that second attack
was now not

00:03:57.160 --> 00:04:01.130
about stealing cryptocurrency.
That second attack was about

00:04:01.260 --> 00:04:04.660
getting on your machine
or the machines where

00:04:04.720 --> 00:04:08.000
applications are deployed, CICD machines,
and

00:04:08.180 --> 00:04:12.000
stealing security credentials,
credentials in general,

00:04:12.080 --> 00:04:16.019
stealing AWS access keys, NPM, uh,

00:04:16.079 --> 00:04:19.620
access tokens, GitHub access tokens,
and all

00:04:19.700 --> 00:04:23.340
kinds of credentials, uh, security keys,
tokens

00:04:23.680 --> 00:04:27.490
you might find on those machines. Now
that second attack,

00:04:28.180 --> 00:04:31.480
as it seems, as far as I know, did not

00:04:31.600 --> 00:04:35.580
start from an phishing,
from a phishing mail but instead

00:04:35.660 --> 00:04:39.620
from a already compromised, um,
NPM account from an

00:04:39.680 --> 00:04:43.420
earlier attack potentially.
Whatever it was, they were

00:04:43.500 --> 00:04:47.020
able to publish a new version of a
package,

00:04:47.080 --> 00:04:50.940
ironically of a package
that wasn't super actively

00:04:51.050 --> 00:04:54.750
maintained,
so that hasn't seen a lot of updates,

00:04:54.860 --> 00:04:58.730
uh, in, in the past.
But they now published a new version of

00:04:58.780 --> 00:05:02.220
turns out, that package
was used by enough other

00:05:02.260 --> 00:05:06.120
packages to have an impact because this
second attack

00:05:06.260 --> 00:05:09.720
actually now was not about including some
code that

00:05:09.800 --> 00:05:13.720
runs on the deployed website. Instead,
that second attack

00:05:13.820 --> 00:05:16.840
was about running

00:05:16.900 --> 00:05:20.810
malicious software in the end,
a malicious script on the

00:05:20.860 --> 00:05:24.740
machine where that compromised package
was used in

00:05:24.780 --> 00:05:28.680
a build process and then that script would

00:05:28.800 --> 00:05:32.580
actually search for secrets,
for credentials, for

00:05:32.680 --> 00:05:36.560
access tokens on that machine
and use those to

00:05:36.660 --> 00:05:39.950
A, exfiltrate them,
to share them with the attackers but

00:05:40.240 --> 00:05:44.220
B, also to spread. So it

00:05:44.320 --> 00:05:48.160
was a worm. The goal
was to then use these access tokens, for

00:05:48.200 --> 00:05:52.040
example,
to publish the same malicious software on

00:05:52.100 --> 00:05:55.820
other packages. So
if package B used package A which was

00:05:55.880 --> 00:05:59.780
compromised,
then during the build process of package

00:05:59.820 --> 00:06:03.440
was...... the chance that this malicious

00:06:03.620 --> 00:06:07.580
code, which was in package A,
would actually get access to the GitHub

00:06:07.640 --> 00:06:11.630
repository to the NPM account of package B
as well and

00:06:11.660 --> 00:06:15.600
then continue spreading, and that's,
of course, extremely dangerous and

00:06:15.640 --> 00:06:19.570
it was and is an extremely dangerous
attack because of

00:06:19.620 --> 00:06:23.500
this worm, uh,
like behavior of because it was

00:06:23.700 --> 00:06:27.120
spreading and it was not just stealing
those

00:06:27.280 --> 00:06:31.100
secrets from one affected package,
but it was using them to

00:06:31.120 --> 00:06:34.940
affect more packages. And, therefore,
this second attack

00:06:35.300 --> 00:06:39.020
had a way larger impact than this first

00:06:39.120 --> 00:06:43.020
attack. Ye-,
because of this worm-like behavior,

00:06:43.030 --> 00:06:46.130
this attack was able to successfully
compromise

00:06:46.940 --> 00:06:50.569
many hundreds of packages because all
these packages, of course,

00:06:50.580 --> 00:06:54.430
typically depend on each other
and then you might just be using

00:06:54.500 --> 00:06:57.980
one of these packages,
but because of the packages

00:06:58.020 --> 00:07:01.670
internally,
suddenly you might be affected as

00:07:01.720 --> 00:07:05.130
well. So how can you find out if you
are affected?

00:07:05.180 --> 00:07:08.720
Well, a couple of things. Uh, for one,
you should, of

00:07:08.780 --> 00:07:12.720
course, check whether your projects which

00:07:12.800 --> 00:07:16.570
you built or where you downloaded, um, new

00:07:16.600 --> 00:07:20.470
versions of the packages over the last
week or so,

00:07:20.520 --> 00:07:24.100
if these projects use one of those, uh,
known

00:07:24.260 --> 00:07:28.180
compromised packages,
and I'll put some links below this, uh,

00:07:28.220 --> 00:07:31.020
this episode, to help you scan for that.

00:07:31.040 --> 00:07:34.420
So that's, of course, one thing, and
when you look for these packages,

00:07:34.540 --> 00:07:38.500
not look in your package lock, uh,
in your package JSON file, but in your

00:07:38.560 --> 00:07:40.810
package-lock.json file because that

00:07:40.920 --> 00:07:44.820
package-lock.json file,
that's actually the file that

00:07:44.860 --> 00:07:48.700
lists all the packages used in your
project, including the packages used

00:07:48.740 --> 00:07:52.360
by packages and it shows you the exact
versions used

00:07:52.460 --> 00:07:56.060
there, which allows you to find out
that if you are using one of the

00:07:56.100 --> 00:07:59.840
compromised packages,
if you're using one of the compromised

00:08:00.040 --> 00:08:02.440
versions, which, of course,
is an important information.

00:08:02.460 --> 00:08:06.320
So that's one thing to do. Uh,
in addition,

00:08:06.660 --> 00:08:09.300
due to how that attack worked,
it seems that it

00:08:09.360 --> 00:08:12.420
exfiltrated, uh, those stolen secrets

00:08:13.080 --> 00:08:16.940
mainly by creating a new public GitHub
repository in

00:08:16.980 --> 00:08:20.710
your account if you are affected, uh,
which had this

00:08:20.760 --> 00:08:23.740
name, uh, I, I keep on forgetting it,

00:08:23.750 --> 00:08:27.580
shayhulut, which had this name.
So you wanna check for

00:08:27.640 --> 00:08:31.539
that and you wanna check your GitHub
security logs, to which you also find a

00:08:31.580 --> 00:08:35.220
link below,
you can use it for your account to check

00:08:35.319 --> 00:08:38.880
any action related to creating such a
repository or

00:08:38.940 --> 00:08:42.799
switching one of your existing private
repositories to public because that's

00:08:42.880 --> 00:08:45.280
also something this attack did and so on.

00:08:45.300 --> 00:08:49.130
So these are steps you should take
and again you'll find more detailed

00:08:49.200 --> 00:08:52.840
resources below. That's one thing that

00:08:52.920 --> 00:08:56.560
you should do right now if you fear
that you might be

00:08:56.600 --> 00:09:00.440
affected. But, of course, this attack also

00:09:00.920 --> 00:09:04.840
brings up the question,
what can we do to mitigate such

00:09:05.120 --> 00:09:07.810
attacks or to prevent such attacks in the
first place?

00:09:07.920 --> 00:09:11.680
Of course, that's a pretty big thing

00:09:11.720 --> 00:09:15.569
with m- with many building blocks because,
of course, it all starts with

00:09:15.600 --> 00:09:19.460
making sure that if you're a package
maintainer that your NPM and

00:09:19.480 --> 00:09:23.449
GitHub accounts are secure and
are not easily compromised by

00:09:23.500 --> 00:09:27.480
using two-factor authentication,
though even that is not a

00:09:27.600 --> 00:09:31.480
100% guarantee because with phishing there
are ways of getting

00:09:31.580 --> 00:09:34.810
around that too with social engineering
and so on, but it is, of course,

00:09:34.840 --> 00:09:38.340
important.
There are a couple of steps you can take

00:09:38.380 --> 00:09:42.160
maintainer to help reduce

00:09:42.220 --> 00:09:46.080
the,
the risk of becoming a spreader of

00:09:46.140 --> 00:09:50.080
software, but, of course, you and me,
you might primarily

00:09:50.220 --> 00:09:54.080
be users of packages, uh, and, therefore,
the question is what

00:09:54.140 --> 00:09:57.300
can we do? And it starts with

00:09:57.440 --> 00:10:01.319
limiting the amount of packages you're
using, I'd

00:10:01.360 --> 00:10:04.760
say.
I'll get to some other recommendations as

00:10:04.819 --> 00:10:08.700
recommendation I haven't seen enough in
all those blog

00:10:08.780 --> 00:10:12.740
posts and articles
and so on I read because there is a

00:10:12.780 --> 00:10:16.500
tendency for some developers at least to

00:10:16.620 --> 00:10:20.410
use too many packages. Um,

00:10:20.620 --> 00:10:22.980
y- uh, it... and I get it.
It's convenient, right?

00:10:23.079 --> 00:10:26.640
Um,
you can solve a lot of problems you might

00:10:26.660 --> 00:10:30.100
during the development process by bringing
in a

00:10:30.180 --> 00:10:33.160
package that does what you're looking for.

00:10:33.260 --> 00:10:37.200
Um,
instead of writing your own code to solve

00:10:37.220 --> 00:10:39.060
in a package and you're done with it.

00:10:39.079 --> 00:10:43.040
And, of course, for certain tasks,
that makes sense.

00:10:43.120 --> 00:10:46.579
You're using React because you want a
package

00:10:46.660 --> 00:10:50.319
that, uh,
makes it way easier to reactively

00:10:50.380 --> 00:10:54.100
update the DOM and build highly
interactive, uh,

00:10:54.120 --> 00:10:57.660
browser-based web applications, so yeah,
you wanna use

00:10:57.780 --> 00:11:01.569
React probably. For authentication,
you probably...

00:11:01.600 --> 00:11:05.020
you'll wanna use a package.
For your backend framework, you

00:11:05.060 --> 00:11:09.020
probably wanna use a library. So we

00:11:09.100 --> 00:11:12.560
all use them, of course. We, uh,
we all probably

00:11:12.800 --> 00:11:16.780
rarely build web applications totally from
scratch with

00:11:16.860 --> 00:11:20.800
just HTML, CSS, and JavaScript
and no packages, though

00:11:20.810 --> 00:11:24.290
that is actually a valid strategy for
certain kinds of sites and

00:11:24.380 --> 00:11:27.140
applications. Just saying. But yeah,
we all use

00:11:27.180 --> 00:11:30.620
packages.
But do you really need a package for

00:11:30.680 --> 00:11:33.980
checking whether a number is odd or even?

00:11:35.060 --> 00:11:38.780
Not sure about that. And, of course,
that's an extreme example, but you get

00:11:38.819 --> 00:11:42.340
my point. Especially now with AI

00:11:42.420 --> 00:11:46.400
available,
it's so easy to quickly generate

00:11:46.480 --> 00:11:50.340
code for problems you might not

00:11:50.440 --> 00:11:54.420
know the solution immediately,
like let's say you need to invert

00:11:54.480 --> 00:11:58.220
a binary tree,
not something you need to do every day,

00:11:58.230 --> 00:12:01.620
applications, in most applications,
but let's say you, you want

00:12:01.680 --> 00:12:05.660
some efficient algorithm for searching
or for inverting a

00:12:05.680 --> 00:12:09.500
binary tree,
whatever.If you need to do something like

00:12:09.600 --> 00:12:13.400
can bring in a package
that does it for you, you can sit

00:12:13.440 --> 00:12:17.000
down and try to learn the algorithm
and write it from scratch,

00:12:17.020 --> 00:12:20.600
good exercise,
or you can use AI to generate it because

00:12:20.660 --> 00:12:23.859
exactly the kind of tasks that
are super easy for

00:12:23.920 --> 00:12:27.720
AI. Now I will say, AI-generated code is

00:12:27.760 --> 00:12:31.540
not necessarily secure
and AI also sometimes

00:12:31.600 --> 00:12:34.240
wants to bring in extra packages,
packages.

00:12:34.280 --> 00:12:38.000
It can be lazy too. But still, uh, y- you

00:12:38.120 --> 00:12:41.920
really can write more code on your own
or with help of AI than you might

00:12:41.980 --> 00:12:45.240
think. So,
that's really one thing that's important

00:12:45.300 --> 00:12:49.210
because there is this tendency f- by,
for some developers at least,

00:12:49.240 --> 00:12:52.980
to solve everything by adding a new
package, a new library,

00:12:53.040 --> 00:12:55.780
and I would

00:12:55.840 --> 00:12:59.000
recommend to try as little

00:12:59.280 --> 00:13:02.960
packages as possible. That
is something I've done for

00:13:03.300 --> 00:13:05.960
years. I like the challenge of

00:13:06.180 --> 00:13:09.920
using, yeah, not a lot of packages, not a

00:13:09.960 --> 00:13:13.790
lot of libraries.
I like the challenge of solving problems

00:13:13.820 --> 00:13:16.720
Now with AI, that's even easier.
But of course, I'm also using

00:13:16.760 --> 00:13:20.660
packages. And if, due to how those

00:13:20.700 --> 00:13:24.620
packages work,
that they all have their own dependencies,

00:13:24.660 --> 00:13:28.460
would get affected by, uh,
a worm like this, then we're, of

00:13:28.540 --> 00:13:32.400
course, all in trouble. Uh,
I don't even wanna think about that

00:13:32.500 --> 00:13:36.320
happening.
That would probably affect hundreds of

00:13:36.380 --> 00:13:40.100
millions of machines
if such a package would get

00:13:40.160 --> 00:13:43.840
compromised. But yeah.
So limiting the number of packages you

00:13:43.940 --> 00:13:47.780
use is a good idea.
Another thing you might wanna consider

00:13:47.790 --> 00:13:51.650
doing is fix your dependency

00:13:51.720 --> 00:13:55.370
versions.
And I'm not necessarily doing that.

00:13:55.420 --> 00:13:58.300
I'll be 100% honest here.
I should be doing it.

00:13:58.380 --> 00:14:01.580
I will be doing it in the future.
I haven't done it, but

00:14:02.680 --> 00:14:05.900
I've read it a lot related to these
attacks and, of course, it makes

00:14:05.980 --> 00:14:09.460
sense. We typically fix the major

00:14:09.740 --> 00:14:13.670
versions of our packages.
Maybe also the minor versions, but

00:14:13.760 --> 00:14:17.130
not the patch versions.
So in case you don't know, um, many

00:14:17.179 --> 00:14:20.249
packages, or actually, well,
pretty much all these

00:14:20.280 --> 00:14:24.100
packages, um, on NPM have, like, a major,
a

00:14:24.120 --> 00:14:27.880
minor,
and a patch version number in their

00:14:27.900 --> 00:14:31.640
number and depending on how you configured
your package

00:14:31.680 --> 00:14:35.240
JSON file when you run NPM install
and so on, you

00:14:35.340 --> 00:14:38.620
either download a very specific version
or the latest

00:14:38.980 --> 00:14:42.580
patch or the latest minor
or even the latest major

00:14:42.620 --> 00:14:46.480
version. And in theory, it makes sense to

00:14:46.580 --> 00:14:50.190
always download the latest patch version
because

00:14:50.220 --> 00:14:54.150
patch versions,
depending on how the maintainer handles

00:14:54.200 --> 00:14:57.270
in theory,
they don't change the fundamental

00:14:57.820 --> 00:15:01.420
nature or behavior of a package.
They don't have breaking changes

00:15:01.460 --> 00:15:05.020
they fix security issues
or performance issues and so on.

00:15:05.080 --> 00:15:09.020
So in theory,
you wanna stay up to date with patches,

00:15:09.100 --> 00:15:12.940
but in reality,
as attacks like this show us,

00:15:13.000 --> 00:15:16.710
was spread through a patch update,
we might

00:15:16.780 --> 00:15:19.770
not want to automatically use patch
versions either.

00:15:19.820 --> 00:15:23.320
We might want to fix our versions
and then deliberately

00:15:23.420 --> 00:15:27.380
choose to update our version numbers after
carefully

00:15:27.460 --> 00:15:31.280
making sure that the new version is safe,
not just from a b- breaking

00:15:31.300 --> 00:15:34.980
change or performance perspective,
but also from a security perspective.

00:15:35.020 --> 00:15:38.980
It is more work, but how much work
is it to

00:15:39.040 --> 00:15:42.660
clean up a compromised system,
to rotate all your,

00:15:42.760 --> 00:15:46.280
uh, compromised tokens and credentials and

00:15:46.340 --> 00:15:50.000
mitigate that, uh, uh, that danger and,

00:15:50.080 --> 00:15:53.700
uh, that damage that was done? So yeah,
that's one

00:15:53.780 --> 00:15:57.570
thing. Uh,
if you're using PNPM as a package manager,

00:15:57.620 --> 00:16:01.340
example, which I don't,
you can even set a certain

00:16:01.640 --> 00:16:05.480
setting, the minimum release age setting,
to make sure that

00:16:05.540 --> 00:16:09.520
you do, for example,
automatically download patch versions.

00:16:09.560 --> 00:16:13.040
But that the package has to be a

00:16:13.100 --> 00:16:16.860
minimum number of, uh, days old, uh,

00:16:16.980 --> 00:16:20.900
for example. So that you make sure
that you're

00:16:21.020 --> 00:16:24.740
not downloading patch versions on day one,
a couple of hours

00:16:24.840 --> 00:16:28.819
after they were released.
Because with those attacks that happened,

00:16:28.939 --> 00:16:32.790
was that they had a relatively small
attack window.

00:16:32.900 --> 00:16:36.420
The attack, thankfully,
was detected quite quickly and

00:16:36.460 --> 00:16:40.410
those compromised versions
were unpublished, so the window of

00:16:40.440 --> 00:16:44.340
attack was relatively small but big

00:16:44.360 --> 00:16:47.620
enough to affect many, many machines.

00:16:47.640 --> 00:16:51.620
Now if you were to set a minimum, uh,
release age,

00:16:51.640 --> 00:16:55.220
which again, is available with PNPM,
but to my knowledge not with

00:16:55.300 --> 00:16:59.250
NPM right now, if you
were to use this setting,

00:16:59.280 --> 00:17:03.160
or with more safety I should say, uh,
auto-update

00:17:03.380 --> 00:17:07.290
for new patch versions and so on.
But you would make sure that you only

00:17:07.300 --> 00:17:11.030
do it after a couple of days to make sure
that others have

00:17:11.099 --> 00:17:15.079
tested the water first
and potential security issues might've

00:17:15.119 --> 00:17:18.619
been detected. It's not a guarantee,
but it's an additional, uh,

00:17:19.079 --> 00:17:22.680
step to make your environment more secure

00:17:22.800 --> 00:17:26.380
and it allows you to still auto-update,
um, for

00:17:26.460 --> 00:17:29.579
example.
So that's another thing you might wanna

00:17:29.620 --> 00:17:33.580
consider.
Now another thing you should think

00:17:33.680 --> 00:17:37.300
about or you should do in general,
to be very honest,

00:17:37.400 --> 00:17:40.800
is limit the scope of your access

00:17:40.860 --> 00:17:44.280
tokens and credentials. It is, of course,
super

00:17:44.340 --> 00:17:48.240
convenient to always create access tokens
that have full

00:17:48.400 --> 00:17:51.840
access to everything. Like,
let's talk about AWS.

00:17:51.880 --> 00:17:55.070
If you run some deployment

00:17:55.140 --> 00:17:58.760
process that also uses AWS or the

00:17:58.800 --> 00:18:02.700
deployed app is using AWS and therefore
is part of the,

00:18:02.710 --> 00:18:06.680
uh, build process, you
are exposing your AWS access

00:18:06.720 --> 00:18:10.710
key and your credentials to the build
process to c- bake it into

00:18:10.740 --> 00:18:14.308
the built application, so to say.It is,
of course, convenient to have an

00:18:14.348 --> 00:18:17.948
AWS access token
that gives the application admin

00:18:18.068 --> 00:18:21.728
access to all your AWS resources because
it's your code, right?

00:18:21.768 --> 00:18:25.668
What could go wrong? Well,
something like this attack could go wrong.

00:18:25.728 --> 00:18:29.548
If that AWS token is ever stolen, like

00:18:29.608 --> 00:18:33.378
it could be through that attack,
then you're in a huge

00:18:33.448 --> 00:18:37.408
trouble.
You have a token out there in the wild

00:18:37.448 --> 00:18:40.918
attackers full access to your AWS account,
and that's just one

00:18:40.928 --> 00:18:43.828
example. It's the same, of course,
for the other cloud providers.

00:18:43.868 --> 00:18:47.477
It's the same for AI tokens. I mean,
think of, um,

00:18:47.528 --> 00:18:51.168
some malicious actor stealing your OpenAI

00:18:51.348 --> 00:18:55.228
access token and then using AI, uh,
and you're paying the

00:18:55.248 --> 00:18:59.108
bill. Of course,
you might have some limits in place there,

00:18:59.188 --> 00:19:02.408
that is not a lot of fun. So as a best

00:19:02.508 --> 00:19:06.428
practice,
you should really try to limit the scope

00:19:06.488 --> 00:19:09.628
those access tokens and credentials
if it's possible.

00:19:09.688 --> 00:19:13.438
Not all providers,
not all services give you a lot of

00:19:13.588 --> 00:19:16.888
options there, but many do, and if you're,
for example, building an

00:19:16.947 --> 00:19:20.138
application that only needs to send email
through

00:19:20.188 --> 00:19:24.028
AWS, then your AWS access token should

00:19:24.088 --> 00:19:27.608
only have access for exactly this action,
to

00:19:27.668 --> 00:19:31.588
exactly this action. Now, in case of AWS

00:19:31.628 --> 00:19:35.128
and also other services, there
are even better ways than using an access

00:19:35.208 --> 00:19:39.008
token in the first place. You can get

00:19:39.088 --> 00:19:43.048
short-lived credential stare as well, uh,
but that is

00:19:43.068 --> 00:19:46.688
beyond the scope of this video. You,
of course, might wanna look into

00:19:46.908 --> 00:19:50.828
such solutions as well
if you're using a service like AWS that

00:19:50.928 --> 00:19:54.568
offers even more secure ways of accessing
it

00:19:54.868 --> 00:19:56.708
than those general access tokens.

00:19:56.728 --> 00:20:00.548
But if we're talking about access tokens
and credentials, limiting the scope

00:20:00.888 --> 00:20:04.248
is definitely something you might wanna
do.

00:20:04.288 --> 00:20:08.118
And th- of course, if you
are affected by the attack, by the way,

00:20:08.148 --> 00:20:11.118
you wanna rotate all your tokens
and all your credentials.

00:20:11.128 --> 00:20:15.038
You wanna change them all because you have
to consider them

00:20:15.088 --> 00:20:18.128
compromised. That's, of course, clear.

00:20:18.148 --> 00:20:22.048
Well, and that's in the end it for my two

00:20:22.128 --> 00:20:25.948
cents on the attack here.
The most important

00:20:26.088 --> 00:20:29.988
takeaway I have from this attack
is really the part

00:20:30.048 --> 00:20:33.648
with scoping your tokens,
limiting the scope, I mean,

00:20:35.188 --> 00:20:39.068
not automatically updating to the latest
patch versions all the time

00:20:39.148 --> 00:20:42.588
automatically,
and maybe my very most important

00:20:42.648 --> 00:20:45.728
point, not using too many packages.

00:20:45.768 --> 00:20:49.608
That is, of course,
the best line of defense here because what

00:20:49.688 --> 00:20:53.188
us is how vulnerable this entire

00:20:53.268 --> 00:20:56.568
JavaScript ecosystem is. If one

00:20:56.648 --> 00:21:00.148
package that's used by enough other
packages gets compromised and

00:21:00.348 --> 00:21:03.948
acts as a worm,
as it happened in the second attack,

00:21:03.988 --> 00:21:07.708
then we can quickly have a spreading
wildfire that's very

00:21:07.828 --> 00:21:11.688
hard to contain and
that can quickly affect millions or even

00:21:11.728 --> 00:21:15.608
billions of machines, um, be that

00:21:15.668 --> 00:21:19.408
your laptop or the machine in the cloud
where you deploy or build your

00:21:19.448 --> 00:21:23.328
application. And that, of course, is

00:21:23.348 --> 00:21:26.288
an unbelievable huge threat.

00:21:27.108 --> 00:21:30.948
So yeah,
that is something we should all consider

00:21:30.988 --> 00:21:34.868
these attacks have shown us.
We should make

00:21:34.908 --> 00:21:38.658
sure that we ramp up our, um,

00:21:38.688 --> 00:21:42.438
protection, our mitigation strategies,
that we make sure that

00:21:42.468 --> 00:21:46.448
we, uh, limit the, the danger we face on

00:21:46.508 --> 00:21:50.228
our machines or, uh,
regarding to our credentials and so on.

00:21:50.308 --> 00:21:54.188
And, uh, yeah,
let me know what you think of that,

00:21:54.208 --> 00:21:58.138
also want me to mention. As I mentioned,
I'll put some important links, um,

00:21:58.328 --> 00:22:01.848
in the description, and, uh, yeah,
I'll see you in the next video.

00:22:01.888 --> 00:22:02.428
Bye.