Coder Social home page Coder Social logo

DLL Injection checks about al-khaser HOT 2 CLOSED

lordnoteworthy avatar lordnoteworthy commented on August 20, 2024
DLL Injection checks

from al-khaser.

Comments (2)

gsuberland avatar gsuberland commented on August 20, 2024 2

Yes. There are five primary ways to enumerate DLLs that have been loaded into the process:

  • CreateToolHelp32Snapshot with Module32First/Next
  • EnumProcessModules(Ex)
  • Walk the LDR structures manually via the PEB (making sure to get the WOW64 PEB too for 32-bit processes on 64-bit systems)
  • Scan all memory pages with GetModuleHandle (32-bit only, 64-bit would be too slow)
  • Scan all memory pages with VirtualQuery to find executable allocations, then check the start of each allocation for 'MZ' (again 32-bit only for speed reasons).

I'm not sure yet how I can speed up the latter two to make them usable for x64 processes. I'm looking into a few potential ways to enumerate all allocated memory (not just the heaps) in the process but none of it is well documented and I'm mostly having to guess.

Once modules have been identified we can simply look to see if any of them have paths outside the system directory. Validating that they are signed is another potential step but I'd like to avoid it because signing checks are slow and can trigger an outbound network connection for OCSP/CRLs.

Another potential check is to do a compare across these methods to potentially find DLLs that have been loaded into memory but don't appear in the LDR. Furthermore we could try to look for orphaned LDR entries to find modules that have been hidden.

from al-khaser.

gsuberland avatar gsuberland commented on August 20, 2024 1

Work on this has begun in the dll-injection-detection branch.

from al-khaser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.