Deciphering Obfuscated JavaScript Malware

Поділитися
Вставка
  • Опубліковано 17 чер 2024
  • Do you like solving programming puzzles? Want to uncover what a malicious attacker is actually trying to do with their code?
    In this video, we manually deobfuscate and Reverse Engineer an obfuscated JavaScript file. We look at a malicious loader file that downloads and executes a secondary AsyncRAT payload. You can follow along yourself with the video, by using the hash listed below!
    ---
    File Hash: 978bf1471b3536dfdea854dd1c5d8ee63bdfbc8223c0254a92b183a711699a3a
    ---
    Timestamps:
    00:00 Intro to JavaScript Deobfuscation
    06:03 Deeper Deobfuscation Techniques
    12:02 Decoding Variables
    18:00 Analyzing Obfuscated JS Function Calls
    24:00 Uncovering Hidden Functionality
    30:00 Reconstructing the Malicious Payload
    ---
    LaurieWired Socials:
    linktr.ee/lauriewired
    ---
    Intro Music Courtesy of Analog Summer:
    • Cloud Reverie by Analo...
  • Наука та технологія

КОМЕНТАРІ • 341

  • @bartekklusek5242
    @bartekklusek5242 Місяць тому +54

    This is not really my area of interest specifically, although i follow various computer related content.
    What actually shocked me, after watching several videos, is how orderly mind this lady has. Absolutely smooth speaking about complicated topics.
    I envy that talent so much.

  • @christopher8641
    @christopher8641 2 місяці тому +78

    I'm a backend dev and have never dug into malware analysis, but this video made the process look pretty fun and rewarding. I guess it is just a big dangerous puzzle

  • @cusematt23
    @cusematt23 2 місяці тому +183

    holy effing sht. I literally just came across some heavily obfuscated js code that i am dying to reverse engineer and this vid came up. there is a god.

    • @adityadas5835
      @adityadas5835 2 місяці тому +19

      Or maybe Big Brother is tracking you. Who knows? 😕

    • @corp-por
      @corp-por 2 місяці тому +2

      wtf, almost the same here. A client just called me because a js file was triggering a virus alert in windows defender. And here I am 🥸

    • @Katchi_
      @Katchi_ 2 місяці тому

      Liar.

    • @cusematt23
      @cusematt23 2 місяці тому +1

      @@Katchi_ Not even kidding. I am using a complex optimization app and instead of it doing work on the server it just sends a giant minified obfuscated js bundle. And I am curious although not as smart as Laurie and will prob never fully reverse engineer it.
      So far the only thing I am getting is that the code using the glpk javascript library. I didn't even know this existed so that's a bonus at least. I am guessing there will soon be a day where most of the python AI/ML library functionalities are in javascript and running in your browser without (most people) you being aware. I am unsure if i should be excited or petrified.

    • @cusematt23
      @cusematt23 2 місяці тому

      @@adityadas5835 certainly possible.

  • @NatteeSetobol
    @NatteeSetobol 2 місяці тому +3

    Nice, I was looking for a nice detailed video that goes through such an annoying obfuscation in JavaScript. Thanks!

  • @digitalradiohacker
    @digitalradiohacker Місяць тому +29

    I'm a complete code mong, so I'm trying to "hang around" with smart people to soak up as much as I can - hence, why I'm here.
    Just to prove I was paying attention:
    28:30
    It looks like the integer returned was "1".
    You went back to the code and typed "0".
    Thanks for the walkthrough of what you're doing - Picked up a couple of tricks here.

  • @TheChugnut
    @TheChugnut Місяць тому +4

    Wow, just found your channel and I love it. Your presentation style is amazing!

  • @nathaniellovely
    @nathaniellovely 10 днів тому

    This channel is really phenomenal. Everything from the technical aspect and way you break everything down in a clear and precise manner, the way you articulate yourself clearly, the synthwave color schemes and background setup is epic… I love all the things! Favorite channel lately :-)
    You are very knowledgeable and talented and it shows. Thank you for sharing your knowledge!

  • @VincentGroenewold
    @VincentGroenewold 2 місяці тому +2

    The quality of these videos is just great, I'm not into JS at all, but it's well explained to follow along, nice! It all feels very much like security through obscurity, I predict this can be automated in the near future.

  • @DotDager
    @DotDager 2 місяці тому +3

    A lot of interesting insights, great job as usual!

  • @leoroux4712
    @leoroux4712 2 місяці тому +6

    I did't need this but the explanation was so clear I kept watching

  • @thediskostarz
    @thediskostarz 2 місяці тому +4

    Awesome video Laurie, I learned a lot by watching your well explained videos. Thank you.

  • @UliTroyo
    @UliTroyo 2 місяці тому +2

    This was a lot of fun! What a cool breakdown.

  • @svampius2448
    @svampius2448 Місяць тому

    I love the content and aesthetics of your videos, definitely my favourite channel at the moment! Also, for some reason you make me think of squirrels, which is fantastic - a vaporwave squirrel.

  • @mr.bulldops7692
    @mr.bulldops7692 2 місяці тому +1

    Clear, concise, and cool as hell. You picked a great code example!

  • @ArjanvanVught
    @ArjanvanVught 2 місяці тому +78

    @28:29 a little error here ;-) pasting 0 instead of the 1

    • @swenic
      @swenic 2 місяці тому +5

      ^ 28:41

    • @sonyarianto
      @sonyarianto Місяць тому

      yeah this is a bug in this video

  • @sshiiden
    @sshiiden 2 місяці тому +7

    You did a really good job with the style of your videos

  • @nicogetz
    @nicogetz 12 днів тому

    You've done a great job of presenting this in a clear way that makes an otherwise daunting endeavor make a lot more sense. Of course, your intuition about what the code is doing is a major factor, and that can only be developed with experience and persistence...

  • @iss9280
    @iss9280 2 місяці тому +49

    One of my new favorite channels! I love the old school Tech Tv/G4 vibe of your set.

    • @shady4tv
      @shady4tv 2 місяці тому +3

      The theme is from Serial Experiments Lain.
      great anime - only like 13 episodes. Would recommend watching if you have the time. I will warn you tho - it's a trip.

    • @Desmaad
      @Desmaad Місяць тому +1

      Not to mention the Classic Mac (Copland/OS 8-9.2) theming.

  • @menegatmarcelo
    @menegatmarcelo 2 місяці тому +2

    Laurie, your voice and way to explain is gorgeous!! New favorite channel! Im a simple FE developer who loves non FE content :) Thank you for exists!

  • @jefflucas_life
    @jefflucas_life 2 місяці тому

    I like the way how this was video instructed , thumbs up!!

  • @hitmongg
    @hitmongg Місяць тому

    I've never looked at malware before; it's super interesting. Thanks for sharing!

  • @Emerson1
    @Emerson1 2 місяці тому +2

    Great video, and great production value

  • @kelliaa
    @kelliaa 2 місяці тому

    really sick video, gonna try to learn more about this, and your set is so sick

  • @dblanque
    @dblanque Місяць тому +4

    Super neat video, really high level of production (also, 28:37, oopsie daisies the 1!) :P
    Really awesome content, learnt a lot Laurie! Subbed :)

  • @dudemcperson3582
    @dudemcperson3582 2 місяці тому +11

    I absolutely love the way you break this down. Thank you!

  • @OneAndOnlyMe
    @OneAndOnlyMe 2 місяці тому

    This was a great tutorial, Laurie!

  • @shockinho
    @shockinho 2 місяці тому +6

    This is so good I can't believe it exists, let alone such good content being free on UA-cam.
    Amazing work

  • @tysonbenson
    @tysonbenson 2 місяці тому +1

    Thanks, Laurie! Awesome video!

  • @Plagueheart
    @Plagueheart 2 місяці тому

    I like the channel, it has a 90's style vibe from PBS after school tv educational shows which gives me that nostalgic vibe

  • @Anthony-vb7sj
    @Anthony-vb7sj 24 дні тому

    impressive work !!!
    This channel is very Under-rated 😯👍🏻

  • @plato4ek
    @plato4ek 2 місяці тому +33

    20:39 and other places: you don't need to write the "console.log", just expression itself is okay.

    • @drwhitewash
      @drwhitewash 2 місяці тому +2

      Exactly, the console will output the result of that expression, instead of those "undefined"s.

    • @kxmode
      @kxmode Місяць тому

      I think she's being extra careful to isolate the output to the console

    • @plato4ek
      @plato4ek Місяць тому +2

      @@kxmode this won't help isolate anything. Everything inside the "console.log()" is being evaluated anyway.

    • @DavidLindes
      @DavidLindes Місяць тому

      @@kxmode the thing is, she's _in_ the "console" (in other languages, it might get called the REPL -- Read, Evaluate, Print (in a Loop)), so, as plato4ek says, it's not really isolating anything in this context. What she's doing isn't harming anything, of course, it's just also not buying much when done interactively. (But it would be very useful if recording it to a file and running it with node, say, so, perhaps it's a habit born from such intentions in prior work.)

    • @kxmode
      @kxmode Місяць тому

      @@DavidLindes hmm... good to know. always thought console.log was a way to sandbox the code. A good note to self.

  • @Slycooper2456
    @Slycooper2456 2 місяці тому +5

    Such great videos! (Love the Burnout clips at the end of each videos such a fun a game!)

  • @enthusi
    @enthusi 2 місяці тому +25

    Obfuscated code is fun.. JavaScript not so much my cup of tea 😊 Thanks for presenting these topics!

    • @dodgecoates8760
      @dodgecoates8760 2 місяці тому +3

      How can you like obfuscated code but not love javascript?

  • @hensou
    @hensou 10 днів тому

    Thank you! That was fun! Sounds like a thing I would like to do, I definitely want to learn more about this :)

  • @jhonm6347
    @jhonm6347 Місяць тому

    Damn, this is very informative. I can't quite keep up with everything yet because I'm new to coding but it is very interesting, great video.

  • @vapaspen
    @vapaspen 2 місяці тому

    My team has been fighting this thing for months now. When we got our first Sig it we though it was a FP cause of how many hits we got but no its just hitting that many people. Its a nasty little bugger. Thanks for the really cool breakdown on this! :)

  • @thefrub
    @thefrub 2 місяці тому +2

    Your production value is through the roof, you've got the whole room setup, the multiple cameras, the old Mac aesthetic. And you're great at this! This is amazing

  • @rafaelskt4ever
    @rafaelskt4ever 2 місяці тому +4

    Love your Serial Experiments: Lain theme

  • @zhanezar
    @zhanezar 2 місяці тому +1

    this was so good to watch, the quality of production is amazing

  • @MrDarthsirius
    @MrDarthsirius 13 днів тому

    Learned some obscure (to me) JS syntax today. Cool.

  • @BillyC
    @BillyC 2 місяці тому +1

    This was sick to watch!

  • @zzord
    @zzord Місяць тому

    Well done!
    Quick tip: You don't need to use console.log to evaluate expressions. You can just paste the expression and evaluate it directly.
    Also, at 22:56, you could evaluate the whole object in one step, instead of doing one function call at a time.

  • @syth-1
    @syth-1 2 місяці тому

    Great video - these are all tricks I've used to deobfuscate API's I probs shouldn't be using .-.
    If you know the code is safe to run, and have a bit more complex code that jumps thru many different libraries, executing and walking thru the code line by line helps a tone,
    What you maybe reverse engineering maybe just one file, but seeing the external lib calls and filling in the values returned just like in the video rlly helps put the puzzle together, (of course gotta give props to browser Dev tools - when walking thru code can just hover over any variable to see the current value inside)

  • @trex6142
    @trex6142 Місяць тому

    Well done and super interesting!

  • @BlackHermit
    @BlackHermit 2 місяці тому +6

    A true gem for anyone passionate about unraveling the mysteries! This step-by-step approach to deobfuscating and reverse engineering an obfuscated JavaScript file is not just informative, but downright thrilling. I love how Laurie invites viewers to follow along with the truth provided. Simply invaluable! 💻🔍✨

    • @timolff9239
      @timolff9239 2 місяці тому +1

      what's the point of using chatgpt to comment on a youtube video?

    • @BlackHermit
      @BlackHermit 2 місяці тому

      @@timolff9239 ChatGPT's English is better than mine. I couldn't have possibly articulated my feelings towards this video better than it did!

    • @AEONIC_MUSIC
      @AEONIC_MUSIC 2 місяці тому

      But everyone can tell it's AI so we think it's fake. Also I think claude opus has more natural speaking

    • @BlackHermit
      @BlackHermit 2 місяці тому

      @@AEONIC_MUSIC Well, it is fake in the sense that I was not the one who worded everything, but I did tell ChatGPT what I felt!

    • @fabriziolopez66
      @fabriziolopez66 12 днів тому

      @@timolff9239 😂

  • @LuisGarcia1992_
    @LuisGarcia1992_ Місяць тому

    LOVE the effect of a tape fast-forward 😂

  • @theelliotwoods
    @theelliotwoods 12 днів тому

    Great video. I was hoping at the end you’d also say “and if you wanted to skip all that process you could just replace the ActiveX line with console.log to see exactly what it’s trying to execute without going through the whole process of untangling it.”

  • @Dorff_Meister
    @Dorff_Meister 2 місяці тому

    That was a lot of fun. Thanks!

  • @ronen124
    @ronen124 Місяць тому +1

    28:37 aquí escribiste '0' en lugar de '1' por error .
    Esta fue una ingeniería inversa interesante y fascinante para dicho malware, muchas gracias por compartir tu análisis.

  • @mistersunday_
    @mistersunday_ 2 місяці тому

    Laurie, your channel is genius

  • @robertivaneinarsson5868
    @robertivaneinarsson5868 2 місяці тому +13

    Fantastic! I would love a video from you breaking down the XZ backdoor thing.

    • @Ron55O
      @Ron55O 2 місяці тому

      That's what I thought at first too😅

  • @No0Vad
    @No0Vad 2 місяці тому

    Sometimes you get lucky with Auto-play enabled, that's how I found this video which I enjoyed. Love the retro feeling!

  • @giamagg4602
    @giamagg4602 2 місяці тому

    Thanks, Laurie!
    You are awesome

    • @giamagg4602
      @giamagg4602 2 місяці тому

      In line 75 of your js code, the console log response is 1 and you put 0.
      Anyway you have obtained the IP and completely gutted the malware.
      I love it
      28:42
      console. log(0x1b9 * 0x9 + 0x2354 + 0x1 *-0x32d4)
      1

  • @Futureretrobix
    @Futureretrobix 2 місяці тому

    I love your videos Laurie!!!!

  • @JosephSaintClair
    @JosephSaintClair Місяць тому

    Thank you for covering IOCCC. Something I always encourage aspiring programmers to try for themselves first the personal challenge and discipline. 🙏

  • @RyanEglitis
    @RyanEglitis 3 дні тому

    Pretty cool to see the malware "come to life" with deobsfucation. I probably would have just run the object as a single line that was getting all the commands, since it ended up putting them into a simple object structure that would be easy to copy out from, but that's just a speed-up of the process.
    I'd be interested to see a _more_ obsfucated piece of code. Some of the fun stuff I've seen is single letter function/variable names, an extensive use of hex codes, as well as the oft broken eval().

  • @Sasha-Good
    @Sasha-Good Місяць тому

    Amazing ReveЯsive design on channel 💯

  • @ShannonWare
    @ShannonWare 2 місяці тому

    JS tools tip for NPP won you a subscriber! Thanks a million, my favourite app just got better XD

  • @marshallgraphic
    @marshallgraphic 2 місяці тому

    Excellent work!

  • @martin1b
    @martin1b 2 місяці тому +1

    I love this. It's amazing how obfuscation can make it look so much more complex than it really is.

    • @mendodsoregonbackroads6632
      @mendodsoregonbackroads6632 2 місяці тому +1

      Yea the way it all boiled down at the end to just a few lines of code was pretty cool.

  • @jcKobeh
    @jcKobeh 2 місяці тому +4

    The horizontally flipped front face camera has had me wondering exactly what you were doing for a couple of videos.
    Did you decide to do it to have your face "looking into" the direction of the code?
    Now that I'm commenting, I'll just say: I love the graphic overlays and design you use. And the way you present these videos, just clear voice, no music, well prepared, and sitting still and straight throughout the whole thing,
    My respects. I know how all of these kind of things are invisible to most when done correctly, but cheers, it doesn't go un-appreciated.

    • @Hwyadylaw
      @Hwyadylaw Місяць тому

      Webcams and front-facing phone cameras tend to mirror the image to emulate.. well, a mirror, since that's how most people are used to seeing themselves.

    • @jcKobeh
      @jcKobeh Місяць тому

      @@Hwyadylaw but that footage looks like a real camera, not a webcam, which is why it seems to me like it must be an active decision and not just the default thing the camera does.

  • @ZioYuri78
    @ZioYuri78 2 місяці тому +2

    This is so fascinating, thanks for sharing your competence!

  • @davidburns8113
    @davidburns8113 2 місяці тому +2

    I'm ecstatic I just found this channel! TYSM for sharing skills and methods like this on the Internet for free! Also the little corgi made my day!!

  • @justinmiller3349
    @justinmiller3349 2 місяці тому

    Incredibly educational, and great production value. You're killing it. Keep it up!

  • @GerbenWijnja
    @GerbenWijnja 2 місяці тому

    Nice work, Laurie. Of course there are many shortcuts possible all over the place, but that also increases the risk of errors. Refactoring piece by piece provides more confidence that you're on the right track. Is the original code available somewhere? I couldn't find it with just the hash.

  • @Montegasppa
    @Montegasppa 29 днів тому

    This is the first (maybe second) os your videos I watch, and I got the reference. シリアルエクスペリメンツレイン

  • @penguin_m1rage
    @penguin_m1rage 2 місяці тому

    This video is so awesome omg 🤯

  • @Kakerate2
    @Kakerate2 Місяць тому

    i love seeing this done in n++!

  • @timewarptrio11
    @timewarptrio11 Місяць тому

    Well explained!

  • @damien__j
    @damien__j 2 місяці тому +5

    I see LaurieWired and I click

  • @nceban2136
    @nceban2136 Місяць тому

    Not a big fan of Lain, but still can appreciate the committment to the intros

  • @shpleemcgert
    @shpleemcgert 2 місяці тому +6

    At 23:06... If your ultimate goal was to get the _0x502708 map object, couldn't you have executed that block in your dev tools and just printed it out? Especially since you know the method was just outputting string characters and was not inherently malicious.
    Please correct me if there is something I'm overlooking here. Just a gut reaction at a potential time save
    Also this video was beautiful and I love your editing style. This is incredibly educational and I have subscribed. Looking forward to seeing more of your thought process.

    • @thmo_
      @thmo_ 2 місяці тому +1

      yeah, would have been a time save to let it write the commands up to the last two map entries actually using the activexobject.

    • @epiphaner
      @epiphaner 2 місяці тому +5

      I'm guessing she did it this way to keep it safe and accessible for the viewers.
      A viewer might not be savvy enough to distinguish which parts of the code are safe to execute and which are not.
      That would also explain why she would go through de-obfuscating the first two methods before using them even though they, to me, obviously had no code that could do harm.
      A viewer following the workflow in this video will not get their system infected.

    • @thmo_
      @thmo_ 2 місяці тому +1

      True, also in general the way she did it was very verbose to follow along and replicate with other code, so this will be more helpful to viewers.

  • @canetabisturi
    @canetabisturi 2 місяці тому

    Laurie are you planning on making a video on the xz backdoor? Would love to hear your thoughts!!

  • @rne1223
    @rne1223 2 місяці тому

    Editing is amazing, but the content is off the charts. Amazing work 👏👏👏

  • @Hidamarisketchfan5
    @Hidamarisketchfan5 2 місяці тому

    Interesting video. Whenever I hear about Javascript malware, I'm glad and fortified in my use, of Noscript. Sure, Noscript isn't 100% secure, but it's far better than executing everything that may come with some random website.

  • @DanielRodriguez-ff5cs
    @DanielRodriguez-ff5cs 2 місяці тому

    great video! The corgi app ❤

  • @dungeonman.fromyoutube
    @dungeonman.fromyoutube 2 місяці тому

    Awesome video

  • @RyanEglitis
    @RyanEglitis 3 дні тому

    One interesting piece you skipped over was the use of the split fuction on the string. It was accessed as a property on the string, which let them store the name of the function "split" outside of code as a string. It didn't really do much obsfucating here, but it could do a lot with a more complex object.
    Oh, and !![] and ![] could further deobsfucate to true and false 😅

  • @BlitzkriegHD
    @BlitzkriegHD 2 місяці тому

    Your background / set is a trip dude. Is all that retro gear real or are you using a greenscreen of some sort? If it’s real then you’ve got a really cool collection of… old computer stuff hahah

  • @Taaz2
    @Taaz2 2 місяці тому

    Awesome stuff! May I kindly request any links to the desktop wallpaper you use? I need it haha

  • @pdelong42
    @pdelong42 Місяць тому

    It's been a few decades since I've done anything serious on Windows, so I was frankly surprised to learn that ActiveX is still a thing. We all thought it was a gaping security hole from day one, and I thought Microsoft was at-least disabling it by default now. Glad to see that it's deprecated (according to Wikipedia).

  • @tommyhuffman7499
    @tommyhuffman7499 Місяць тому

    very cool channel!

  • @ancestrall794
    @ancestrall794 Місяць тому

    Really interesting. I wonder if the ActiveXObject function can be used for XSS in pentesting / CTFs

  • @stacksmasherninja7266
    @stacksmasherninja7266 2 місяці тому

    not even sure whether that's an actual linux distro but it looks 10/10

  • @OfficialiGamer
    @OfficialiGamer Місяць тому +1

    I don't deal with programming much (or js) as I'm a hardware guy, but I found this super interesting to watch, and I understood most of it! Keep up the good work pretty lady!

  • @JenByte
    @JenByte Місяць тому +1

    Now I would like to know what the malware that would be downloaded form that server is actually doing when executed.

  • @maelstrom57
    @maelstrom57 2 місяці тому +3

    To rename variables, it's much safer to do it in VSCode using the F2 shortcut. With a string replace, you risk modifying any piece of code (like a string) that happens to contain the variable name without being a reference to it.

    • @climatechangedoesntbargain9140
      @climatechangedoesntbargain9140 2 місяці тому

      just any JS Editor with variable rename functionality

    • @iro4201
      @iro4201 2 місяці тому +1

      I see you are no fan of probability.

    • @maelstrom57
      @maelstrom57 2 місяці тому

      @@iro4201 Nah I ain't a simp for it.

    • @iro4201
      @iro4201 2 місяці тому

      @@maelstrom57 Better simp for speed, than for fear of making a mistake though.

  • @walksinrain
    @walksinrain Місяць тому

    This is some seriously cool stuff. Subscribed :)
    I loved seeing when the camera angle changed, it seems you really do have a bunch of old monitors buzzing away back there haha!

  • @TheSnero3
    @TheSnero3 2 місяці тому

    where do you get all of those wonderful backgrounds?

  • @pulserudeus7968
    @pulserudeus7968 Місяць тому

    love it!

  • @world-9644
    @world-9644 2 місяці тому

    Never thought I’d see a serial experiments lain reference in a coding video.

  • @ceruleanserpent387
    @ceruleanserpent387 18 днів тому

    I love the Copland OS interface

  • @rossquaresmini5834
    @rossquaresmini5834 2 місяці тому +1

    Spettacolo ❤🎉😮

  • @markdempsey1088
    @markdempsey1088 2 місяці тому

    Interesting video.

  • @ewasteredux
    @ewasteredux 2 місяці тому

    Hi @LaurieWired! Dumb question(s) here from a total novice... In your opinion, was the initial obfuscation done via a program/script or was it done by a human? Is there an easy way to tell or is this an educated guess?

  • @astropgn
    @astropgn 2 місяці тому

    Would it be an alternative to obfuscating your malware to use web assembly? I am assuming, since it is a compiled, it would require a lot more effort to reverse engineer it. Yet it would work relatively fine on modern browsers.

  • @Skatche
    @Skatche 2 місяці тому +2

    23:30 Quicker way to do this: just copy and paste the definition of the variable _0x502708 into your console and then console.log the result.

    • @user-jx7cv2td4y
      @user-jx7cv2td4y 2 місяці тому +2

      Also, instead of concatenating strings in a loop, we can just replace activeX calls to console.log, run it and see what commands are executed

  • @glaf1488
    @glaf1488 Місяць тому

    I did this my job 1 or 2 years ago. Javascript is used a everywhere and obfuscated in very horrendous way. For me it was fun and even did some helper to avoid wasting too much time. As you cannot do this automaticaly, you have to do a lot of staff manually, finding the obfuscation fonctions is the most annoying part.

  • @ganeshkale9665
    @ganeshkale9665 2 місяці тому

    Please make videos for securing web applications with best practices that will me most appreciated 😊.

  • @jackgude3969
    @jackgude3969 Місяць тому

    That was the coolest thing ever