haow do i sandbox
play

Haow do I sandbox?!?! Cuckoo Sandbox Internals Jurriaan Bremer - PowerPoint PPT Presentation

Haow do I sandbox?!?! Cuckoo Sandbox Internals Jurriaan Bremer @skier t Student (University of Amsterdam), Freelance Security Researcher June 22, 2013 June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 1 /


  1. Haow do I sandbox?!?! Cuckoo Sandbox Internals Jurriaan Bremer @skier t Student (University of Amsterdam), Freelance Security Researcher June 22, 2013 June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 1 / 79

  2. Introduction - Cuckoo Sandbox Team Figure : Mark Schloesser, Claudio Guarnieri, Me, Alessandro Tanasi June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 2 / 79

  3. Introduction - What this talk is NOT about! Figure : Dragon Sandbox! June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 3 / 79

  4. Introduction - What this talk is about! ◮ How we built Cuckoo ◮ How to evade Cuckoo ◮ Left as an exercise for the attendee ◮ Who would do such terrible thing though? June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 4 / 79

  5. Introduction - Todays problems in Malware ◮ . . . Insert long list of problems . . . ◮ In the end, we prefer to blame.. June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 5 / 79

  6. Introduction - Todays problems in Malware June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 6 / 79

  7. Introduction - Todays problems in Malware Analysis ◮ Static Analysis takes a lot of time ◮ Obfuscation ◮ Packers ◮ Dynamic Analysis also takes a lot of time ◮ Multi-threaded malware ◮ Anti-debugger, anti-virtual machine, etc. June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 7 / 79

  8. Introduction - Sandboxing in General (1) ◮ Enter Sandboxes ◮ Automated Malware Analysis - handles all repetitive work ◮ Process thousands of samples in a reasonable time ◮ Generic methods for bypassing anti’s ◮ For the Client ◮ User friendly - anyone can use it ◮ Setup once, use it for eternity ◮ For this step, see the manual :p June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 8 / 79

  9. Introduction - Sandboxing in General (2) ◮ Existing Solutions ◮ Closed Source ◮ Not 100% customizable ◮ Very expensive ◮ Enter Cuckoo Sandbox ◮ Entirely Open Source ◮ Free to use June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 9 / 79

  10. Introduction - Disadvantages of Sandboxing ◮ Environment could be detected ◮ Anti-sandbox ◮ Randomize environment ◮ Can only randomize so many things ◮ Various limitations depending on the implementation ◮ We try our best to bypass these ◮ E.g., Hook Detection by Malware ◮ Reports still have to be read by somebody June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 10 / 79

  11. Cuckoo Sandbox Architecture June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 11 / 79

  12. Demonstration of analyzing a PDF exploit ◮ Demo showing the entire analysis process ◮ Quick look through the report June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 12 / 79

  13. Cuckoo Sandbox Internals June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 13 / 79

  14. Inside the Virtual Machine - Agent ◮ Listening Agent ◮ Accepts a connection ◮ Host connects ◮ Host sends zip file ◮ Agent unpacks zip file ◮ Python code ◮ Easily upgrade Cuckoo to a new version! ◮ Configuration files ◮ The sample ◮ Agent runs the Analyzer ◮ Which has been sent through the zip June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 14 / 79

  15. Inside the Virtual Machine - Analyzer ◮ Analyzer ◮ Initializes Cuckoo stuff ◮ Open IPC Channel (Named Pipe) ◮ Some handwaving etc ◮ Dumps Configuration for the first Process ◮ Name of the Named Pipe ◮ IP and Port of the Result Server ◮ (Will come back to that later) ◮ Runs the specified Package June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 15 / 79

  16. Inside the Virtual Machine - Packages ◮ Package starts an application with commandline parameters ◮ Wrappers around CreateProcess(CREATE SUSPENDED) ◮ Packages for EXE, DLL, PDF, DOC, etc. ◮ Inject Cuckoo Monitor DLL into the process ◮ Using APC, QueueUserAPC(...) ◮ Resume main thread of the process June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 16 / 79

  17. Inside the Application - Cuckoo Monitor ◮ When resuming the main thread ◮ Cuckoo Monitor is executed first ◮ Due to the APC callback ◮ Initializes internals & installs API Hooks ◮ Notifies the Analyzer ◮ Through Named Pipes ◮ Real application is started June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 17 / 79

  18. Outside the Virtual Machine - Result Server ◮ Cuckoo Monitor logs directly to the Host, over TCP/IP ◮ IP and Port retrieved from the Configuration ◮ More stability than before, when we logged to a local file ◮ VM Crashes resulted in no logs ◮ Now real-time results June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 18 / 79

  19. So, what now? ◮ We’ve covered the basics ◮ Useful for single-process stuff ◮ What’s next? June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 19 / 79

  20. More Advanced Malware (1) ◮ Some samples run new processes ◮ RunPE, for Packers ◮ Internet ExploderˆWExplorer for URLs ◮ Some malware injects into other processes ◮ Explorer.exe Injection to evade Firewalls ◮ Banking Trojans June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 20 / 79

  21. Child Process Injection Before the new Process is executed, we want to inject Cuckoo Monitor. ◮ Cuckoo Monitor notifies Analyzer ◮ Asks to be injected into the target process ◮ Analyzer dumps configuration file ◮ Injection using APC June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 21 / 79

  22. Child Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 22 / 79

  23. Child Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 23 / 79

  24. Child Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 24 / 79

  25. Child Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 25 / 79

  26. Child Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 26 / 79

  27. Child Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 27 / 79

  28. Child Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 28 / 79

  29. Child Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 29 / 79

  30. Child Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 30 / 79

  31. Process Injection Before a sample injects and executes code into another process, we also want to inject Cuckoo Monitor. Process Injection is similar to Child Injection, except for a few steps. ◮ No APC, but CreateRemoteThread(...) ◮ Can’t guarantee APC finishes in time ◮ Entirely inject Cuckoo Monitor before resuming execution ◮ For Child Processes June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 31 / 79

  32. Process Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 32 / 79

  33. Process Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 33 / 79

  34. Process Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 34 / 79

  35. Process Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 35 / 79

  36. Process Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 36 / 79

  37. Process Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 37 / 79

  38. Process Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 38 / 79

  39. Process Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 39 / 79

  40. Process Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 40 / 79

  41. Process Injection June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 41 / 79

  42. That said.. Figure : What the malware thinks it’s doing. June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 42 / 79

  43. That said.. Figure : What Cuckoo Sandbox thinks it’s doing. June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 43 / 79

  44. That said.. Figure : What really happens. June 22, 2013 Jurriaan Bremer @skier t Haow do I sandbox?!?! Cuckoo Sandbox Internals 44 / 79

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend