How to Evade Detection: Hiding in the Registry

Discussion in 'other security issues & news' started by guest, Apr 9, 2019.

  1. guest

    guest Guest

    How to Evade Detection: Hiding in the Registry
    April 7, 2019
    https://www.tripwire.com/state-of-security/mitre-framework/evade-detection-hiding-registry/
     
  2. guest

    guest Guest

    Nothing new here.
     
  3. Rasheed187

    Rasheed187 Registered Member

    Joined:
    Jul 10, 2004
    Posts:
    17,559
    Location:
    The Netherlands
    But the thing is, even if it hides in the registry, it still can't run when it's blocked by AE/whitelisting, correct?
     
  4. itman

    itman Registered Member

    Joined:
    Jun 22, 2010
    Posts:
    8,593
    Location:
    U.S.A.
    In regards to this:
    I wouldn't trust whatever you are using unless you tested it yourself. I instead use a HIPS rule to monitor any write activity to this and like reg. keys and startup directories.
     
  5. Rasheed187

    Rasheed187 Registered Member

    Joined:
    Jul 10, 2004
    Posts:
    17,559
    Location:
    The Netherlands
    My point is that they make a lot of fuzz about malware hiding in the registry, but malware still needs to execute to end up in memory. In other words, anti-exe will also block this.
     
  6. itman

    itman Registered Member

    Joined:
    Jun 22, 2010
    Posts:
    8,593
    Location:
    U.S.A.
    Unless malware performed memory injection, hollow processing, etc. and modified the registry via API usage: https://docs.microsoft.com/en-us/windows/desktop/sysinfo/registry
     
  7. Rasheed187

    Rasheed187 Registered Member

    Joined:
    Jul 10, 2004
    Posts:
    17,559
    Location:
    The Netherlands
    Would need a bit more info on this, to understand how such an attack would work. The thing is, in order to hide in the registry, malware must still first be able to run. Only then they can modify the registry.
     
  8. itman

    itman Registered Member

    Joined:
    Jun 22, 2010
    Posts:
    8,593
    Location:
    U.S.A.
    Here's the reference to all associated registry API's. Note that they can also be used via the listed shell functions: https://docs.microsoft.com/en-us/windows/desktop/sysinfo/registry-functions. Bottom line is that the registry can be modified programmatically as well as directly via apps like reg.exe.
     
  9. Rasheed187

    Rasheed187 Registered Member

    Joined:
    Jul 10, 2004
    Posts:
    17,559
    Location:
    The Netherlands
    To clarify, I wonder how such an attack would look like. So you run malware, it modifies the registry in a sneaky way, so now it will start even after reboot, if AV didn't detect it. But it still needs to run as a process, and malicious behavior should be detected by behavior blocker. Perhaps you can look for malware that uses this technique.
     
  10. itman

    itman Registered Member

    Joined:
    Jun 22, 2010
    Posts:
    8,593
    Location:
    U.S.A.
    Take a look at the use of "debugger" in ref. to the registry. It allows another program to load as an alias of a legit program.
     
  11. Cutting_Edgetech

    Cutting_Edgetech Registered Member

    Joined:
    Mar 30, 2006
    Posts:
    5,694
    Location:
    USA
    AppGuard blocks writes to most abused areas of the registry. I have tested it, and it works.
     
  12. itman

    itman Registered Member

    Joined:
    Jun 22, 2010
    Posts:
    8,593
    Location:
    U.S.A.
    One of my favorite registry hiding malware persistence mechanisms is shells and their extensions. Here is a good article that is a bit dated but still applicable in regards to just how difficult it an be to detect some shell based malware: https://oalabs.openanalysis.net/201...e-hkey_current_user-shell-extension-handlers/ . I believe the issue mentioned in regards to Autoruns use in detection still exists. Every guide I have read recently on proper use of it warns that registry key data pertaining to shells must be fully enumerated to detect this kind of malware.
     
  13. Rasheed187

    Rasheed187 Registered Member

    Joined:
    Jul 10, 2004
    Posts:
    17,559
    Location:
    The Netherlands
    I forgot about that malware can also register DLL files in registry, but they should still always run as a separate process, no? Or can malware run as a single DLL file? This has never been clear to me.
     
  14. itman

    itman Registered Member

    Joined:
    Jun 22, 2010
    Posts:
    8,593
    Location:
    U.S.A.
    /
    Poweliks is one of the better examples of this: https://blog.trendmicro.com/trendla...e/poweliks-malware-hides-in-windows-registry/

    -EDIT- Also, this one is interesting:
    https://www.microsoft.com/security/blog/2018/01/24/now-you-see-me-exposing-fileless-malware/

    Whereas reflective .dll loading to inject into another processes memory is fairly well known and documented, reflective PE loading to do the same is not.
     
    Last edited: May 5, 2019
  15. ParadigmShift

    ParadigmShift Registered Member

    Joined:
    Aug 7, 2008
    Posts:
    241
    .HTA .PUB .JS .PS1 .WSF .VBS powershell.exe
     
  16. itman

    itman Registered Member

    Joined:
    Jun 22, 2010
    Posts:
    8,593
    Location:
    U.S.A.
    Another registry .dll sample is KHRAT. Note that the .dll file actually uses the .dat extension:
    https://unit42.paloaltonetworks.com/unit42-updated-khrat-malware-used-in-cambodia-attacks/
     
  17. bellgamin

    bellgamin Registered Member

    Joined:
    Aug 1, 2002
    Posts:
    8,102
    Location:
    Hawaii
    It's new to me. @mood & @itman -- 10Q to the nth!
     
  18. itman

    itman Registered Member

    Joined:
    Jun 22, 2010
    Posts:
    8,593
    Location:
    U.S.A.
    Here's another one. Override existing RDP use restrictions:
    https://0x00sec.org/t/anti-forensic-and-file-less-malware/10008
     
  19. Rasheed187

    Rasheed187 Registered Member

    Joined:
    Jul 10, 2004
    Posts:
    17,559
    Location:
    The Netherlands
  20. itman

    itman Registered Member

    Joined:
    Jun 22, 2010
    Posts:
    8,593
    Location:
    U.S.A.
    No. The KHRAT example I posted ran SysWOW64.com from the registry.
     
  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.