Hacking a game with DLL injection [Game Hacking 101]

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ม.ค. 2021
  • Implementing a game hacking trainer for Age of Empires by using Dynamic Link Library (DLL) injection. The injected DLL enables the player to toggle the "reveal map" and "no fog" cheat codes on and off by pressing the F6 key.
    DLL injection is a useful technique, used by game hackers and malware authors alike. The DLL injection process enables you to force some process into running your own code. Once the process is running your code, you can do and access anything that the main process can.
    🎮 Game Hacking 101 Playlist ➝ • Game Hacking 101
    👮 Fair use of copyrighted material in the context of Age of Empires (video game); en.wikipedia.org/wiki/File:Ag... / en.wikipedia.org/w/index.php?...
    ⛔ Material presented for offline learning purposes only. No content regarding modern online games or detection bypass techniques will be discussed.
    🏆 The 247CTF channel is dedicated to teaching Capture The Flag fundamentals. If you want to improve your technical skills and succeed in Capture The Flag competitions, make sure to subscribe!
    🏁 The 247CTF is a free Capture The Flag learning environment where you can improve your technical skills by solving challenges and recovering flags. You can join now for free at 247CTF.com/.
    📺 Subscribe for more Capture The Flag videos!
    🏆 Solve CTF Challenges ➝ 247CTF.com/
    🐦Stay up to date ➝ / 247ctf
    🥰 Support the 247CTF ➝ / 247ctf
    💬 Discuss and learn ➝ / discord
    📌Free flag ➝ 247CTF{9719c5ddf317154473d334f47a77ac6a}
    📝 Icons made by Freepik & Monkik from Flaticon.com
    🚨 247CTF’s channel videos are intended for educational purposes only. Methods and techniques discussed are not to be used for illegal activities against unauthorised systems.

ความคิดเห็น • 110

  • @247CTF
    @247CTF  3 ปีที่แล้ว +46

    🤖🤖🤖 Who knew malware authors and game hackers aren't so different after all? 🤖🤖🤖

    • @Kindlylisten3
      @Kindlylisten3 ปีที่แล้ว +5

      Hey, Do you have any plan to give your programming course on YT? It seems you have deep skills of hacking so please share so that we can also learn.

  • @octaviocuatrochio2006
    @octaviocuatrochio2006 ปีที่แล้ว +24

    NOTE: if you're trying to DLL Inject an 32 bit game, compile the code AND the DLL in 32 bit. This will save you A LOT of debugging hours.
    PD: Very nice tutorial! thanks to you i was motivated to pickup a very old project, which extends the functionality of an old but loved game of mine (Burnout Paradise)

  • @bobbymcbobface
    @bobbymcbobface ปีที่แล้ว +1

    Cheers dude! I'm currently writing a mod engine for a game with a friend and because of you i can start learning c++ the way i like (by doing stuff) :D

  • @koenbrink
    @koenbrink 3 ปีที่แล้ว +21

    This is actually one of the best tutorials I have ever seen. Short, clear and perfect pace

    • @247CTF
      @247CTF  3 ปีที่แล้ว

      Thanks!

    • @aidan41
      @aidan41 2 ปีที่แล้ว

      For you to copy and paste LMAO

    • @G242gdkxjfje
      @G242gdkxjfje 3 หลายเดือนก่อน

      all them scriptkiddies​@@aidan41

  • @realNAKAMI
    @realNAKAMI 3 ปีที่แล้ว +3

    feedback: you have an icon for a questionmark and a checkmark. whenever you come up with an idea, you use the checkmark, as if you had already finished the execution of said idea. it would make more sense to introduce a lightbulb or a though bubble icon whenever you talk about a new concept/idea.

    • @247CTF
      @247CTF  3 ปีที่แล้ว +2

      Thanks for the feedback! Now if only I could draw..

  • @kanutaro3426
    @kanutaro3426 ปีที่แล้ว

    Thank you so much I finally understand how byte patching works

  • @SideRocketeer0
    @SideRocketeer0 3 ปีที่แล้ว

    Just wanna say your videos are great they combine two great things and hacking the game is just getting your money's worth.

    • @247CTF
      @247CTF  3 ปีที่แล้ว

      Thanks for the feedback!

  • @brhvitor4
    @brhvitor4 3 ปีที่แล้ว +2

    Nice video! A few criticism that I hope to be constructive: I would point out why you created a thread after the injection. I would say that writing with pointers is cleaner and gives the viewer a better understanding of whats going on but doesn't really matter

    • @247CTF
      @247CTF  3 ปีที่แล้ว +1

      Great point! I'll use pointers moving forward, a few people have made a similar comment.

  • @PROJECTJoza100
    @PROJECTJoza100 ปีที่แล้ว

    Earned a new subscriber. Nice video!

  • @AbacateSexy
    @AbacateSexy 3 ปีที่แล้ว +2

    nice video. Just found out about your channel. You surely deserve more recognition. I hope it comes eventually :)

    • @247CTF
      @247CTF  3 ปีที่แล้ว

      I hope so too!

  • @epicm999
    @epicm999 2 ปีที่แล้ว

    Gonna have to rewatch this video. The info here is too good to pass up.

  • @leanhhao86
    @leanhhao86 3 ปีที่แล้ว +2

    Great tutorial!
    I wonder what machine you used to test the DLL injection, because I'm running into a problem with CreateRemoteThread(). Both my DLL and Injector are 32bit running on Windows 10 and I received Access Denied Error with the function. :((

    • @247CTF
      @247CTF  3 ปีที่แล้ว +3

      The code in the video is 'bad', there is no error checking on the responses from the function calls - you should start there and use GetLastError to try and find the problem. If you have an EDR or similar running on your system, that may be blocking these types of calls too.

  • @dasphantom0439
    @dasphantom0439 3 ปีที่แล้ว +6

    So why do you need to use the WriteProcessMemory and ReadProcessMemory functions? The DLL is running directly in the memory of our game so. Why are we not able to treat the address like a pointer and directly write/read to it?

    • @247CTF
      @247CTF  3 ปีที่แล้ว +2

      Good point! As long as we can write to that memory location we can use more native functions. WriteProcessMemory handles some of the leg work for us automagically if it's not, so for a beginner video this was an easier approach!

    • @dasphantom0439
      @dasphantom0439 3 ปีที่แล้ว

      Thank you for your answer. I really enjoy your videos. Keep up the good work!

    • @247CTF
      @247CTF  3 ปีที่แล้ว

      @@dasphantom0439 Thanks, will do!

  • @Hyperlands
    @Hyperlands 3 ปีที่แล้ว +2

    How do you find out what patches you need to do?
    i.e. at 7:00, where did you get all the data for the memory hacks?

    • @247CTF
      @247CTF  3 ปีที่แล้ว +3

      Take a look at the previous videos in the series for context!

  • @Xanderfied
    @Xanderfied ปีที่แล้ว

    Let's say a game is running in unreal engine, and want to access the debug console. However, after injecting my script, and checking the log Im told console wasnt able to be reenabled due to code not being present. Is the code set by the devs, or is it more of a universal code? Also could you say examine the executable in a hash editor and maybe discover said code? Like it has to be in a mem block at some point right?

    • @247CTF
      @247CTF  3 หลายเดือนก่อน

      Don't know much about Unreal Engine - good luck.

  • @AR-dx6nm
    @AR-dx6nm 2 หลายเดือนก่อน

    Is it possible to do this in an online games like ragnarok online?

  • @aaron6807
    @aaron6807 2 ปีที่แล้ว

    I hope you still read the comments.. At 05:39, why did you use write process memory instead of memcpy or so, the dll is already executing in the game's memory space, so how come?

    • @247CTF
      @247CTF  2 ปีที่แล้ว +1

      No real reason, Windows error codes could be more useful if I handled them. I use memcpy in a different video and someone asked in the comments if I could also use WPM, so I did that in this video instead.

    • @aaron6807
      @aaron6807 2 ปีที่แล้ว

      @@247CTFyeah fair. Thanks a bunch for clarifying it

  • @realNAKAMI
    @realNAKAMI 3 ปีที่แล้ว

    feedback: whenever you talk about states or a procedure, i state machine graph would look even cooler.

    • @247CTF
      @247CTF  3 ปีที่แล้ว

      Thanks for the feedback! Do you have a timestamp for an example?

    • @realNAKAMI
      @realNAKAMI 3 ปีที่แล้ว

      @@247CTF 7:54 sure, it's just three simple steps, but it feels like you're going into more complex examples in the future with these "our program will do this/that" explanations.

  • @AHN1444
    @AHN1444 ปีที่แล้ว +1

    I compiled a test dll with visual studio 2022, and the exe is crashing with 0xc000007b error on start, what I am doing wrong?

    • @247CTF
      @247CTF  ปีที่แล้ว

      "The error code means an invalid image format. Specifically, you are attempting to start an application which is designed to run on 64-bit operating system. But your computer is running 32-bit Windows."

  • @djay10101
    @djay10101 8 หลายเดือนก่อน +2

    How do you locate the address of the patch without knowing it in the first place? And how do you know what values to overwrite it with to achieve the function you want?

    • @DatBoi_TheGudBIAS
      @DatBoi_TheGudBIAS 4 หลายเดือนก่อน +1

      This is where the previous part comes in. Before U inject a dll, u should use cheat engine to make a script. With Dat script, u can then see the bytes of the new opcodes and the adress changed, and there's ur answer

    • @247CTF
      @247CTF  3 หลายเดือนก่อน +1

      That's right - there is a playlist for the series, if you watch it in order the current video (usually) builds on the previous one.

  • @mrvb6408
    @mrvb6408 3 ปีที่แล้ว +2

    Nice stuff, but you don't actually need to read the original game bytes to toggle the trainer on/off... use the power of XOR :P

    • @247CTF
      @247CTF  3 ปีที่แล้ว

      Awesome tip! This is a good improvement to the trainer for sure! Will implement this in the next video!

  • @tacillo
    @tacillo ปีที่แล้ว +4

    instead of using hardcoded patch size you could utilize vectors which automatically resize themself to match the contents required space :)
    (and why not use an unsigned long long (uintptr_t) for the patch address? It wont be negative and can get really big if you have a lot of RAM available)
    Edit: The amount of ram doesnt really matter, its because of the userland virtual address range

    • @247CTF
      @247CTF  ปีที่แล้ว

      TIL, thanks!

    • @muhammadziyad3648
      @muhammadziyad3648 11 หลายเดือนก่อน

      hey can anyone help me hack state of survival game its only p2p and its server sided or if anyone knows how to cheat in sos or inject using tools

    • @tacillo
      @tacillo 10 หลายเดือนก่อน

      @@muhammadziyad3648 if the game is fully server sided than there highly likely won't be a lot of useful stuff you can do from the client side. Would recommend to take a look at package modifying or in case you just want to cheat in that one specific game without actually caring about learning that type of stuff, let it be.

    • @muhammadziyad3648
      @muhammadziyad3648 10 หลายเดือนก่อน

      can you guide me about package modifying cause i want to hack a specific server sided game @@tacillo

  • @SEX_ON_DRUGS
    @SEX_ON_DRUGS 3 ปีที่แล้ว +2

    Great video!

    • @247CTF
      @247CTF  3 ปีที่แล้ว

      Thanks!

  • @leon_black
    @leon_black ปีที่แล้ว

    hey I wanna inject a modded directX dll into a game to force it to run on a lower feature level GPU..
    How can I force the game to use it rather than the one in sys32
    Is injection the solution? because your injector ran after the game opens
    But the game in my case doesn't open because it detects a lower FL

    • @247CTF
      @247CTF  ปีที่แล้ว

      It depends a bit on the application.. You might need to binary patch, might not: learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order
      You could also try a loader like DxWnd

  • @aozzz6936
    @aozzz6936 8 วันที่ผ่านมา

    I though windows will always give you random memory addresses, but you apply patching to the same address all the time. I don't get it.

  • @ahmedgames9335
    @ahmedgames9335 5 หลายเดือนก่อน

    can i deal with mono.dll like you used the LoadLibraryA and run it in thread inside the target process but i will use for ex mono_get_root_domain ???

    • @247CTF
      @247CTF  3 หลายเดือนก่อน

      You want to do this with .NET? You can achieve a similar effect but the process is slightly different, there are some examples on GitHub you could check out. The bonus is .NET makes the reversing step easier (usually).

  • @DukeNuGets
    @DukeNuGets หลายเดือนก่อน

    Nice tutorial !. It's possible to inject a .Net Framework DLL ?. Thx

  • @darkfllame
    @darkfllame 9 หลายเดือนก่อน +12

    i watch dll injection tutorial for "educational" purpose 😏

    • @schittPosts101
      @schittPosts101 7 หลายเดือนก่อน

      Script kiddie

    • @darkfllame
      @darkfllame 7 หลายเดือนก่อน +1

      @@schittPosts101 no worry kid, i got the *C programming language👍👌* directly into my brain, with a lot of cafeine lol

    • @schittPosts101
      @schittPosts101 7 หลายเดือนก่อน +1

      @@darkfllame LMK when you go straight to the diet coke to finish by deadline xD

    • @darkfllame
      @darkfllame 7 หลายเดือนก่อน +1

      @@schittPosts101 okay xd, i'm making a programming language with zig and don't really have a deadline so anyway

    • @Kronos.Saturn
      @Kronos.Saturn 6 หลายเดือนก่อน

      @@darkfllame i code in pure binary im better then you

  • @maciejszpyra
    @maciejszpyra 3 ปีที่แล้ว

    Is it always possible to inject DLL into a process?

    • @247CTF
      @247CTF  3 ปีที่แล้ว +2

      I would expect most modern games would either prevent or detect this naive injection approach. There are methods to block direct DLL injection, but if you can install kernel drivers you could still achieve the same effect! We can explore this in a future video!

  • @jamesking2439
    @jamesking2439 ปีที่แล้ว

    Also your inner loop for testing is way faster this way.

    • @247CTF
      @247CTF  ปีที่แล้ว

      🥷

    • @muhammadziyad3648
      @muhammadziyad3648 11 หลายเดือนก่อน

      hey can anyone help me hack state of survival game its only p2p and its server sided or if anyone knows how to cheat in sos or inject using tools

  • @aatupontio8118
    @aatupontio8118 10 หลายเดือนก่อน

    whats the differnce how dll injector and lua injector work

    • @247CTF
      @247CTF  3 หลายเดือนก่อน

      Don't know much about lua injectors, I would guess it's injecting lua script instead of compiled code?

  • @starwinner4982
    @starwinner4982 ปีที่แล้ว +1

    Hey, nice video, I am a total noob with C++, in the Injector.cpp file, on line 28, what is the full line? I tried to figure out that myself but I had no success. Do you mind helping? :D

    • @247CTF
      @247CTF  ปีที่แล้ว

      Code is in Patreon

  • @tylermoore9908
    @tylermoore9908 ปีที่แล้ว

    Hey yall remember if your directory uses '\'. just make it a raw string like : R"(your string here)";

  • @heatseeker3654
    @heatseeker3654 9 หลายเดือนก่อน

    Can this be done for Age of Empires II: The Conquerors?

    • @247CTF
      @247CTF  3 หลายเดือนก่อน +1

      Probably something similar, I've never looked..

    • @heatseeker3654
      @heatseeker3654 3 หลายเดือนก่อน

      @@247CTF I have already tested time ago and it works.

  • @sieutruc
    @sieutruc 3 ปีที่แล้ว

    Thank for the video, but can you share your code ? i tried to do but do not understand why it does not work. iam on win10 x64.

    • @247CTF
      @247CTF  3 ปีที่แล้ว +2

      5:48

    • @sieutruc
      @sieutruc 3 ปีที่แล้ว

      Thanks for your information and useful video.

  • @quochungftu
    @quochungftu 3 ปีที่แล้ว

    Does anyone have an edited dll file which I can toggle in-game while playing?

    • @247CTF
      @247CTF  3 ปีที่แล้ว

      When you say toggle, do you mean toggle functionality on/off or toggle the DLL being injected/not injected?

    • @phamquochung4908
      @phamquochung4908 3 ปีที่แล้ว

      @@247CTF functionality I meant. I found some dll injector tools more useful than the one I built but it causes heavy lag in-game, may be the dll file doesnt work well in win 10

    • @247CTF
      @247CTF  3 ปีที่แล้ว

      @@phamquochung4908 Sleep might help you out, depending on what you are trying to do. Failing that, the next video in the game hacking series will include functionality toggles so you can see how that works!

  • @tr1ngle
    @tr1ngle 2 ปีที่แล้ว +1

    2:53 i cant see full line of code for hProcess :skull:

    • @247CTF
      @247CTF  2 ปีที่แล้ว

      💀

    • @tr1ngle
      @tr1ngle 2 ปีที่แล้ว

      💀

    • @brodienelson7493
      @brodienelson7493 2 ปีที่แล้ว

      @@tr1ngle Be a patrion and get it all there. do yall not listen XD

  • @realNAKAMI
    @realNAKAMI 3 ปีที่แล้ว +2

    feedback: i find the music a tiny bit too distracting. maybe lowering it like 30% would help. but maybe that's just me.

    • @247CTF
      @247CTF  3 ปีที่แล้ว +1

      Thanks for the feedback! Will lower the background sound in the next video!

  • @nvdbk70
    @nvdbk70 2 ปีที่แล้ว +1

    do you give me code in video ?

    • @247CTF
      @247CTF  2 ปีที่แล้ว

      It's available for Patreon supporters, but all the code is shown on screen

    • @TibiaOTarena
      @TibiaOTarena 2 ปีที่แล้ว +1

      @@247CTF no not "ALL the code" since you cut out hProcess..

    • @brodienelson7493
      @brodienelson7493 2 ปีที่แล้ว

      @@TibiaOTarena Lmao

  • @funy7657
    @funy7657 ปีที่แล้ว

    Can you share for me code?

    • @tacillo
      @tacillo ปีที่แล้ว +2

      you can find the code in his patreon

    • @247CTF
      @247CTF  ปีที่แล้ว

      🙏

  • @abbybamatos7285
    @abbybamatos7285 3 ปีที่แล้ว +2

    Really nice 👌 😍💋 💝💖❤️

    • @taclabs7967
      @taclabs7967 3 ปีที่แล้ว +1

      Typical Gamehacker

  • @declanrussoj3736
    @declanrussoj3736 3 ปีที่แล้ว

    Good. I wait for love from you 💝💖

    • @dasphantom0439
      @dasphantom0439 3 ปีที่แล้ว

      @Wanna Chill Yeah, but that are they phishing for? Just views? They all have the same playlists with the same league of legends gameplay videos with sex thumbnails.

  • @DcsMaster
    @DcsMaster 2 ปีที่แล้ว

    Can I hack fortnite vbucks?? Pls answer

    • @247CTF
      @247CTF  2 ปีที่แล้ว

      Possibly?

    • @SkyenNovaA
      @SkyenNovaA 2 ปีที่แล้ว +6

      Probably not.
      Because they're stored on a server, the way the program works in this video is editing your local machine's memory

    • @lilpup1414
      @lilpup1414 2 ปีที่แล้ว

      @@SkyenNovaA Send a request to the server. That might work