Git Product home page Git Product logo

Comments (12)

glysbaysb avatar glysbaysb commented on August 22, 2024

Well how does your executable get its arguments?

Is it via GetCommandLineA()/GetCommandLineW()? You can either hook that or replace the saved pointer.
MOV EAX, DS:[some address]
RETN
Starting with Win 7 (IIRC) it's in another DLL so you have to search in kernelbase.dll

Is it via int main(int argc, char** argv)? That is set by your CRT, the one provided by Visual Studio uses msvcrt.dll's __getmainargswhich uses_acmdln` (Both symbols are exported). You can either hook that or replace the saved pointer.

from memorymodule.

hegusung avatar hegusung commented on August 22, 2024

I don't want the solution to be limited to only one executable, I would like it to be working as if I did :
executables.exe -arg1 -arg2

is there a way to do that with MemoryModule ?

I don't know yet which executable I will be using and how it work internally

from memorymodule.

vyrus001 avatar vyrus001 commented on August 22, 2024

i have added support for arguments in a pull request (that has since been accepted) to a fork by another person -> https://github.com/kost/MemoryModule once his changes are included, arguments will work

from memorymodule.

FusixGit avatar FusixGit commented on August 22, 2024

I've partially implemented it in my fork.
https://github.com/FusixGit/MemoryModule
Interception takes place at the stage of import.

from memorymodule.

vyrus001 avatar vyrus001 commented on August 22, 2024

This can be done with MemoryLoadLibraryEx() by setting the *userdata to *argv[]. Both of our patches are not needed. (I recommend this issue be closed)

from memorymodule.

kernel-sanders avatar kernel-sanders commented on August 22, 2024

@vyrus001 Not quite. The exe will still call GetCommandLine which returns whatever args were passed to the program using MemoryModule. In order to pass args to a memory loaded exe you will have to find and replace the GetCommandLine function with a pointer to a string in memory that contains the arguments.

from memorymodule.

noname29 avatar noname29 commented on August 22, 2024

@kernel-sanders any illustration for that ?

from memorymodule.

kernel-sanders avatar kernel-sanders commented on August 22, 2024

It has been done in other projects, see: Invoke-ReflectivePEInjection.ps1#L2058

However, it is likely easier to just use donut.

from memorymodule.

noname29 avatar noname29 commented on August 22, 2024

how to pass arguments to a dll ? @kernel-sanders

from memorymodule.

kernel-sanders avatar kernel-sanders commented on August 22, 2024

It looks like you are attempting to write cryptomining malware. I suggest spending your talents elsewhere.

from memorymodule.

noname29 avatar noname29 commented on August 22, 2024

not really. I am making experiments. @kernel-sanders i work with security

from memorymodule.

n1nj4sec avatar n1nj4sec commented on August 22, 2024

not really

from memorymodule.

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.