Fireship · @fireship
Next.js rocked by critical 9.1 level exploit...
Uploaded March 24, 2025 · Length 3:49
Summary
nextjs hit by critical 9.1 exploit allowing attackers to bypass authentication and authorization in middleware, prompting urgent upgrade to patch version.
- nextjs exploit
- nextjs security
- middleware bypass
- versel security
- cloudflare vs versel
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
last Friday right after you made the
- 0:01
mistake of deploying your code on a
- 0:03
Friday the world's most popular
- 0:04
JavaScript framework nextjs was hit by a
- 0:07
critical 9.1 security advisory the
- 0:10
exploit allows an attacker to bypass
- 0:12
authentication and authorization in
- 0:13
nextjs middleware which is really bad
- 0:16
like if you have a software as a service
- 0:18
product normally you would have code in
- 0:19
your middleware that says something like
- 0:21
if you know pay me yet redirect a
- 0:23
pricing page but apparently verell the
- 0:25
company behind xjs has been Vibe coding
- 0:27
its security logic recently because an
- 0:29
attacker can just say no thank you to
- 0:30
any off checks and use your app without
- 0:32
pain this mistake has led to a mass
- 0:34
celebration among nextjs and react
- 0:36
haters who are currently screaming I
- 0:38
Told You So from Mom's basement and even
- 0:40
big public companies like cloudflare are
- 0:41
using this as an opportunity to poach
- 0:43
customers from versel leading to some
- 0:45
glorious Tech bro drama on Twitter but
- 0:47
the most important thing to know right
- 0:49
now is that if you currently have a
- 0:50
nextjs app in production that has not
- 0:52
been upgraded you could be in serious
- 0:54
danger so in today's video we'll find
- 0:56
out how screwed you really are and learn
- 0:58
how the worst nextjs security dir flaw
- 1:00
of all time actually works it is March
- 1:02
24th 2025 and you're watching the code
- 1:04
report let's get right down to business
- 1:06
if you're currently running a nextjs
- 1:08
version that hasn't been patched you
- 1:09
want to upgrade as ASAP as possible
- 1:11
however if you're not using nextjs
- 1:13
middleware or hosting on versell or
- 1:15
netlify you don't need to worry but if
- 1:17
you're self-hosting and using versell
- 1:18
middleware your app will likely be dead
- 1:20
by the time you finish watching this
- 1:21
video here's how the exploit actually
- 1:23
works virtually every web framework out
- 1:25
there has a concept of middleware which
- 1:27
is basically just some code that sits in
- 1:29
between a request re EST and response on
- 1:30
your server as the name implies it's a
- 1:32
layer that sits in the middle and is
- 1:34
often used to perform generic actions
- 1:36
like logging error handling and
- 1:38
authorization so you don't have to
- 1:40
reimplement that logic on every single
- 1:41
route that's all good but the security
- 1:43
researchers who found this exploit were
- 1:45
dumpster diving through some old nextjs
- 1:47
code and found a header that could be
- 1:49
used to skip any nextjs middleware that
- 1:51
you want you just need to know the name
- 1:52
of the middleware and add it to this
- 1:54
middleware sub request header and it
- 1:55
just so happens that the middleware
- 1:57
names are easily guessable thanks to
- 1:58
naming conventions what's scary about it


