본문 바로가기
OffSec

[Blue Teams Academy] 모듈 16 - Yara 규칙을 사용하여 멀웨어를 탐지하는 방법

by 10th doctrine 2021. 3. 19.
728x90

악성 프로그램 분석을 수행할 때 분석가는 악성 소프트웨어를 식별하는 데 사용할 수 있는 모든 정보를 수집해야 한다. 그 기술 중 하나는 야라 규칙이다. 이 기사에서는 야라 규칙과 악성코드를 탐지하기 위한 사용 방법을 살펴보려고 한다.

기사 개요는 다음과 같다.

  • 멀웨어 분석이란?
  • 정적 멀웨어 분석 기법
  • 야라란 무엇이며 설치하는 방법
  • Yara를 사용하여 악성 프로그램 탐지
  • 야라 규칙 구조
  • 첫 야라 규칙 쓰는 법
  • 야라피톤

이 문서를 읽은 후 다른 유용한 리소스를 포함하는 이 작은 문서를 다운로드하십시오. 야라 규칙 리소스

멀웨어 분석

악성코드는 복잡하고 악의적인 소프트웨어다.그것의 행동은 컴퓨터 시스템의 단순한 수정과 같은 기본적인 행동에서부터 고급 행동 패턴에 이르기까지 다양하다.

정의에 따르면 악성코드는 데이터 및 신원 도용, 스파이웨어, 합법적인 사용자 감염 및 개발자에 대한 전체 또는 제한적인 제어권 획득과 같은 컴퓨터 시스템을 손상시키는 것을 목적으로 하는 악성 소프트웨어다.멀웨어 분석을 명확히 이해하려면 동작에 따른 멀웨어 분류가 필수다. 멀웨어는 여러 가지 기능을 사용하기 때문에 분류할 수 없는 경우도 있지만 일반적으로 멀웨어 중 일부는 다음과 같이 많은 범주로 나눌 수 있다.

  • 트로이 목마: 합법적인 응용 프로그램으로 표시되는 멀웨어
  • 바이러스: 이 유형의 악성 프로그램 자체가 복사되어 컴퓨터 시스템에 감염됨
  • 봇넷트는 일반적으로 C2C(명령 및 제어) 채널에 의해 제어되는 손상된 시스템의 네트워크다.
  • 랜섬웨어 이 악성코드는 컴퓨터에 있는 모든 데이터를 암호화한 뒤 피해자에게 주로 가상화폐 비트코인을 이용해 암호 해독 키를 받아오라고 한다.
  • 이름에서 분명히 알 수 있듯이 스파이웨어는 검색 기록, 설치된 응용프로그램을 포함한 모든 사용자 활동을 추적하는 악성 프로그램
  • 루트킷은 공격자가 시스템에 대한 일반적인 관리 권한을 무단으로 얻을 수 있도록 한다.기본적으로 눈에 띄지 않고 최대한 철거를 어렵게 한다.

멀웨어 분석은 바이러스, 웜, 트로이 목마, 루트킷 또는 백도어와 같은 특정 멀웨어 샘플의 기능, 출처 및 잠재적 영향을 결정하는 기술이다. 악성 소프트웨어 분석가로서 우리의 주된 역할은 악성 소프트웨어에 대한 모든 정보를 수집하고 감염된 기계에 무슨 일이 일어났는지 잘 이해하는 것이다. 다른 프로세스와 마찬가지로 악성 프로그램 분석을 수행하려면 일반적으로 특정 방법론과 여러 단계를 따라야 한다. 멀웨어 분석을 수행하려면 다음 3단계로 진행하십시오.

  • 정적 멀웨어 분석
  • 동적 멀웨어 분석
  • 메모리 멀웨어 분석

정적 멀웨어 분석

정적 멀웨어 분석이란 멀웨어 샘플을 실행하지 않고 검사하는 것을 말한다. 악성 바이너리에 대한 모든 정보를 제공하는 것으로 구성된다. 정적 분석의 첫 번째 단계는 MD5 또는 SHA1과 같은 암호 해시가 샘플 파일의 고유 식별자 역할을 할 수 있기 때문에 해싱 값을 결정하는 것 외에 대상 시스템에 대해 명확한 비전을 갖는 멀웨어 크기와 파일 유형을 아는 것이다. 더 깊이 잠수하기 위해, 문자열을 찾고, 이진법을 해부하고, IDA와 같은 분해기를 사용하여 악성코드의 코드를 역 엔지니어링하는 것은 프로그램 지침을 연구함으로써 악성코드가 어떻게 작동하는지 알아보는 좋은 단계가 될 수 있다. 맬웨어 작성자들은 종종 맬웨어 분석가들의 작업을 더 어렵게 만들려고 노력하기 때문에 그들은 항상 포커와 암호기를 사용하여 탐지를 회피한다. 그렇기 때문에 정적 분석 중에는 PEiD와 같은 도구를 사용하여 검출할 필요가 있다.

이 기사에서는 YARA 룰을 어떻게 사용하는지 알아보려고 한다. 정적 멀웨어 분석을 수행할 때 멀웨어를 분류하고 해시 등 식별하는 기법이 많이 있다. 또 다른 기술은 YARA 규칙을 사용하는 것이다. 위키피디아에 따르면:

" YARA는 주로 멀웨어 연구와 탐지에 사용되는 도구의 이름이다. 텍스트 또는 이진 패턴을 기반으로 멀웨어 패밀리에 대한 설명을 생성하는 규칙 기반 접근 방식을 제공한다. 설명은 기본적으로 Yara 규칙 이름이며, 여기서 이러한 규칙은

Yara 설치:

물론 첫 번째 단계는 YARA를 설치하는 것이다. 예를 들어 우분투(Ubuntu)를 사용한다면 간단히 사용할 수 있다.

sudo apt-get install yara

내 컴퓨터에 이미 설치되어 있음

또는 tar 파일을 다운로드하여 Github https://github.com/VirusTotal/yara/releases에서 설치할 수 있다.

tar -zxf yara-3.7.1.tar.gz

cd yara-3.7.1

./bootstrap.sh ./configure make make install

Yara는 libtool make automatic libtool make and gcc가 필요하므로 라이브러리를 이미 설치했는지 확인하십시오.

sudo apt-get install automake libtool make gcc

잘 되었는지 확인해보자.

더미 규칙 만들기

echo "rule dummy { condition: true }" > my_first_rule

yara my_first_rule my_first_rule

만약 당신이 "my_first_rule"을 얻는다면, 모든 것은 괜찮아! 

공식 YARA 문서는 https://yara.readthedocs.io/en/stable/gettingstarted.html에서 확인할 수 있다.

Yara 규칙을 사용하여 멀웨어 탐지

우리는 맬웨어를 탐지하기 위해 야라 규칙을 사용한다는 것을 이미 알게 되었다. 그것을 어떻게 하는지를 실제의 예에서 알아보자. 테스트 목적으로 "TheZoo"라는 데이터 집합의 맬웨어를 사용할 겁니다. https://thezoo.morirt.com 프로젝트 소유자는 리포지토리를 다음과 같이 정의한다.

TheZoo는 악성코드 분석의 가능성을 공개하고 대중에게 제공하기 위해 만들어진 프로젝트다. 거의 모든 버전의 악성코드가 분석이 가능한 방식으로 매우 어렵다는 것을 알게 되었기 때문에, 우리는 접근 가능하고 안전한 방법으로 모든 악성코드를 수집하기로 결정했다. TheZoo는 Yuval tisf Nativ에 의해 태어났고 현재 Shahak Shalev에 의해 유지되고 있다.

부인

_ 이러한 악성 프로그램은 라이브  위험한 악성 프로그램임을 기억하십시오! 그들은 암호화되어 있고 자물쇠가 채워져 있는 것도 이유가 있다! 자신이 무엇을 하고 있는지 절대 확신하지 않는 한 그것들을 실행하지 마십시오! _

고립은 많은 컴퓨터 시스템에 의해 제공되는 보안 접근법이다. 그것은 손상된 하위 시스템이 전체 실체에 영향을 미치지 않도록 하기 위해 시스템을 더 작은 독립된 조각으로 나누는 것에 기초한다. 샌드박스를 사용하여 멀웨어를 분석하는 것은 신뢰할 수 없는 이진 파일을 실행하는 현명한 결정이다. 시스코 시스템 정보 시큐리티 조사관 몬나파 KA가 연구 프로젝트로 개발한 오픈소스 샌드박스인 쿠쿠 샌드박스, 리몬 등 야생의 샌드박스가 많다. 리눅스 악성코드를 자동으로 수집, 분석, 보고하는 파이썬 스크립트다. 오픈소스 툴을 이용한 정적·동적·메모리 분석을 실시해 실행 전·실행 중·후(사후 분석) 리눅스 악성코드를 검사할 수 있다.

멀웨어를 식별하기 위해 우리는 공개적으로 사용 가능한 규칙을 시연으로 사용할 것이다. 가장 큰 자원 중 하나는 https://github.com/Yara-Rules/rules이다.

복제

git clone https://github.com/Yara-Rules/rules

이 프로젝트는 서로 다른 Yara __signature__을 가능한 한 최신 상태로 정리, 분류, 보관하는 단일 저장소를 보유하기 위한 IT __Security Researchs_ 그룹의 필요성을 다루고 있으며, Yara 규칙 수집을 위한 오픈 소스 __community_로 시작했다. Yara 규칙 집합은 GNU-GPLv2 라이센스 하에 있으며, 이 라이센스 하에서 사용하는 한 모든 사용자 또는 조직에 개방되어 있다.

규칙을 실행하려면 Yara 버전 3 이상이 필요하다.

멀웨어를 탐지하려면 일반적으로 다음 형식을 따르십시오.

yara [OPTIONS] RULES_FILE TARGET

예를 들어 NJ-RAT 탐지

다음 명령 실행

yara /home/azureuser/rules/malware/RAT\_Njrat.yar /home/azureuser/malwares/theZoo/malwares/Binaries/njRAT-v0.6.4/njRAT-v0.6.4

Yara가 악의적인 파일을 탐지함

야라 규칙 구조

이제 야라 규칙의 구조를 탐구해 봅시다. Yara 규칙은 일반적으로 다음을 포함한다.

  • 메타 데이터: 규칙에 대한 정보(작성자, 개발 날짜 등)
  • 식별자
  • 문자열 식별: 악성코드를 탐지하려면 YARA에서 찾아야 하는 문자열을 추가해야 한다.
  • 조건: 이것은 식별된 문자열과 지시자를 탐지하기 위한 논리적 규칙이다.

예를 들어, 이것은 단순한 야라 규칙의 골격이다.

rule Malware\_Detection { strings: $a = "Sring1" $b = "String2" condition: ($a or $b) }

다음 용어를 식별자로 사용할 수 없음:

all, and, any, ascii, at, condition, contains,entrypoint, false, filesize, fullword, for, global, in ,import, include, int8, int16, int32, int8be, int16be,int32be, matches, meta, nocase, not, or, of,private, rule, strings, them, true, uint8, uint16,uint32, uint8be, uint16be, uint32be, wide

이것은 njRAT 검출에 대한 Yara 규칙이다.

첫 번째 YARA 규칙을 만드는 방법

아르다막스 키로거를 검출하는 규칙을 만들 것이라고 가정해 보자. 먼저 문자열 명령을 사용하여 문자열을 추출해야 함

strings ArdamaxKeylogger_E33AF9E602CBB7AC3634C2608150DD18

데모를 위해 일부 문자열을 선택하십시오. 내 경우 다음을 선택하십시오.

  • 잘못된 비트 길이 반복
  • ?1type__@@@UAE@ XZ
  • .?AVtype_info@@@

텍스트 편집기를 열고 규칙 만들기(FirstRule.yar)

rule FirstRule { meta: author = "Chiheb" last_updated = "2019" category = "Test" confidence = "medium" description = "This rule was made for a Peerlsyt Article" strings: $a = "invalid bit length repeat" ascii wide nocase $b = "??1type_info@@UAE@XZ" ascii wide nocase $c = ".?AVtype_info@@" ascii wide nocase condition: ($a or $b or $c) }

와이드(wide)가 추가되어 문자당 2바이트로 인코딩된 문자열을 검색

Yara의 대소문자를 구분하는 기능을 끄기 위해 대소문자를 구분하지 않았다.

규칙을 저장하고 실행:

yara FirstRule.yar ~/malwares/theZoo/malwares/Binaries/Keylogger.Ardamax

Yara가 우리의 규칙에 따라 악의적인 파일을 탐지한 것을 볼 수 있다.

Yara는 정규식을 지원하므로 다음 표현 중 하나를 사용할 수 있다.

*0회 이상 일치

+ 1회 이상 일치
? 0 또는 1회 일치
{n} 정확히 n번 일치
{n,} 일치 횟수 n회 이상
{,m} 0 ~ m 횟수 일치
{n,m} n ~ m 횟수 일치

야라 파이톤

Yara-Python이라는 도서관 덕분에 당신의 python API에 Yara 기능을 추가할 수 있다.

이 라이브러리와 함께 사용할 수 있음 YARA Python 프로그램에서. 규칙의 컴파일, 저장 및 로딩부터 __scanning__파일, 문자열, 프로세스에 이르기까지 YARA의 모든 기능을 망라한다.

설치하려면:

clone https://github.com/VirusTotal/yara-python

cd yara-python

python setup.py build

sudo python setup.py install

다음은 Yara-python을 파이썬 어플리케이션에 포함시키는 방법을 보여주는 예다.

>>> import yara >>> rule = yara.compile(source='rule foo: bar {strings: $a = "lmn" condition: $a}') >>> matches = rule.match(data='abcdefgjiklmnoprstuvwxyz') >>> print(matches) [foo] >>> print(matches[0].rule) foo >>> print(matches[0].tags) ['bar'] >>> print(matches[0].strings) [(10L, '$a', 'lmn')]

회피기법

검은 모자 해커들은 매우 똑똑한 사람들이다. 그래서 항바이러스제를 피하고 탐지를 피할 수 있는 방법을 매일 찾고 있는 것이다.항바이러스제는 완전히 보호 해결책은 아니다. 모든 AV 공급업체들은 그들의 솔루션이 아무리 정교해도 진보된 지속적인 공격을 감지하지 못하고 있다. 공격자들은 안티바이러스 보호를 우회하기 위해 많은 수단과 방법을 사용하고 있다. 다음은 항바이러스제를 속이는 데 사용되는 몇 가지 방법이다.

  • 난독화는 멀웨어 2진법의 텍스트 구조를 가능한 한 읽기 어렵게 만드는 데 사용되는 기법이다. 멀웨어 개발 세계는 우리가 끈이라고 부르는 것을 감추기 위해 필수적이다. 문자열은 일반적으로 URL, 레지스트리 키 등이 중요한 단어다. 이를 위해 암호표준은 이 과제를 달성하기 위해 많은 경우에 사용된다.
  • 바인딩은 맬웨어를 다른 합법적인 응용 프로그램에 바인딩하는 작업이다.
  • 크라이퍼와 패커는 악성코드를 암호화하고 바이러스 백신에서 내부를 들여다보지 못하도록 하는 데 사용되는 도구와 기술이다. 패커들은 역엔지니어링을 더 어렵게 만들기 위해 실행 가능한 압축 방법이라고 불리는 시간을 사용한다.

요약

지금까지 악성 소프트웨어 종류에 대한 간략한 개요를 살펴본 후 다양한 멀웨어 분석 접근방식이 무엇인지 살펴보았다. 나중에 우리는 야라 규칙, 그들의 구조, 그것들과 함께 악성코드를 탐지하는 방법, 그리고 당신 자신의 첫 번째 야라 규칙을 만드는 방법을 탐구하기 시작한다. 그리고 나서 우리는 야라의 비단뱀 인터페이스를 발견했다. 마지막으로, 우리는 AV 회피 기술을 배웠다.

참조 및 추가 판독:

  1. https://www.real0day.com/hacking-tutorials/yara
  2. https://0x00sec.org/t/tutorial-creating-yara-signatures-for-malware-detection/5453
  3. https://github.com/VirusTotal/yara-python
  4. https://seanthegeek.net/257/install-yara-write-yara-rules/
  5. https://yara.readthedocs.io/en/v3.4.0/writingrules.html

 

더보기

Malware Analysis: How to use Yara rules to detect malware

When performing malware analysis, the analyst needs to collect every piece of information that can be used to identify malicious software. One of the techniques is Yara rules. In this article, we are going to explore Yara rules and how to use them in order to detect malware.

The article outline is the following:

  • What is malware analysis
  • Static malware analysis techniques
  • What is Yara and how to install it
  • Detect malware with Yara
  • Yara rule structure
  • How to write your first Yara rule
  • Yara-python

After reading this article you can download this small document that includes other helpful resources: Yara Rules Resources

Malware Analysis

Malware is a complex and malicious piece of software.Its behavior range from basic actions like simple modifications of computer systems to advanced behaviors patterns.

By definition, a malware is a malicious piece of software with the aim of damaging computer systems like data andidentity stealing ,espionage,legitimate users infection and gaining full or limited control to its developer.To have a clear understanding of malware analysis, a malware categorization based on its behavior is a must. Even sometimes we cannot classify a malware because it uses many different functionalities but in general, malware can be divided into many categories some of them are described below:

  • Trojan: is a malware that appears as a legitimate application
  • Virus: this type of malware copy itself and infect computer machines
  • Botnets are networks of compromised machines which are generally controlled by a command and control (C2C) channel
  • Ransomware this malware encrypts all the data on a computer and ask the victim usually using the cryptocurrency Bitcoin to get the decryption key
  • Spyware as it is obvious from the name it is a malware that tracks all the user activities including Search history,installed applications
  • Rootkit enables the attacker to gain an unauthorized access generally administrative to a system.Basically, it is unnoticeable and makes its removal as hard as possible

Malware analysis is the art of determining the functionality, origin and potential impact of a given malware sample, such as a virus, worm, trojan horse, rootkit, or backdoor. As a malware analyst, our main role is to collect all the information about malicious software and have a good understanding of what happened to the infected machines. Like any process, to perform a malware analysis we typically need to follow a certain methodology and a number of steps. To perform Malware Analysis we can go thru three phases:

  • Static Malware Analysis
  • Dynamic Malware Analysis
  • Memory Malware Analysis

Static Malware analysis

Static malware analysis refers to the examination of the malware sample without executing it. It consists of providing all the information about the malicious binary. The first steps in static analysis are knowing the malware size and file type to have a clear vision about the targeted machines, in addition to determining the hashing values, because cryptographic hashes like MD5 or SHA1 can serve as a unique identifier for the sample file. To dive deeper, finding strings, dissecting the binary and reverse engineering the code of malware using a disassembler like IDA could be a great step to explore how the malware works by studying the program instructions. Malware authors often are trying to make the work of malware analysts harder so they are always using packers and cryptors to evade detection. That is why, during static analysis, it is necessary to detect them using tools like PEiD.

In this article, we are going to explore how to use YARA Rules. When performing static malware analysis there are many techniques to classify malware and identify it such as hashes. Another technique is using YARA rules. According to Wikipedia:

" YARA is the name of a tool primarily used in malware research and detection. It provides a rule -based approach to create descriptions of malware families based on textual or binary patterns. A description is essentially a Yara rule name, where these rules

Install Yara:

The first step, of course, is installing YARA. If you are using Ubuntu for example, you can simply use

sudo apt-get install yara

It is already installed on my machine

Or you can download the tar file and install it from Github https://github.com/VirusTotal/yara/releases

tar -zxf yara-3.7.1.tar.gz

cd yara-3.7.1

./bootstrap.sh ./configure make make install

Yara needs the following libraries automake libtool make and gcc so ensure that you already installed them

sudo apt-get install automake libtool make gcc

Let's check if everything went well

Create a dummy rule

echo "rule dummy { condition: true }" > my_first_rule

yara my_first_rule my_first_rule

If you get " dummy my_first_rule" then everything is Okay! 

The Official YARA documentation can be found here: https://yara.readthedocs.io/en/stable/gettingstarted.html

Detect Malware with Yara rules

We already learned that we use Yara rules to detect malware. Let's discover how to do that in a real-world example. For testing purposes, I am going to use malware from a dataset called "theZoo": https://thezoo.morirt.com. The project owners define the repository as follows:

theZoo is a project created to make the possibility of malware analysis open and available to the public. Since we have found out that almost all versions of malware are very hard to come by in a way which will allow analysis, we have decided to gather all of them for you in an accessible and safe way. theZoo was born by Yuval tisf Nativ and is now maintained by Shahak Shalev.

Disclaimer

_ Please remember that these are live and dangerous malware! They come encrypted and locked for a reason! Do NOT run them unless you are absolutely sure of what you are doing! _

Isolation is a security approach provided by many computer systems. It is based on splitting the system into smaller independent pieces to make sure that a compromised sub-system cannot affect the entire entity. Using a sandbox to analyse malware is a wise decision to run untrusted binaries. There are many sandboxes in the wild, such as Cuckoo Sandbox and LIMON, which is an open source sandbox developed by cisco systems Information Security Investigator Monnappa K A as a research project. It is a Python script that automatically collects, analyzes, and reports on Linux malware. It allows one to inspect the Linux malware before execution, during execution, and after execution (post-mortem analysis) by performing static, dynamic and memory analysis using open source tools.

To identify malware we are going to use publically available rules as a demonstration. One of the greatest resources is https://github.com/Yara-Rules/rules

Clone them

git clone https://github.com/Yara-Rules/rules

This project covers the need of a group of IT __Security Researchers__ to have a single repository where different Yara __signatures__ are compiled, classified and kept as up to date as possible, and began as an open source __community__ for collecting Yara rules. Our Yara ruleset is under the GNU-GPLv2 license and open to any user or organization, as long as you use it under this license.

Yara version 3 or higher is required to run the rules.

To detect malware, generally, you need to follow this format

yara [OPTIONS] RULES_FILE TARGET

For example to detect NJ-RAT

Run the following command

yara /home/azureuser/rules/malware/RAT\_Njrat.yar /home/azureuser/malwares/theZoo/malwares/Binaries/njRAT-v0.6.4/njRAT-v0.6.4

Yara detect the malicious file

Yara Rules structure

Now let's explore the structure of a Yara rule. Yara rules usually contain:

  • Metadata: Information about the rule (Author, development date and so on)
  • Identifiers
  • Strings identification: You need to add the strings that YARA needs to look for in order to detect malware.
  • Condition: this is a logical rule to detect the identified strings and indicators.

For example, this is a skeleton of a simple Yara rule:

rule Malware\_Detection { strings: $a = "Sring1" $b = "String2" condition: ($a or $b) }

You can't use these terms as identifiers:

all, and, any, ascii, at, condition, contains,entrypoint, false, filesize, fullword, for, global, in ,import, include, int8, int16, int32, int8be, int16be,int32be, matches, meta, nocase, not, or, of,private, rule, strings, them, true, uint8, uint16,uint32, uint8be, uint16be, uint32be, wide

This is the Yara rule for the njRAT detection

How to create your first YARA rule

Let's suppose that we are going to create a rule that detects Ardamax Keylogger. First we need to extract the strings using strings command

strings ArdamaxKeylogger_E33AF9E602CBB7AC3634C2608150DD18

Select some strings for demonstration purposes. In my case I am going to select:

  • invalid bit length repeat
  • ??1type_info@@UAE@XZ
  • .?AVtype_info@@

Open a text editor and create your rule (FirstRule.yar)

rule FirstRule { meta: author = "Chiheb" last_updated = "2019" category = "Test" confidence = "medium" description = "This rule was made for a Peerlsyt Article" strings: $a = "invalid bit length repeat" ascii wide nocase $b = "??1type_info@@UAE@XZ" ascii wide nocase $c = ".?AVtype_info@@" ascii wide nocase condition: ($a or $b or $c) }

wide was added to search for strings encoded with two bytes per character

No case was used to turn off the case-sensitive capability of Yara

Save the rule and run:

yara FirstRule.yar ~/malwares/theZoo/malwares/Binaries/Keylogger.Ardamax

As you can see Yara detected the malicious file based on our rules:

Yara supports regular expressions thus you can use one of the following expressions

*Match 0 or more times
+ Match 1 or more times
? Match 0 or 1 time
{n} Match exactly n times
{n,} Match at least n times
{,m} Match 0 to m times
{n,m} Match n to m times

Yara Python

It is possible to add Yara capabilities to your python API thanks to a library called "Yara-Python".

With this library you can use YARA from your Python programs. It covers all YARA's features, from compiling, saving and loading rules to __scanning__ files, strings and processes.

To install it:

clone https://github.com/VirusTotal/yara-python

cd yara-python

python setup.py build

sudo python setup.py install

This is an example that shows how to include Yara-python in your python application:

>>> import yara >>> rule = yara.compile(source='rule foo: bar {strings: $a = "lmn" condition: $a}') >>> matches = rule.match(data='abcdefgjiklmnoprstuvwxyz') >>> print(matches) [foo] >>> print(matches[0].rule) foo >>> print(matches[0].tags) ['bar'] >>> print(matches[0].strings) [(10L, '$a', 'lmn')]

Evasion techniques

Black hat Hackers are highly intelligent people. That is why they are looking every day for methods to escape antiviruses and avoid detection.Antiviruses are not totally protection solutions. All the AV vendors are failing to detect advanced persistent attacks no matter how sophisticated their solutions are. Attackers are using many means and tactics to bypass Antivirus protection. Below are some methods used to fool the antiviruses:

  • Obfuscation is a technique used to make the textual structure of a malware binary hard to read as much as possible. In malware development world is vital to hide what we call the strings. Strings are significant words usually are URLs, registry keys etc.. To do this, cryptographic standards are used in many cases to achieve this task
  • Binding is the operation of binding the malware into another legitimate application
  • Crypters and packers are tools and techniques used to encrypt a malware and keep the antivirus away from peeking inside. Packers some time called executable compression methods are used to make reverse engineering more difficult.

Summary

By now, we explored what is the different malware analysis approaches after a small overview of some types of malicious pieces of software. Later we start exploring Yara rules, their structures, how to detect malware with them and how to create your own first Yara rule. Then we discovered the python interface of Yara. Finally, we learned some AV evasion techniques.

References and further reading:

  1. https://www.real0day.com/hacking-tutorials/yara
  2. https://0x00sec.org/t/tutorial-creating-yara-signatures-for-malware-detection/5453
  3. https://github.com/VirusTotal/yara-python
  4. https://seanthegeek.net/257/install-yara-write-yara-rules/
  5. https://yara.readthedocs.io/en/v3.4.0/writingrules.html

 

 

※ 출처 : Blue Teams Academy | www.blueteamsacademy.com/yara/

반응형

댓글