Friday, September 14, 2018

Digital Forensics: Malware Forensics > Yara



เดิม Admin ศึกษา The Volatility memory forensics framework พบว่ามีการใช้ คำสั่ง yarascan  จึงเริ่มต่อยอด เพิ่มเติมกับ Yara Rule


การจะเขียน rule ได้  เราต้อง แกะ พฤติกรรมของ malware   ลักษะเฉพาะของมัลแว ตัวนั้นเช่น ข้อความ ,จุดที่เขียนใน registry, การสร้างไฟล์  ,hash มีหลายอย่างประกอบ  นำมาเขียน yara Rule


#Yara –Help

เริ่ม เขียน Yara Rule WildcardExample

 แบ่งเป็น  meta , String , condition  


String
  • Hexadecimal strings, which are useful for defining raw bytes;
  • Text strings;
  • Regular expressions.

  rule Myrule
{
    
    Meta:  
 
         Description = “Test Yara rules”
          Author = “Neo”
 
    strings:
        $s1 = "Hellow World"
         $s2 = "c99.php"  fullword ascii
 
 
    condition:
        1 of ($s)
 
}

.........................................................................................




rule WildcardExample
{
    strings:
       $hex_string = { E2 34 ?? C8 A? FB }

    condition:
       $hex_string
}

.........................................................................................



เริ่ม เขียน Yara Rule Metasploit Meterpreter
        rule My_Meterpreter
{
    
    Meta:  
 
         Description = “Test Yara rules Meterpreter
          Author = “Neo”
 
    strings:
        $s1 = "MACHINE\SYSTEM\CONTROLSET001\SERVICES\WINSOCK2\PARAMETERS\PROTOCOL_CATALOG9"
        $st1 = "MACHINE\SYSTEM\CONTROLSET001\SERVICES\WINSOCK2\PARAMETERS\NAMESPACE_CATALOG5 "
        $su1 = "MACHINE\SYSTEM\CONTROLSET001\CONTROL\NLS\CUSTOMLOCALE"
        $s4 = "MACHINE\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\IMAGE FILE EXECUTION OPTIONS"
 
 
    condition:
        all of ($s*)  or (all of (st*) and of (su*))
 
}


# yara -w -m /root/Desktop/Yara/*.yar /root/Desktop/Dump/winxp.vmem
                                      
           ใช้คำสั่ง yara ตรวจสอบ  ไฟล์ dump memory   ชื่อ winxp.vmem




หมายเหตุ สรุป :  ให้เราเอา staring  จาก IOC  มาใส่ใน Yara rule  เป็นเทคนิคลดเวลาในการสร้าง  Yara rule  อย่างหนึ่ง  อ. ของ admin ได้กล่าวไว้

Indicator of compromise (IOC) — in computer forensics is an artifact observed on a network or in an operating system that with high confidence indicates a computer intrusion. Typical IOCs are virus signatures and IP addresses, MD5 hashes of malware files or URLs or domain names of botnet command and control servers.

 
ดูตัวอย่าง Rule ได้ที่

https://yara.readthedocs.io/en/v3.4.0/writingrules.html
https://www.bsk-consulting.de/loki-free-ioc-scanner/
https://en.wikipedia.org/wiki/Indicator_of_compromise
https://blog.malwarebytes.com/security-world/technology/2017/09/explained-yara-rules/
https://securityintelligence.com/signature-based-detection-with-yara/
https://www.joesandbox.com
https://github.com/Yara-Rules
#Malware Forensics 

หมายเหตุ:เนื้อหาในเว็บไซต์นี้มีขึ้นเพื่อวัตถุประสงค์ในการให้ข้อมูลและเพื่อการศึกษาเท่านั้น


* หากมีข้อมูลข้อผิดพลาดประการใด ขออภัยมา ณ ที่นี้ด้วย  รบกวนแจ้ง Admin เพื่อแก้ไขต่อไป
ขอบคุณครับ

#WindowsForensic #ComputerForensics #dfir #forensics #digitalforensics #computerforensic #investigation #cybercrime #fraud

No comments:

Post a Comment

Digital Forensics:User Access Logging (UAL)

 Digital Forensics:UAL  Log What Is User Access Logging? UAL is a feature included by default in Server editions of Microsoft Windows, start...