Current state of malicious Powershell script blocking

Discussion in 'other anti-virus software' started by itman, Aug 9, 2017.

  1. itman

    itman Registered Member

    Joined:
    Jun 22, 2010
    Posts:
    8,593
    Location:
    U.S.A.
    The AlpineSecurity article used a basic easy to understand example to deploy Empire on the target host. There are much more stealthier ways to do so.
     
  2. WildByDesign

    WildByDesign Registered Member

    Joined:
    Sep 24, 2013
    Posts:
    2,587
    Location:
    Toronto, Canada
    Interesting, I had not thought of this aspect. Particularly for malware copying PowerShell modules in different directories and such. Thanks for the insight! :thumb:
     
  3. Sampei Nihira

    Sampei Nihira Registered Member

    Joined:
    Apr 7, 2013
    Posts:
    3,367
    Location:
    Italy
    Some doubts here too:



    https://www.powershellempire.com/?page_id=273

    @itman

    Read the article below:


    http://www.alex-ionescu.com/?p=97
     
    Last edited: Feb 28, 2018
  4. EASTER

    EASTER Registered Member

    Joined:
    Jul 28, 2007
    Posts:
    11,126
    Location:
    U.S.A. (South)
    Agree. Extremely useful info!

    PowerShell introduced a whole new twist into matters of PC tampers but hats off to diggers who been combing over every single conceivable use and bringing them to light :thumb:
     
  5. itman

    itman Registered Member

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

    http://www.nosuchcon.org/talks/2014/D3_05_Alex_ionescu_Breaking_protected_processes.pdf

    Much easier way that works on Win 10 RS2: https://github.com/Mattiwatti/PPLKiller
     
  6. Peter2150

    Peter2150 Global Moderator

    Joined:
    Sep 20, 2003
    Posts:
    20,590
    Well I did a lot of digging into powershell myself and that research reveal two things to me.

    1. If a powershell script gets on your machine, and is run you probably are owned. Scaryh
    2. In almost all cases the way powershell got on the machine was email mishandled. For me that's good news, as I can control that.
     
  7. Sampei Nihira

    Sampei Nihira Registered Member

    Joined:
    Apr 7, 2013
    Posts:
    3,367
    Location:
    Italy
    @itman

    The one below is stopped by OSA "Main Protection":

    I also think PPLKiller but it would be necessary to ask the Developer.
     
  8. itman

    itman Registered Member

    Joined:
    Jun 22, 2010
    Posts:
    8,593
    Location:
    U.S.A.
    As far as the script shown in the AlpineSecurity article, it is run via an Empire agent; not by any version of Powershell installed on the target's device.
     
  9. itman

    itman Registered Member

    Joined:
    Jun 22, 2010
    Posts:
    8,593
    Location:
    U.S.A.
    PPLKiller uses a kernel mode driver. As such, doubtful it would be detected.
     
  10. Minimalist

    Minimalist Registered Member

    Joined:
    Jan 6, 2014
    Posts:
    14,885
    Location:
    Slovenia, EU
    Yes, that's nice tool. Capturing exes while they're written to HDD is clever approach.
     
  11. Sampei Nihira

    Sampei Nihira Registered Member

    Joined:
    Apr 7, 2013
    Posts:
    3,367
    Location:
    Italy
    @itman

    OSA should stop the installation sequence of PPLKiller.
    But to be sure you need to ask the Developer.

    I'm just a poor fisherman.
    :)
     
  12. Peter2150

    Peter2150 Global Moderator

    Joined:
    Sep 20, 2003
    Posts:
    20,590
    Yes indeed, but it also captures DLL and Sys file the same way. Florian is close to what I would call a genius. Testing a beta that also will capture them on external drives.
     
  13. EASTER

    EASTER Registered Member

    Joined:
    Jul 28, 2007
    Posts:
    11,126
    Location:
    U.S.A. (South)
    Email attempts are 100% inert and DOA on my machines, that's been a long established given.
    ERP Vulnerable Settings is been a sole tie down to prevent errant PS engagements and frankly nothing whatsoever is ever even had a chance to try, except the user, me. And I been cautious as possible when monkeying in an area I really haven't given my ALL yet in examining.

    But as far as i'm concerned it's still a function that is operable at at any rate. I don't have it closed off. Not quite that paranoid.
     
  14. Peter2150

    Peter2150 Global Moderator

    Joined:
    Sep 20, 2003
    Posts:
    20,590
    Yes but corps that have 100 employees have a tough time with Email stuff. I know one company that as solved it with Barracuda. Out of our league but seems effective. Not cheap
     
  15. WildByDesign

    WildByDesign Registered Member

    Joined:
    Sep 24, 2013
    Posts:
    2,587
    Location:
    Toronto, Canada
    Speaking of kernel drivers (PPLKiller), does MZWriteScanner also detect/block when .sys binaries are dropped to disk? I don't recall from my testing which was a while back.
     
  16. guest

    guest Guest

    Sure.
    As long as there is a MZ header, it will be detected (the extension itself doesn't matter)
    I have created a simple file and it looks like this:
    created file_test.sys.png
    While the file was dropped, it was detected by MZWriteScanner:
    Code:
    2018/02/28_17:28    WX    C:\Program Files (x86)\XYplorer\XYcopy.exe    C:\drop\test.sys
    2018/02/28_17:35    WX    C:\Program Files (x86)\XYplorer\XYcopy.exe    C:\drop\test.txt
    
    Edit: To be clear, drivers [.sys binaries] can be "detected" (=they appear in the logfile of MZWriteScanner) because of the MZ Signature (viewing them with a hex edtior is sufficient to see the signature) but not blocked.
    A good solution for blocking of kernel mode drivers would be for example NoVirusThanks Driver Radar Pro (but it has no co-signed driver by Microsoft yet)
    Edit 2: It can block drivers. Blog-entry with some information:
     
    Last edited by a moderator: Mar 8, 2018
  17. WildByDesign

    WildByDesign Registered Member

    Joined:
    Sep 24, 2013
    Posts:
    2,587
    Location:
    Toronto, Canada
    @mood Thank you for confirming (and with all of the great details you are known to provide). You always provide thorough answers and with data to go along with it for good measure. On top of that, you have a great way of explaining things without over-complicating the fact. :thumb:

    Wow, so that is a ridiculous amount of power to have in that case! :eek:

    I need to get off my lazy *** and start playing around with MZWriteScanner again, clearly.
     
  18. Peter2150

    Peter2150 Global Moderator

    Joined:
    Sep 20, 2003
    Posts:
    20,590
    The additional beauty of MZwritescanner is like on my system 3 drives and it will detect even if you move a file from c: to one of the other drives.
     
  19. EASTER

    EASTER Registered Member

    Joined:
    Jul 28, 2007
    Posts:
    11,126
    Location:
    U.S.A. (South)
    Just to rid and clarify of interest any (what's he waiting for and why not add XCubits drivers by now), those are such a unique and foolproof as much as anything might be, I am saving buying those when I buy a brand new machine this year.

    With the security goodies we already have on hand courtesy some razor sharp but rare developers I decided to save the POWER SECURITY programs anew with new machines. My current ones are at a point of so terribly tasked anymore and have been (due to beta testing-my own tinkering) that, well you guys n gals know, you want to apply them to systems you intend to be around for the long term (whatever that may be).

    I absolutely salivate over the ExQubits drivers (having tested them) and with the other usual dependable familiars, I like to start new machines out on a tried and true collection of the best of the best.

    And who knows those types any better then Wilder's group of notorious testers/users. Just clarifying for interest of anyone wondering, that's it. :)
     
  20. Peter2150

    Peter2150 Global Moderator

    Joined:
    Sep 20, 2003
    Posts:
    20,590
    The beauty of the Excubits drivers is there is little to no overhead. They are just drivers, nothing else.
     
  21. shmu26

    shmu26 Registered Member

    Joined:
    Jul 9, 2015
    Posts:
    1,550
    Perhaps I am missing an obvious point, but any decent default/deny setup will block or monitor an unrecognized file that wants to execute. So how does this Empire attack get started? Doesn't it start with an executable file?
     
  22. Peter2150

    Peter2150 Global Moderator

    Joined:
    Sep 20, 2003
    Posts:
    20,590
    Some stuff starts with a script, other with a dropped DLL
     
  23. shmu26

    shmu26 Registered Member

    Joined:
    Jul 9, 2015
    Posts:
    1,550
    And Empire? It doesn't need to execute anything at all on your system?
     
  24. guest

    guest Guest

    I'll do my best :)
    MZWriteScanner isn't a whole defense against all attacks but if dropping of files (with MZ-header) is involved, it is showing its strength.
    In the Empire-example cscript.exe is executing C:\Temp\Katz.js
    But i guess there must be some kind of exploitable vulnerability on the system before Mimikatz or Empire can do its work (or are even loaded).
    (...something must launch "cscript.exe C:\Temp\Katz.js")
     
  25. Peter2150

    Peter2150 Global Moderator

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

    You do absolutely great.


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