question

HariPranesh-7059 avatar image
0 Votes"
HariPranesh-7059 asked RLWA32-6355 edited

how to prevent other .exe to call my .exe

Hi Basically this question is for safety purpose. I have my own application(.exe files) stored in a folder.

I want to prevent the calling of my .exe files by third party applications.

Example: I have three application(.exe files) I want to open all the three application only by myself (i.e the opening right of those exe should be my own .exe alone) no third party application should open it.

is that possible to do so?

Let me give my attempt details, I used signature check of the parent process, it achieved but the drawback is when the parent is terminated the pid is also terminated or reused so at that time we cant able to find the signature.

Note: all the calling process acts as a thread so parent is needed to get the signature.

windows-apic++
· 11
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Why do you permanently need the parent's signature? Maybe it is enough to check it at startup, when the parent exists.


0 Votes 0 ·

I am calling my child process as a thread, after calling the thread suddenly the parent is terminated. so before the child process check for the parent details the parent is terminated and the PID used to get the path and signature is terminated.

0 Votes 0 ·
Viorel-1 avatar image Viorel-1 HariPranesh-7059 ·

How are you calling the child process as a thread?


0 Votes 0 ·
Show more comments
RLWA32-6355 avatar image RLWA32-6355 HariPranesh-7059 ·

Is the launching process (I e., the parent) simply exiting normally immediately after starting the child process?

0 Votes 0 ·
Show more comments

Hi, Hari!
I think it's safer to use digital signature. Have you tried SingTool?
Do you want your EXE to be opened only by double-clicking?
View the parent process, explorer will also access your exe.


0 Votes 0 ·


Do you want your EXE to be opened only by double-clicking?

No, With double clicking it wont open because of digital signature check in main function, so the only way to open is to call the process through other exe having valid signature of mine. otherwise it wont open.

In that approach only I'm getting struck....!

0 Votes 0 ·

1 Answer

GuidoFranzke avatar image
1 Vote"
GuidoFranzke answered RLWA32-6355 commented

Hello,
you cannot prevent other apps to start your exe files.

Since your exes are called within your self-written apps, you could use the paramter list and provide a special "startup-key" (just a parameter string which no-one knows, e.g. "myexe.exe -l2kfeii2fncx84mxa4"). If this is not present when starting main, then you can exit your exe programmatically.
Here's how to use the parameter list of main:
pass-arguments-into-c-program-from-command-line
For WinMain, MFC apps etc there are special operations to get the values in the parameter list.
Regards, Guido

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Guido, that was an fantastic idea, but in case if a local social engineer knows the "startup-key" he can leak the key and anyone can able to access it when it becomes as a product right ?

But a digital signature check is common, if the signature belongs to me I allow the exe to open or else not.

That's what I'm searching.

Ok I would like to ask can we able to find the parent of the process even after the parent is terminated, so that we can use the signature check as common.

0 Votes 0 ·

I would like to ask can we able to find the parent of the process even after the parent is terminated, so that we can use the signature check as common

When the parent process is terminated, all child processes will terminate too. Accordingly, the parent process is always running when the child process is running.
Here are examples how to get the parent process:
method-for-win32-programs-to-get-the-id-of-the-parent-process.html
Get-Parent-Process-PID

Regards, Guido


0 Votes 0 ·

If the parent process is terminated, all child processes will terminate too. Accordingly, the parent process is always running when the child process is running

That would be the case if a properly configured Job Object was being used. Otherwise, the lifespan of parent and child processes are independent.



1 Vote 1 ·