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. Peter2150

    Peter2150 Global Moderator

    Joined:
    Sep 20, 2003
    Posts:
    20,590
    Question, and a few comments.

    First the question. Did the Did the DLL actually execute anything or was the text just read by the exe.


    Now for comments. The test isn't really all that valid for the programs tested. As Dan has said, if the exe can't run the DLL is pretty harmless. So for example if the exe isn't whitelisted in ERP, then the DLL couldn't do anything. Likewise if allowed one should be to awful concerned. ERP also neatly solves the Rundll problem.

    As far as appguard is concerned, Appguard would only object if the DLL tried to write to the system areas. Otherwise it won't do anything to stop it. Although not tested EIS's BB would stop any attempt to inject the dll.

    As to Faronics AE, yes it will whitelist DLL's, but and it's a big but, it puts a huge drag on the system, at least it did for me. Also for what it's worth it won't work with SBIE.
     
  2. Infected

    Infected Registered Member

    Joined:
    Feb 9, 2015
    Posts:
    1,138
    Comodo FW v5 picked it up and auto sandboxed it.
     
  3. itman

    itman Registered Member

    Joined:
    Jun 22, 2010
    Posts:
    8,593
    Location:
    U.S.A.
    I have tested this using both conventional disk based and memory based DLL injection. EIS/EAM behavior blocker will stop attempted memory injection attempt from unknown and unsigned source process.
     
  4. Rmus

    Rmus Exploit Analyst

    Joined:
    Mar 16, 2005
    Posts:
    4,020
    Location:
    California
    This is correct. If the system's DLLs are whitelisted, then the Anti-exe program doesn't care what rundll32.exe does, as long as the DLL it calls is whitelisted.

    Some years ago, an exploit was used in MSWord to call a malicious DLL which was renamed with the file extension bkx. If the Anti-exe program reads the code, then the file extension doesn't matter:

    testdocAE2.gif

    (The Anti-exe used here was Faronics AE2.)

    It doesn't matter how the DLL attempts to intrude onto disk, it should be blocked. Below, I simulate a browser i-frame exploit to load a non-whitelisted DLL:

    AE_iframetest.jpg

    The writing to disk of unauthorized executables should be the easiest exploit to prevent.

    Note that the above examples assume an exploit has gotten past my perimeter and attempts to run. At the perimeter, there are these entry points:
    • firewall (eg: Conficker.A exploit via port 445)
    • browser (plug-ins, etc. exploit)
    • email links/attachments (trick to click exploit)
    • USB (executables permitted to run from external media)
    For Wilders personnel, is it likely something can intrude beyond these entry points?

    ----
    rich
     
    Last edited: Sep 28, 2015
  5. aigle

    aigle Registered Member

    Joined:
    Dec 14, 2005
    Posts:
    11,164
    Location:
    UK / Pakistan
    Remus! AE is unique in that it read the executable code and not the file extension. No other anti-executable has this capability. Also they don,t stop dll loading, however they do stop dll injection and copy/ create dll files etch.
     
  6. Rmus

    Rmus Exploit Analyst

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

    Could something be wrong with your test? Is your DLL an Executable File (contains executable code)? SRP will prevent unauthorized DLL loading.

    Six years ago (time flies!) I had a Wilders Member test with SRP my MSWord hmmapi exploit which attempts to load an unauthorized version of the hmmapi.dll:

    srpFr.jpg

    "Error in loading hmmapi.bkx. This program is blocked by a Group Policy."​
    ----
    rich
     
    Last edited: Sep 27, 2015
  7. Online_Sword

    Online_Sword Registered Member

    Joined:
    Aug 21, 2015
    Posts:
    146
    @VoodooShield :Thank you very much for your reply.:) But I still have some problems on this:
    1. Would the only way to hijack a whitelisted application be executing another process to do the hijack? Would it be possible to do the hijacking like this: I open a malicious PDF file, then an exploit in Adobe Reader is then used to load an unknown dll?
    2. If it is really essential to launch a process to do the hijacking, then why many anti-exe programs still prefer to monitor rundll32?:p I mean, if there are some malwares that can hijack rundll32.exe to execute malicious dlls even when an anti-exe program is installed, I guess they could do the same thing to the other whitelisted executable files, right?
     
  8. VoodooShield

    VoodooShield Registered Member

    Joined:
    Dec 9, 2011
    Posts:
    5,881
    Location:
    United States
    I have read several places that whitelisting dll's has a severe impact on system performance. Isn't it more efficient and secure to whitelist the rundll32 command lines, and block all of the non-whitelisted ones? If not, we should consider adding whitelisting of dll's to VS 3.0, now that we have that capability. Thank you!
     
  9. aigle

    aigle Registered Member

    Joined:
    Dec 14, 2005
    Posts:
    11,164
    Location:
    UK / Pakistan
    Yes, Yes. It really flies. BTW I still remember that I also probably tested it against HIPS but i don't have the sample any more.
     
  10. VoodooShield

    VoodooShield Registered Member

    Joined:
    Dec 9, 2011
    Posts:
    5,881
    Location:
    United States
    Not sure what you mean here... specifically "AE is unique in that it read the executable code and not the file extension." I would be curious if you have a minute to elaborate.
     
  11. Online_Sword

    Online_Sword Registered Member

    Joined:
    Aug 21, 2015
    Posts:
    146
    Hi, @Infected . Thank you very much for your test.:)
    Could you introduce some details in your test?
    Particularly, which file is sandboxed by Comodo? The exe or the dll, or both of them?
    Have you already changed to rating of the exe file to "Trusted", while keeping the dll file as "Unrecognized"?
     
  12. Online_Sword

    Online_Sword Registered Member

    Joined:
    Aug 21, 2015
    Posts:
    146
    Hi, @Peter2150 .:) Thank you for your reply.
    Regarding your question, the dll actually needs to execute something. It at least needs to find out the current time. The time with some other contents will be returned to the exe file as a string.
     
  13. VoodooShield

    VoodooShield Registered Member

    Joined:
    Dec 9, 2011
    Posts:
    5,881
    Location:
    United States
    1. I am not sure how to answer the first part, but I will do my best. We can assume that the whitelisted application is safe and does not contain malicious code, so it does not matter if it is theoretically hijacked or not, right? As far as a malicious PDF goes... The whole goal of an exploit is to run the payload, and to do this, it needs to have an executable payload or rundll32 command line to call the dll. I am assuming that all of the security products have these protections.
    2. This is because rundll32 is the "partially whitelisted" executable that calls the dll, so we have to restrict what it does. Rundll32 needs to be whitelisted for certain functions (especially a lot of windows functions), otherwise there would be way too many blocks. But it needs to be restricted... this is a favorite tool of malware writers.
     
  14. Online_Sword

    Online_Sword Registered Member

    Joined:
    Aug 21, 2015
    Posts:
    146
    Hi, @Rmus .
    Thank you for your introduction on Faronics AE2.
    Yes, because it actually needs to execute something, like finding out the current time.
    Would you be interested in the test files?
    I can send them to you if you want, so that you could do some tests with Faronics and SRP at your convenience.:)
     
  15. Online_Sword

    Online_Sword Registered Member

    Joined:
    Aug 21, 2015
    Posts:
    146
    Hi, @VoodooShield . I am sorry but I still cannot understand.:confused: As long as rundll32 could be utilized by malware writers, why the other whitelisted applications would not be utilized by them to execute unknown dlls?
     
  16. Rmus

    Rmus Exploit Analyst

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

    I have read the same thing. I have not experienced any impact on my system performance with Faronics AE2. In an earlier post, Pete mentions this problem with a later version of AE. I tested up through v.3 and didn't experience that problem.
    My only experience is this: years ago when I was looking for anti-exe types of products for home users, one was Process Guard (PG). There was a PG forum here at that time (now archived). One of the many complaints was dealing with rundll32: how to set up rules for it. Because of that, I opted for AE2 which automatically created a whitelist of every executable file on the system. There is nothing more for the user to do. That type of program appealed to me more. So, rundll32 can run, as long as the DLL is whitelisted.

    Whether or not this method would work for your program, I do not know!

    regards,

    - rich
     
  17. VoodooShield

    VoodooShield Registered Member

    Joined:
    Dec 9, 2011
    Posts:
    5,881
    Location:
    United States
    It's cool, I think you are overthinking it ;). A whitelisted app can either load a dll on startup, or it can use rundll32 with a command line to call a dll. If it loads the dll on startup, it does not need to utilize rundll32. However, if it has to make an outside call to rundll32 through a command line, then the command line is blocked, until the command line is whitelisted.
     
  18. Rmus

    Rmus Exploit Analyst

    Joined:
    Mar 16, 2005
    Posts:
    4,020
    Location:
    California
    I received your test files and your DLL is an executable, because I cannot copy it from your folder to disk. Nor can I run your EXE.

    DLLtest.jpg

    DLLtest2.jpg

    I don't have SRP, but based on what I see above, there is no way that DLL is going to load on a system with SRP or any other similar protection.

    ----
    rich
     
  19. VoodooShield

    VoodooShield Registered Member

    Joined:
    Dec 9, 2011
    Posts:
    5,881
    Location:
    United States
    Yeah, I guess what they do is that any whitelisted program can call rundll32, which is pretty much what VS does, but it has taken a little while to get it right ;).

    We can play around with dll monitoring and see it if impacts system performance or not. VS also automatically whitelists the command lines when it is OFF, and we have most of the commonly used command lines hardwired in, so the way we handle it now works pretty well for us.
     
  20. Rmus

    Rmus Exploit Analyst

    Joined:
    Mar 16, 2005
    Posts:
    4,020
    Location:
    California
    I recall you tested against your (rather large!) collection of different security products -- one was GesSwall, I think.

    ----
    rich
     
  21. Online_Sword

    Online_Sword Registered Member

    Joined:
    Aug 21, 2015
    Posts:
    146
    @VoodooShield , thank you for your reply.:)
    So would it be possible for a whitelisted application to be utilized to load a malicious dll on startup?

    @Rmus , thank you for your tests.:thumb:
    I notice that my exe and dll are all blocked with the reason "Copy".
    But in #29, the malicious dll in your example is blocked with the reason "Open".
    Could you introduce the difference between them?

    Furthermore, could you add my exe file (calldll.exe) into the whitelist of Faronics AE2, and then test whether Faronics could block the dll or not in such case?
    I mean, certainly we can block the exe file from running, but could we only block the dll file when the exe file is whitelisted?
     
  22. VoodooShield

    VoodooShield Registered Member

    Joined:
    Dec 9, 2011
    Posts:
    5,881
    Location:
    United States
    Welcome ;). Sorry, I was referring to application startup (not windows startup). I do not see how that would be possible since we can assume it does not contain any malicious code, being that it is a whitelisted application ;). For example, if you have a whitelisted app that all it does is display a message box that says "Hello World", then that is all it will ever be able to do. It is not coded to do anything else.
     
  23. Minimalist

    Minimalist Registered Member

    Joined:
    Jan 6, 2014
    Posts:
    14,883
    Location:
    Slovenia, EU
    Well I've tested it using SRP and also Malware Defender and neither would block dll loading. You can even rename dll to exe and it would still work and wouldn't be blocked by either. Try whitelisting exe with Faronics AE but not dll (if that's possible) and try to run it.
     
  24. Infected

    Infected Registered Member

    Joined:
    Feb 9, 2015
    Posts:
    1,138
  25. Online_Sword

    Online_Sword Registered Member

    Joined:
    Aug 21, 2015
    Posts:
    146
    Thank you for your tests.:thumb:
    But...why SecureAPlus on my virtual machine does not show such a block window?
    Furthermore, as you can see, the string returned by the DLL are still correctly displayed in the console. So I think this means SAP fails in blocking the dll file, right?
     
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.