one wrong npm package

Поделиться
HTML-код
  • Опубликовано: 18 ноя 2024

Комментарии • 214

  • @PwnFunction
    @PwnFunction  2 года назад +304

    My bad, it's "Almost everything is an object".

    • @rebelsdeveloper367
      @rebelsdeveloper367 2 года назад +2

      hehe .. me not like use front end server thou

    • @ZainAli-uq3fj
      @ZainAli-uq3fj 2 года назад +5

      @@daruiraikage he meant almost everything in Javascript is an object.

    • @unknownnn5479
      @unknownnn5479 2 года назад +2

      "dont let the feminists see this" haha ... btw really cool work brother

    • @eduardoblas2315
      @eduardoblas2315 2 года назад +2

      So... everything in python is a cat ;)

    • @btccricket14
      @btccricket14 2 года назад +1

      I watched 2 of your videos and I realized how fucked we're gonna be when the world goes full digital.....

  • @hesh1700
    @hesh1700 2 года назад +296

    1 question. "How?" That's a lot of content to keep track of to make this work. Seriously though, your work is awesome and I learned a lot from it.

    • @dealloc
      @dealloc 2 года назад +20

      This was a proof of concept. The real vulnerability shown is the property pollution and how it can be exploited in cases where user input isn't sanitized before being passed into library code that isn't safe.
      The proof of concept was just an example of what could happen in a specific case where Next.js and AMP was used, that would pass query parameters directly into the getServerSideProps through the unflatten function, as a way to run arbitrary code on the web server.

    • @hesh1700
      @hesh1700 2 года назад +11

      @@dealloc Thanks for the clarification. I Really appreciate it, but still I'm amazed of people who actually discover these exploits or vulnerabilities for the first time. How they think, how they do stuff amazes me.

    • @mogwai888
      @mogwai888 2 года назад +6

      @@hesh1700 inspiration from other vuln types, knowledge of building/coding stuff from scratch (you're a dev) and the time to sit around playing with things your interested (or are paid well) to research.

    • @aditya.khapre
      @aditya.khapre 2 года назад +2

      In the end, the attached HAS to pollute the code on the server for this to work.

  • @chairlovawitabat
    @chairlovawitabat 2 года назад +93

    Subscribed to your channel a while ago because you discussed interesting topics outside of my primary area of interest. As a front end React developer, I'd never thought I'd see a video on your channel that cut so close to home. This is absolutely excellent information to know. omg thank you so much for this video!

    • @RodrigoMallmann1
      @RodrigoMallmann1 2 года назад +2

      Totally agreed! This video earned him my sub. Interesting to watch his other videos.

  • @jemesmemes9026
    @jemesmemes9026 2 года назад +12

    there’s fun depth to the “everything is an object” thing, basically amounting to “mostly everything is an object”

  • @rayanfernandes2631
    @rayanfernandes2631 2 года назад +15

    This channel is gonna touch millions soon. Every video you create makes me curious about how it all can be broken down and easily hijacked. i love the graphics , very neat and clean.

  • @Lupinicus1664
    @Lupinicus1664 2 года назад +12

    This is excellent work. So refreshing to find a clear, concise description of tricky topics. Thank you for the work this video took, it was well worth it.

  • @shanek.6293
    @shanek.6293 2 года назад +5

    This genuinely is the only thing that made me understand objects. Thank you so so much!

  • @cat-.-
    @cat-.- 2 года назад +5

    Lol I have always thought prototype pollutions as an annoyance but you have shown that batshit libraries can make it basically an RCE, goddamnit

  • @blakek13
    @blakek13 2 года назад +2

    Excellent video and explanation!
    In my opinion, prototype issues shouldn’t be the module’s issue (i.e flat isn’t vulnerable). It’s the incorrect usage of the module that causes the vulnerability. This is like saying a MySQL library is vulnerable because it allows the programmer to pass unsanitized user input. Putting this responsibility on the module is something I’ve noticed more in JS since npm started it’s automatic “audits” on module installs.

  • @cliffclof
    @cliffclof 2 года назад +1

    This is a great example. Will def be thinking about properly blocking prototype chain traverse while coding.

  • @cybroxde
    @cybroxde 2 года назад +12

    Billion Dollar Companies: Spending Millions on patching vulnerabilities
    Also Billion Dollar Companies: Shipping Frameworks that sideload code from a CDN and run it on your server without further checks just to save the developer 5 Minutes of thinking.

    • @cybroxde
      @cybroxde 2 года назад +2

      Addendum: I agree that in this case, the root cause is not the framework itself. However, it is a contributor to the issue and the CDN simply being compromised is another very possible and very unnecessary attack vector that using it adds to your application.

    • @FlorianWendelborn
      @FlorianWendelborn 2 года назад +6

      @@cybroxde Yeah, it looks quite insane to me to yolo-execute arbitrary code from a URL without verifying it via their public key with asymmetric cryptography. But AMP is evil anyways, so not too surprised they also added backdoors to servers that comply with them

  • @gimmethedata4256
    @gimmethedata4256 2 года назад +31

    How well does the automated search for exploits actually work? What is the chance that a given exploit is detected? What I do know out of experience is that most exploits have been there for a pretty long time, and that 'there always are exploits'.

    • @dealloc
      @dealloc 2 года назад +8

      It scans for already known vulnerabilities. While there are ways to use somewhat scan for possible vulnerabilities with static analysis and checking for common flaws. But the best known solution is to check against a database of known vulnerabilities, that have been discovered and reported by people.

    • @gimmethedata4256
      @gimmethedata4256 2 года назад

      @@dealloc Hm well now I think of it, it should be pretty easy if you just look for outdated libraries which is dogwork for humans but very systematically approachable in some areas I think. This could for example be used in combination with the Log4jl REC exploit, where basically logging any user input in an outdated library is 'lethal'.
      What I also do know is that my friend actually tried InteliJ"s search to try to find a recent minecraft server crashing exploit. This exploit had been around for a few years in some, and is in the interest of some very hackerous communities. (shulker box dispenser world height exploit, 'hackerous communities' meaning 2b2t)

    • @dealloc
      @dealloc 2 года назад

      ​@@gimmethedata4256 The issue is not so much to look up dependencies of libraries, that's easy. The hard part is finding the vulnerability in the original library or code where it originates. Any software the relies on code that has vulnerabilities will also inherit those vulnerabilities. But the severity depends on where and how it's used. So it doesn't mean that software that uses a library with vulnerabilities is itself vulnerable if the it's used in places that aren't exploitable.
      In the case of Log4Shell it is a severe vulnerability for any library and code that passes any user input, but not so much if it doesn't.
      This is sometimes a problem with automated systems as most of the results can be false positives, especially when scanning development-only environments. It adds a lot of noise and can hide the real threats that appear in code that interfaces with user and other external sources.

    • @gimmethedata4256
      @gimmethedata4256 2 года назад

      @@dealloc Yeah, but finding which things use the lib is already 20% of the most boring part of the work. I agree, it is rly hard to determine systematically whether or not something is an exploit, for therefore you first need to define what user input is. I agree that is really hard.
      Ig everything that goes through netty can be regarded as 'user input', but there I bet there are tons of ways to connect to netty so that is already a problem. Then you have also got libraries on top of the netty stuff ... then you need some algorithm to follow the stack trace of the user input and 'understand' a lot of internal functions, and how they change the user input.
      It is also kinda tricky to determine whether or not something is an exploit, I mean for RCE it should be pretty easy, but for teleportation exploits in game it is hard. But hey, even if you find 1% of the exploits systematically, then that is still an absolute win. I mean it is really 1% * times a thousand projects times 10 hidden exploits per project ... That's still a 100 exploits. So therefore I think you should focus on the easily systematically detectable exploits.
      Would you wanna collaborate on something like that?
      hobrin#4694

  • @iliedobre7703
    @iliedobre7703 2 года назад +4

    Thats why I name my variables Yoda style, instead of isAdmin I put AdminIs

  • @MarekWojt
    @MarekWojt 2 года назад +2

    > "everything is an object"
    > getting "undefined is not an object" all day long

    • @FlorianWendelborn
      @FlorianWendelborn 2 года назад +1

      Fun fact, you used to be able to overwrite undefined to a different value in JS... IIRC it was just window.undefined = true and suddenly everything breaks down

  • @divzthepro9937
    @divzthepro9937 2 года назад +1

    A class is like a blue print meanwhile a object is a building i guess

  • @CrashCubeZeroOne
    @CrashCubeZeroOne 2 года назад

    Pwn: a class is basically a structure.
    C#: so a structure is basically a class.

  • @wtfdoiputhere
    @wtfdoiputhere 2 года назад +1

    Being someone who recently figured out OOP in JavaScript and wrote a blog to share my knowledge, i rly loved this vid and it made soooo much sense to me

  • @a_maxed_out_handle_of_30_chars
    @a_maxed_out_handle_of_30_chars 2 года назад +3

    I liked your presentation and animation skills

  • @dhyeychoksi5178
    @dhyeychoksi5178 2 года назад +3

    Appreciate your work man! Nice video

  • @zxuiji
    @zxuiji 2 года назад +14

    off topic but it's a thing I learned today, in css you can honour text dpi by simply using the "in" unit on :root font-size then use rem everywhere else

  • @b43xoit
    @b43xoit 2 года назад

    The Self language pioneered objects without classes. Javascript continued that capability.

  • @boris_js
    @boris_js 2 года назад +1

    Damn whenever i feel i know everything in js and then i see something like this which blows my mind..so many more things to learn

  • @vintprox
    @vintprox 2 года назад +3

    Whoever though that flattening user input object into your codebase is alright, and that runContext is going to make better companion than eval?
    Yet another reason to switch over Sapper and other Svelte minimalistic solutions, in my opinion.

  • @jeschinstad
    @jeschinstad 2 года назад

    This channel is _awesome_ man! I've just discovered it and I love it! Great work.

  • @ianrhys
    @ianrhys 2 года назад +11

    node can be a nightmare if not done properly right. Keep an eye on package vulnerabilities or jump ship to stable backend scripts like php and python. Not saying they are secure but you have less to worry about.

    • @DKLHensen
      @DKLHensen 2 года назад +6

      Same kind of stuff happens in python and Php. Take a look at either language’ eval function. You should only ever use these kind of functions if you are 100% sure what you are doing is safe, but mostly this is mission impossible

  • @FedoraRose
    @FedoraRose 2 года назад +4

    Finally a new video I always learn so much

  • @AlienX-p2f
    @AlienX-p2f Год назад

    Gonna refer my buddies to learn OOP from this wholesome vid

  • @shintsu01
    @shintsu01 2 года назад

    Wow i am not a developer but a light bullb watching your video(s) with a mind blown effect. Thanks for the clear and understandable explanation why and how a exploit works. now i need to check my ops team if they actually manage exploits like these in general.

  • @pxdav
    @pxdav 2 года назад +3

    Hey PwnFunction, just wanted to ask how do you make these videos. It looks really cool especially the drawing thing

  • @maxwax7958
    @maxwax7958 2 года назад +7

    Great content an keep it up 💪

  • @elevatecyber5031
    @elevatecyber5031 2 года назад

    This is true black magic. Love it!

  • @JoshPaulie
    @JoshPaulie 2 года назад

    Damn you!!! I swore I’d never learn js, but now I know how to make js classes 😭

  • @xenialxerous2441
    @xenialxerous2441 2 года назад

    Hey! Awesome video btw. Loved it thoroughly 🙌🎉

  • @codepro3380
    @codepro3380 2 года назад

    Your Logo is OP!! + the explanation ( Can you make react videos maybe in the future if you know ) ?

  • @mrala
    @mrala 2 года назад +4

    more prototype pollution please :)

  • @i_dont_want_a_handle
    @i_dont_want_a_handle 2 года назад +1

    "Everything in JavaScript is an object" - well no, not everything, forget that immediately

    • @vanjazed7021
      @vanjazed7021 2 года назад

      technically yes, just not the same type of object, but they all have common superclass

    • @i_dont_want_a_handle
      @i_dont_want_a_handle 2 года назад

      @@vanjazed7021 no, seriously. The fact that you can invoke methods on a string literal does not mean that strings are objects, it's merely a convenience mechanism. Strings are passed by value and their "typeof" is not object, so they really are primitive (just like numbers, bools, undefined and null)

  • @az.tek.00
    @az.tek.00 2 года назад

    missed ya, master pwnfunction. thx for the post. happy holidays. 🌟

    • @PwnFunction
      @PwnFunction  2 года назад

      Happy holidays to you too :)

  • @frigga
    @frigga Год назад

    Stateful server side rendering is the root of all evil.

  • @Karan-um4bw
    @Karan-um4bw 2 года назад +1

    im here at 113k subs, and I'll be here for the 1 mil subs. great content ❤️

  • @lljw9455
    @lljw9455 2 года назад

    Binge watching your vids! Great content btw💕

  • @Hope-kf1nl
    @Hope-kf1nl 2 года назад +5

    Do share a link to your IDE plugins. Digging the layout.

  • @jamesjones2212
    @jamesjones2212 2 года назад

    Awesome video as a life long hacker i am always amazed however much things change they stay the same.

  • @newton4098
    @newton4098 2 года назад

    I llike the whole, "Eminem is a square" analogy.

  • @warengonzaga
    @warengonzaga 2 года назад

    Thanks again @PwnFunction hahaha I'll create a list of your repos lol.

  • @falxie_
    @falxie_ 2 года назад

    Oh god I gotta run snyk against my codebase now

  • @evolutionxbox
    @evolutionxbox 2 года назад

    The rectangle class is an object

  • @bas5rocker311
    @bas5rocker311 2 года назад

    great video man, what's your terminal configs btw

  • @mmti1010
    @mmti1010 2 года назад +1

    12:20 👀👀 Don't to worry child, oh fu*k

  • @henriquematias1986
    @henriquematias1986 2 года назад

    great video! what next.js version is this bug on? have you reported that to vercel?

  • @yasserarguelles6117
    @yasserarguelles6117 2 года назад

    *Me in C programming procedural code, offline*: now this is safety

  • @shashwathegamer
    @shashwathegamer 2 года назад

    You earned a sub ;) (and a disc member too :))

  • @rishabkumar2187
    @rishabkumar2187 2 года назад

    bro i really love your content . especially the way you teach 🔥🔥🔥🔥😍😍😍😍💘💘

  • @flexiorange3048
    @flexiorange3048 2 года назад

    Man this is gold. Thanks!

  • @efeservili
    @efeservili 2 года назад

    Thank you for tNice tutorials! I've been trying to figure the software out on my own for a wNice tutorialle, and it's horribly confusing. TNice tutorials is the only guide video

  • @JorgetePanete
    @JorgetePanete 2 года назад +1

    3:40 i just put 2x speed and you say "eminem"

  • @Wynell
    @Wynell 2 года назад

    Amazing video! BTW what's the font?

  • @thetrends5670
    @thetrends5670 2 года назад +4

    Is it the channel of LiveOverflow's little brother?

  • @kuroexmachina
    @kuroexmachina 2 года назад

    finally, something interesting popped up in my recommended

  • @astranger7995
    @astranger7995 2 года назад

    how did u make yor VScode look so good

  • @boshbosho8181
    @boshbosho8181 2 года назад

    Pure gold, thank you!!!

  • @0xdecaf
    @0xdecaf 2 года назад +2

    great video as usual

  • @b43xoit
    @b43xoit 2 года назад

    I don't have familiarity with next.js and I guess readers who do have that understand where in your talk you refer to where a user could cause their arbitrary code to be executed on the server side, but for me, you blow through that very quickly and I don't understand or hear where you explain that. But I guess the bottom line of what you are saying here is that something about next.js or some common way to use it opens such a vulnerability.

  • @dandogamer
    @dandogamer 2 года назад +1

    Learnt something new, nice vid

  • @paxdriver
    @paxdriver 2 года назад

    Does this work even when dependencies are minified or do the object properties need to match the names in the objects exactly?

  • @robinzon100
    @robinzon100 2 года назад

    did next or amp peps at least patch this? but I guess it's not next or amp vulnerability but the flatten modules

  • @lowborn7231
    @lowborn7231 2 года назад

    I know many people have already made videos abou it, but I really wanted to see youir video about Log4j vulnerability. I wanted to see your opinion as a security researcher, please, if you can, make a video about it.

  • @ej.xxxx_
    @ej.xxxx_ 2 года назад +1

    Welcome back!

  • @mirrormirage0
    @mirrormirage0 2 года назад

    Awesome work!

  • @kuchingneko9616
    @kuchingneko9616 2 года назад

    glad your back

  • @LUISANGEL27
    @LUISANGEL27 2 года назад

    I love tne way you explain

  • @bigchum3984
    @bigchum3984 2 года назад +1

    are you able to access the base object because it was a global variable? would namespacing protect against this?

    • @ZoranRavic
      @ZoranRavic 2 года назад

      The base "Object" is always global.

  • @iamdanfleser
    @iamdanfleser 2 года назад

    what did you use to animate this video? edit software?

  • @Happy_Shaikh
    @Happy_Shaikh 2 года назад

    Which screen recorder do you use bro?

  • @pala9983
    @pala9983 2 года назад

    HTML Injection explained pls!!

  • @IShowD
    @IShowD 2 года назад

    what is the whiteboard software u using ?

  • @jlacr8056
    @jlacr8056 2 года назад

    can we do a video where you don’t explain the entirety of OOP beforehand

  • @0xfolling
    @0xfolling 2 года назад +18

    I really appreciate your explanations and know this is subjective: But personally I would prefer if you assumed some basic knowledge about a subject and then explain the topic you want rather than explaining everything from the ground up. The explanation for classes, objects, and members felt a little bit underwhelming for the video at hand. That being said, your explanation there was, as always, wonderful, along with the rest of the video!

    • @PwnFunction
      @PwnFunction  2 года назад +10

      Thanks! I'll apply that next time. A bunch of people also told me the same thing. I appreciate the feedback.

    • @user-sn6yb8kr1m
      @user-sn6yb8kr1m 2 года назад

      @@PwnFunction I really appreciated and enjoyed how it was broken down and explained.
      Subscribed and liked as well!

    • @fastexpand
      @fastexpand 2 года назад +3

      Consider putting in timestamps so people who already know it can skip ahead easily and beginners can still watch the basic stuff

    • @animeguywithexistentialcri5084
      @animeguywithexistentialcri5084 2 года назад

      @@PwnFunction btw what colorscheme you're using in vscode in this video, sir? mine is the default and not really that colorful...

  • @biggietuna9843
    @biggietuna9843 2 года назад +1

    I polluted my pants

  • @_Funtime60
    @_Funtime60 2 года назад +2

    It seems REALLY dumb that JS lets you add things to objects that aren't in the class and add things to both ON THE FLY. I can see uses for this, but none of them need this feature and it adds looks to add so many risks.

    • @blakek13
      @blakek13 2 года назад

      This was heavily used for something called polyfills. Basically, if the browser doesn’t support a JS feature (or its implementation is buggy) you can conditionally add it to the language yourself. It’s used a lot less in modern code supporting modern clients. It’s also pretty useless for business logic.
      It was great for JavaScript because the number of runtimes that many projects supported. This would be a lot less useful in a compiled language because you know the compiler you’re targeting and the features it supports.

  • @Elenthiriel
    @Elenthiriel 2 года назад

    Please , teach us how to understand and debug code like you

  • @junfengou6856
    @junfengou6856 2 года назад

    This is awesome!

  • @tomontheinternet
    @tomontheinternet 2 года назад

    Not everything in JavaScript is an object. Most things are but not everything.

  • @jaywye
    @jaywye 2 года назад +1

    I like the penguin

  • @gadgetvala
    @gadgetvala 2 года назад

    Nice explanation

  • @TheJoaogouveia
    @TheJoaogouveia 2 года назад

    I'm a bit confused about how the getServerProps is actually exploited, in the example, it's not even receiving data from the url query, also, even if it was, the only prop being returned is the one we actually want, can someone kindly point out which part of the process am I missing?

    • @bussin1337
      @bussin1337 2 года назад

      I'm guessing the unflatten function itself does something to the input that overrides the global Object's __prototype__. Don't even need to return the value

  • @mpldr_
    @mpldr_ 2 года назад +11

    How to fix most web exploits: get rid of the overuse of JavaScript and set a strict CSP. Can't exploit users if no JavaScript is run.

    • @cat-.-
      @cat-.- 2 года назад +13

      This exploit is entirely server side, so csp isn’t gonna do jack

    • @omri9325
      @omri9325 2 года назад

      So naïve...

  • @snotvlek4721
    @snotvlek4721 2 года назад

    I never knew that you could just add random new variables into objects into Javascript. What an abomination

  • @kyputer
    @kyputer 2 года назад +1

    Well done 💪

  • @omkarpotpelwar1671
    @omkarpotpelwar1671 2 года назад

    What terminal is that??

  • @scrambledmandible
    @scrambledmandible 2 года назад

    2:00 does this mean C structs can be classes

    • @b43xoit
      @b43xoit 2 года назад

      Before C++ was called C++, it was called "C with classes". The classes were a minor enhancement over structures.

  • @Shortyxoli
    @Shortyxoli 2 года назад

    (proceeds to continue)

  • @wowbean
    @wowbean 2 года назад +2

    No idea what’s happening but I like it.

  • @Michaelmishael
    @Michaelmishael 8 месяцев назад

    thanks alot

  • @avilde
    @avilde 2 года назад +6

    "Everything in Javascript is an object?" E.g. primitives like boolean, string, number are not objects.

  • @oldbootz
    @oldbootz 2 года назад +1

    npm audit fix --force

  • @siddharthchhetry4218
    @siddharthchhetry4218 2 года назад +1

    One day i will understand this video fully :) Thank you for sharing such an awesome content .

  • @JLSynth
    @JLSynth 2 года назад

    Awesome!!

  • @Parrotassassin15TechToker
    @Parrotassassin15TechToker 2 года назад +3

    oop I am first lol that is cool loving your channel so far though!

  • @ZakiWasik
    @ZakiWasik 2 года назад +1

    I tried your repo. After polluting the prototype like you do at 10:54 I get the 404 but if I try to go to localhost:3000 I still get 404 so I guess the global namespace did not get polluted in my case?

  • @giantisopod
    @giantisopod 2 года назад

    This is horrifying. Why do people still write code in JavaScript?