Could anti-exe programs prevent applications from executing unknown dlls?

Discussion in 'other anti-malware software' started by Online_Sword, Sep 26, 2015.

Thread Status:
Not open for further replies.
  1. Infected

    Infected Registered Member

    Joined:
    Feb 9, 2015
    Posts:
    1,138
    IDK, I thought it showed the .dll blocked? But maybe not. Just going by what the popup said. I'm not experienced with this. :)
     
  2. Online_Sword

    Online_Sword Registered Member

    Joined:
    Aug 21, 2015
    Posts:
    146
    Em...I do not think so.
    Let's see it. Suppose I have a whitelisted application called "A.exe", it loads a dll called "B.dll" to do something on startup. In particular, B.dll has a function with name DoSomething.
    Then, maybe, a malware writer could write a malicious dll with the same name and providing the same interface (DoSomething). But the body of the function DoSomething in this dll certainly contains some malicious activities.
    Then the malware writer might be able utilize an exploit of "A.exe" to load the bogus dll ("B.dll") and execute the function DoSomething...Wouldn't this be possible?
     
  3. Rmus

    Rmus Exploit Analyst

    Joined:
    Mar 16, 2005
    Posts:
    4,020
    Location:
    California
    AE2 has "Copy" protection. When I extract a file from RAR to disk, I am "Copying" it to disk. In a home situation, this prevents kids from downloading games, etc, without parents permission. It also prevents malware from getting onto disk.

    I disabled Copy Protection and extracted your files to a folder. Now, if I attempt to execute CallDLL.exe, the file is blocked from running ("Open"):

    DLLtest4.jpg

    I disabled AE to see what would happen when I attempted to execute your CallDLL.exe: an error message displayed:

    DLLtest3.jpg


    ----
    rich
     
    Last edited: Sep 27, 2015
  4. Peter2150

    Peter2150 Global Moderator

    Joined:
    Sep 20, 2003
    Posts:
    20,590
    Hi Rich

    Are you still on XP. I tried reinstall AE v2, which I still have. It installed okay, but would run. I am on Win 7x64

    Pete
     
  5. Rmus

    Rmus Exploit Analyst

    Joined:
    Mar 16, 2005
    Posts:
    4,020
    Location:
    California
    Since I cannot run your EXE file, I attempted to access your DLL from a command prompt, and it failed.

    DLLtest6.jpg

    ----
    rich
     
    Last edited: Sep 27, 2015
  6. Rmus

    Rmus Exploit Analyst

    Joined:
    Mar 16, 2005
    Posts:
    4,020
    Location:
    California
    Hi Pete,

    Yes, I'm on WinXP.

    I don't understand your comment. What do you mean "would run?"

    ----
    rich
     
  7. Peter2150

    Peter2150 Global Moderator

    Joined:
    Sep 20, 2003
    Posts:
    20,590
    I can't type. It wouldn't run on Win 7x64.

    Pete
     
  8. Rmus

    Rmus Exploit Analyst

    Joined:
    Mar 16, 2005
    Posts:
    4,020
    Location:
    California
    Have you tried the Mac voice commander?!!

    Yes, that is a shame.
     
  9. Minimalist

    Minimalist Registered Member

    Joined:
    Jan 6, 2014
    Posts:
    14,883
    Location:
    Slovenia, EU
    It won't run on Windows XP. It needs Net framework 4 installed to run. It does run on Windows 7 x86 though.
     
  10. VoodooShield

    VoodooShield Registered Member

    Joined:
    Dec 9, 2011
    Posts:
    5,881
    Location:
    United States
    If this dll is being loaded on startup of the whitelisted, then it should NOT be blocked. But if it is calling the dll through rundll32, then it should be blocked. It really is that simple.

    For example, VS loads 3 or so dll's on startup, as do all of the other security products (I would assume). If you run some of these at the same time, they do not block each other's dll's, correct?

    It all comes down to this... if an application is whitelisted, it should not be restricted in any way. I know some security products do this, but it can cause serious problems when whitelisted apps cannot load the dlls they need, and it increases the number of dangerous affirmative user prompts.

    I know there is a lot of greyware out there now, but ultimately either an application contains malicious code or not. This is somewhat subjective because something that may be malware to me, may not be malware to someone else (to a certain extent). But by whitelisting an application, you are trusting it... trusting it that it does not contain malicious code. And if it is trusted, then it should not be restricted in any way. "Do or do not. There is no try" ;).

    Now, if an application can be exploited to spawn an unknown process... then that is a different story, but that is why everyone should use whitelisting of some kind ;).

    How is the .dll being called? Can someone send me the test file to support@voodooshield.com?
     
    Last edited: Sep 27, 2015
  11. VoodooShield

    VoodooShield Registered Member

    Joined:
    Dec 9, 2011
    Posts:
    5,881
    Location:
    United States
    If the DoSomething function contains malicious code, then A.exe never should have been whitelisted in the first place ;). What comes first, the chicken or the egg?

    If you send me your sample, I can take a look at it.
     
  12. UnrealPc

    UnrealPc Registered Member

    Joined:
    Sep 27, 2015
    Posts:
    5
    +1
    Thanks ;)
     
  13. Peter2150

    Peter2150 Global Moderator

    Joined:
    Sep 20, 2003
    Posts:
    20,590
    Hi Dan

    Thanks for your input. I've always felt I didn't need to worry quite as much about the DLL's in I trusted the app. NVT' ERP handles RUNDLL32 the same way you do , it whitelists specific command line strings and always alerts if there isn't one. In some cases the most important software is what is between the ears.

    Pete
     
  14. Online_Sword

    Online_Sword Registered Member

    Joined:
    Aug 21, 2015
    Posts:
    146
    Sorry, but I think you might misunderstand my opinion.:p
    In my scenario, in the original version of B.dll, DoSomething contains NO malicious code. But a malware writer might create a FAKE B.dll, which contains the same interface (function head) as the original one, but contains malicious codes (function body).
    Then, the malware writer might utilize an exploit to hijack A.exe to execute the fake B.dll, rather than the original one.
    In such case, I am afraid that the malicious codes will be executed. But A.exe is still innocent. So we cannot say that A should be blacklisted.
    And I think one approach to avoid this is to build a DLL whitelist based on the path, the vendor, and the Hash code.

    Gmail does not allow me to send any executable files, so instead, I will PM you a download link.;)
     
  15. Online_Sword

    Online_Sword Registered Member

    Joined:
    Aug 21, 2015
    Posts:
    146
    Hi, @UnrealPc .
    I am unable to PM you...I don't know why...
    Maybe you can try to PM me?
     
  16. VoodooShield

    VoodooShield Registered Member

    Joined:
    Dec 9, 2011
    Posts:
    5,881
    Location:
    United States
    Sure, thank you too Pete! These scenarios are fun to think and talk about... you never know, we might find a bypass this way ;).
     
  17. UnrealPc

    UnrealPc Registered Member

    Joined:
    Sep 27, 2015
    Posts:
    5
    PM doesn't work for me too. I tried since this morning to send you a pm but this function is still unavailable for me.
    I'm a new member here, maybe i must reach a certain number of posts for sending pm.
    I have no idea :confused:
     
  18. itman

    itman Registered Member

    Joined:
    Jun 22, 2010
    Posts:
    8,593
    Location:
    U.S.A.
  19. VoodooShield

    VoodooShield Registered Member

    Joined:
    Dec 9, 2011
    Posts:
    5,881
    Location:
    United States
    Assuming that B.dll could be replaced... the malware writer would not even have to "hijack" A.exe with an exploit... if A.exe calls a certain function in a dll, then all they would have to do would be to run A.exe. The problem is, how do you replace B.dll without running whitelisted code?

    I do agree that whitelisting dll's based on name, path and hash (the way VS already whitelists exe's) would technically be more secure, and now that VS 3.0 is using the mini-filter driver, we have that option. The question is... does implementing such a mechanism actually increase security, and does it outweigh the cost of a potential system performance hit. Besides, it can also cause problems whenever dll's are updated by legitimate software... they would need to be whitelisted again since the hash does not match. And since most computer users have no idea whether to allow the new dll or not, it is better to not prompt them. VS's goal is to safely and automatically allow as much good stuff as possible, that way we do not overburden the user with dangerous user prompts. And since VS toggles to OFF when it is not running a web app, this kind of stuff is auto allowed.

    On the other hand, to a certain extent, I do see your point about a dll or possibly an exe being dropped or replaced... I mean, you can never be too safe, correct ;). So if that is the case, isn't it best to NOT whitelist the entire C Drive (and other drives)... but rather to only whitelist items that are absolutely critical to run the necessary apps? You know, like maybe have a tiny, customized whitelist that only contains 100-150 items, so that it has the absolute smallest attack surface possible? Rather than whitelisting the entire computer (30,000 + items or so) and having a massive attack surface?

    I tried your sample, and yeah, you are loading the dll on app startup. So yeah, CallDll.exe should be initially blocked, but once it is whitelisted, then it should automatically allow HelloDll.dll.
     
  20. VoodooShield

    VoodooShield Registered Member

    Joined:
    Dec 9, 2011
    Posts:
    5,881
    Location:
    United States
    Thank you for the links! I have tried many dll injection techniques and shellcode samples on VS, but I have never been able to bypass it, and I am assuming that a lot of people have tried as well ;). However, if we do find something that will bypass it, we will definitely be implementing dll protection with the new mini filter driver. We have talked about doing this any way... we just need to figure out if it really is an issue first.

    BTW, if you find something that can bypass VS, please let me know!!! I would be really curious what finally got us ;). And of course we will be sure to fix it.
     
  21. Peter2150

    Peter2150 Global Moderator

    Joined:
    Sep 20, 2003
    Posts:
    20,590
    Will for grins I made another run at Faronics current AE. 1st good news. It works with SBIE. Now the rest. On install I told it to scan dll's as well as exe's. The next appropriate thing was to go to lunch. No joke, that scan took longer than forever. Got it up and running and it didn't seem to load things to badly. Oh, I did remove almost all of my other security software besides EIS. Then I noticed in the settings I hadn't ticked monitor DLL's. Didn't dawn on me to put it maintenance mode(learning). Phew. Took two reboots and answering prompts to just get the system up. Did it then load down the system. YEP!!!

    Pete
     
  22. VoodooShield

    VoodooShield Registered Member

    Joined:
    Dec 9, 2011
    Posts:
    5,881
    Location:
    United States
  23. VoodooShield

    VoodooShield Registered Member

    Joined:
    Dec 9, 2011
    Posts:
    5,881
    Location:
    United States
    Interesting... So can you tell if there is a performance hit when the dll monitoring (or whatever it is called in Faronics) is enabled?
     
  24. Peter2150

    Peter2150 Global Moderator

    Joined:
    Sep 20, 2003
    Posts:
    20,590
    Hi Dan

    Oh yes indeed. Heck it takes it almost a minute just to open the whitelist. And yes it's like taking this machine which is a mid level gaming machine and reducing to a pentium III Indeed horrible. Problem is it's trying to monitor close to 25000 items.

    Pete
     
  25. VoodooShield

    VoodooShield Registered Member

    Joined:
    Dec 9, 2011
    Posts:
    5,881
    Location:
    United States
    Wow, that is crazy! I just realized something... I am guessing that if we implement dll protection into VS using our snapshot / toggling stuff, that there would maybe only be around 300 or so dll's on the whitelist, and hopefully it would not impact system performance. We have not tried it yet, but I guess we will find out soon enough ;).
     
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.